From aed708aa554c8928e4ab85497917b1a6e99b1a25 Mon Sep 17 00:00:00 2001 From: Ilia Borovitinov Date: Sun, 2 Oct 2022 16:24:06 +0300 Subject: [PATCH 01/12] Added binary builds --- .github/workflows/release.yaml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..f5d8b2c --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,30 @@ +name: Release +on: + push: + tags: + - "v*.*.*" + branches: + - "ilia/ci-*" + +jobs: + build_binary: + name: Build binary on linux + strategy: + matrix: + os: [ubuntu-20.04, macos-12] + runs-on: ${{ matrix.os }} + env: + MIX_ENV: prod + steps: + - uses: actions/checkout@v2 + - uses: erlef/setup-beam@v1 + with: + otp-version: 25.0 + elixir-version: 1.14 + - run: mix deps.get + - run: mix release + - uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.os }}-binary + path: _build/prod/rel/bakeware/electric + \ No newline at end of file From 3aedc0cbbd99dc8ec4fb87af4cdb4560549cea95 Mon Sep 17 00:00:00 2001 From: Ilia Borovitinov Date: Sun, 2 Oct 2022 16:28:05 +0300 Subject: [PATCH 02/12] Fixed public repo references to use https --- mix.exs | 4 ++-- mix.lock | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mix.exs b/mix.exs index 5626bed..1b87ccd 100644 --- a/mix.exs +++ b/mix.exs @@ -39,14 +39,14 @@ defmodule Electric.MixProject do defp deps do [ {:bakeware, "~> 0.2.4", runtime: false}, - {:cli_spinners, [git: "git@github.com:thruflo/elixir_cli_spinners.git"]}, + {:cli_spinners, [github: "thruflo/elixir_cli_spinners"]}, {:dialyxir, "~> 1.0", only: :dev, runtime: false}, {:ex_doc, "~> 0.28", only: :dev, runtime: false}, {:exconstructor, "~> 1.2.6"}, {:git_hooks, "== 0.6.5", only: :dev, runtime: false}, {:jason, "~> 1.3.0"}, {:memoize, "~> 1.4"}, - {:optimus, [git: "git@github.com:thruflo/optimus.git"]}, + {:optimus, [github: "thruflo/optimus"]}, {:req, "~> 0.3.0"}, {:exqlite, "~> 0.11.3"}, {:uuid, "~> 1.1.8"} diff --git a/mix.lock b/mix.lock index 523fae3..6955b37 100644 --- a/mix.lock +++ b/mix.lock @@ -2,9 +2,9 @@ "bakeware": {:hex, :bakeware, "0.2.4", "0aaf49b34f4bab2aa433f9ff1485d9401e421603160abd6d269c469fc7b65212", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "7b97bcf6fbeee53bb32441d6c495bf478d26f9575633cfef6831e421e86ada6d"}, "blankable": {:hex, :blankable, "1.0.0", "89ab564a63c55af117e115144e3b3b57eb53ad43ba0f15553357eb283e0ed425", [:mix], [], "hexpm", "7cf11aac0e44f4eedbee0c15c1d37d94c090cb72a8d9fddf9f7aec30f9278899"}, "castore": {:hex, :castore, "0.1.18", "deb5b9ab02400561b6f5708f3e7660fc35ca2d51bfc6a940d2f513f89c2975fc", [:mix], [], "hexpm", "61bbaf6452b782ef80b33cdb45701afbcf0a918a45ebe7e73f1130d661e66a06"}, + "cli_spinners": {:git, "https://github.com/thruflo/elixir_cli_spinners.git", "a29e72239025afefa85426cb05722f05a20bdd6e", []}, "connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix], [], "hexpm", "722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c"}, "db_connection": {:hex, :db_connection, "2.4.2", "f92e79aff2375299a16bcb069a14ee8615c3414863a6fef93156aee8e86c2ff3", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "4fe53ca91b99f55ea249693a0229356a08f4d1a7931d8ffa79289b145fe83668"}, - "cli_spinners": {:git, "git@github.com:thruflo/elixir_cli_spinners.git", "a29e72239025afefa85426cb05722f05a20bdd6e", []}, "dialyxir": {:hex, :dialyxir, "1.2.0", "58344b3e87c2e7095304c81a9ae65cb68b613e28340690dfe1a5597fd08dec37", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "61072136427a851674cab81762be4dbeae7679f85b1272b6d25c3a839aff8463"}, "earmark_parser": {:hex, :earmark_parser, "1.4.26", "f4291134583f373c7d8755566122908eb9662df4c4b63caa66a0eabe06569b0a", [:mix], [], "hexpm", "48d460899f8a0c52c5470676611c01f64f3337bad0b26ddab43648428d94aabc"}, "elixir_make": {:hex, :elixir_make, "0.6.3", "bc07d53221216838d79e03a8019d0839786703129599e9619f4ab74c8c096eac", [:mix], [], "hexpm", "f5cbd651c5678bcaabdbb7857658ee106b12509cd976c2c2fca99688e1daf716"}, @@ -25,7 +25,7 @@ "nimble_options": {:hex, :nimble_options, "0.4.0", "c89babbab52221a24b8d1ff9e7d838be70f0d871be823165c94dd3418eea728f", [:mix], [], "hexpm", "e6701c1af326a11eea9634a3b1c62b475339ace9456c1a23ec3bc9a847bca02d"}, "nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"}, "nimble_pool": {:hex, :nimble_pool, "0.2.6", "91f2f4c357da4c4a0a548286c84a3a28004f68f05609b4534526871a22053cde", [:mix], [], "hexpm", "1c715055095d3f2705c4e236c18b618420a35490da94149ff8b580a2144f653f"}, - "optimus": {:git, "git@github.com:thruflo/optimus.git", "a551907874750e596424f0465f40d7792523881f", []}, + "optimus": {:git, "https://github.com/thruflo/optimus.git", "a551907874750e596424f0465f40d7792523881f", []}, "recase": {:hex, :recase, "0.7.0", "3f2f719f0886c7a3b7fe469058ec539cb7bbe0023604ae3bce920e186305e5ae", [:mix], [], "hexpm", "36f5756a9f552f4a94b54a695870e32f4e72d5fad9c25e61bc4a3151c08a4e0c"}, "req": {:hex, :req, "0.3.0", "45944bfa0ea21294ad269e2025b9983dd084cc89125c4fc0a8de8a4e7869486b", [:mix], [{:brotli, "~> 0.3.1", [hex: :brotli, repo: "hexpm", optional: true]}, {:ezstd, "~> 1.0", [hex: :ezstd, repo: "hexpm", optional: true]}, {:finch, "~> 0.9", [hex: :finch, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:nimble_csv, "~> 1.0", [hex: :nimble_csv, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "1212a3e047eede0fa7eeb84c30d08206d44bb120df98b6f6b9a9e04910954a71"}, "telemetry": {:hex, :telemetry, "1.1.0", "a589817034a27eab11144ad24d5c0f9fab1f58173274b1e9bae7074af9cbee51", [:rebar3], [], "hexpm", "b727b2a1f75614774cff2d7565b64d0dfa5bd52ba517f16543e6fc7efcc0df48"}, From 7d227edd8dadd6e89a59ff0c2984c4a93f468de2 Mon Sep 17 00:00:00 2001 From: Ilia Borovitinov Date: Sun, 2 Oct 2022 16:41:44 +0300 Subject: [PATCH 03/12] Added elixir installation on mac runner --- .github/workflows/release.yaml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f5d8b2c..9eada3c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,5 +1,5 @@ name: Release -on: +on: push: tags: - "v*.*.*" @@ -8,7 +8,7 @@ on: jobs: build_binary: - name: Build binary on linux + name: Build the cli binary strategy: matrix: os: [ubuntu-20.04, macos-12] @@ -18,13 +18,29 @@ jobs: steps: - uses: actions/checkout@v2 - uses: erlef/setup-beam@v1 + if: ${{ !startsWith(matrix.os, 'macos')}} with: otp-version: 25.0 elixir-version: 1.14 + - name: Setup elixir on mac + if: ${{ startsWith(matrix.os, 'macos')}} + run: | + brew update --preinstall + brew install erlang@25 + brew install elixir + - name: Setup dependency caching + if: ${{ startsWith(matrix.os, 'macos')}} + uses: actions/cache@v3 + with: + path: | + deps + _build + key: ${{ runner.os }}-mix-${{ hashfiles('**/mix.lock')}} + restore-keys: | + ${{ runner.os }}-mix- - run: mix deps.get - run: mix release - uses: actions/upload-artifact@v3 with: name: ${{ matrix.os }}-binary path: _build/prod/rel/bakeware/electric - \ No newline at end of file From a655c70bf5188e9eecec4c28b10223d90fdb317d Mon Sep 17 00:00:00 2001 From: Ilia Borovitinov Date: Sun, 2 Oct 2022 17:22:01 +0300 Subject: [PATCH 04/12] Fixed hex not being present on mac --- .github/workflows/release.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 9eada3c..0880f4b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -28,6 +28,8 @@ jobs: brew update --preinstall brew install erlang@25 brew install elixir + mix local.hex --force + mix local.rebar --force - name: Setup dependency caching if: ${{ startsWith(matrix.os, 'macos')}} uses: actions/cache@v3 From 6318f5299d4f1c1faf77fe5ff809057fd20b100d Mon Sep 17 00:00:00 2001 From: Ilia Borovitinov Date: Sun, 2 Oct 2022 17:56:52 +0300 Subject: [PATCH 05/12] Added ubuntu 18 to test --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 0880f4b..3774380 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -11,7 +11,7 @@ jobs: name: Build the cli binary strategy: matrix: - os: [ubuntu-20.04, macos-12] + os: [ubuntu-20.04, ubuntu-18.04, macos-12] runs-on: ${{ matrix.os }} env: MIX_ENV: prod From 1ab3d2d856557df723a5b59a8b9ed97b56cae0a8 Mon Sep 17 00:00:00 2001 From: Ilia Borovitinov Date: Sun, 2 Oct 2022 18:35:11 +0300 Subject: [PATCH 06/12] Added a windows build --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3774380..336cf06 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -11,7 +11,7 @@ jobs: name: Build the cli binary strategy: matrix: - os: [ubuntu-20.04, ubuntu-18.04, macos-12] + os: [windows-latest, ubuntu-20.04, ubuntu-18.04, macos-12] runs-on: ${{ matrix.os }} env: MIX_ENV: prod From 93d3fa8854b704714ab490d3ccfb5fc71dddd9cf Mon Sep 17 00:00:00 2001 From: Ilia Borovitinov Date: Tue, 4 Oct 2022 22:38:11 +0300 Subject: [PATCH 07/12] added a self-hosted m1 runner --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 336cf06..23ccce1 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -11,7 +11,7 @@ jobs: name: Build the cli binary strategy: matrix: - os: [windows-latest, ubuntu-20.04, ubuntu-18.04, macos-12] + os: [windows-latest, ubuntu-20.04, ubuntu-18.04, macos-12, macos-12-m1] runs-on: ${{ matrix.os }} env: MIX_ENV: prod From 5119e7e482232fd1b7b4d24e1105654f4171cbab Mon Sep 17 00:00:00 2001 From: Ilia Borovitinov Date: Tue, 4 Oct 2022 22:39:26 +0300 Subject: [PATCH 08/12] Trying to fix windows build --- .github/workflows/release.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 23ccce1..83beb21 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -22,6 +22,9 @@ jobs: with: otp-version: 25.0 elixir-version: 1.14 + - name: Install build tools on windows + if: ${{ startsWith(matrix.os, 'windows')}} + run: choco install -y zstandard make - name: Setup elixir on mac if: ${{ startsWith(matrix.os, 'macos')}} run: | From 9d78f1bd12311809b5f7adad83b4ee1e64788209 Mon Sep 17 00:00:00 2001 From: Ilia Borovitinov Date: Tue, 4 Oct 2022 23:00:02 +0300 Subject: [PATCH 09/12] Trying to fix a missing `cc` on windows --- .github/workflows/release.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 83beb21..b1aa4c5 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -11,7 +11,8 @@ jobs: name: Build the cli binary strategy: matrix: - os: [windows-latest, ubuntu-20.04, ubuntu-18.04, macos-12, macos-12-m1] + # os: [windows-latest, ubuntu-20.04, ubuntu-18.04, macos-12, macos-12-m1] + os: [windows-latest] runs-on: ${{ matrix.os }} env: MIX_ENV: prod @@ -20,11 +21,13 @@ jobs: - uses: erlef/setup-beam@v1 if: ${{ !startsWith(matrix.os, 'macos')}} with: - otp-version: 25.0 + otp-version: 24.3 elixir-version: 1.14 - name: Install build tools on windows if: ${{ startsWith(matrix.os, 'windows')}} - run: choco install -y zstandard make + run: | + choco install -y zstandard make + Add-Content -Path $env:GITHUB_ENV -Value "CC=gcc" - name: Setup elixir on mac if: ${{ startsWith(matrix.os, 'macos')}} run: | @@ -44,7 +47,7 @@ jobs: restore-keys: | ${{ runner.os }}-mix- - run: mix deps.get - - run: mix release + - run: "dir env: ; mix release" - uses: actions/upload-artifact@v3 with: name: ${{ matrix.os }}-binary From e25f966f17de5bbf0498ce3e58dcdf8d017b0224 Mon Sep 17 00:00:00 2001 From: Ilia Borovitinov Date: Wed, 5 Oct 2022 00:00:48 +0300 Subject: [PATCH 10/12] Disabled windows for now --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b1aa4c5..a0c5033 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -12,7 +12,7 @@ jobs: strategy: matrix: # os: [windows-latest, ubuntu-20.04, ubuntu-18.04, macos-12, macos-12-m1] - os: [windows-latest] + os: [ubuntu-20.04, ubuntu-18.04, macos-12, macos-12-m1] runs-on: ${{ matrix.os }} env: MIX_ENV: prod From da0bff4c0df884a97c2feebb4d4811b873e5fe36 Mon Sep 17 00:00:00 2001 From: Ilia Borovitinov Date: Wed, 12 Oct 2022 19:07:27 +0300 Subject: [PATCH 11/12] Update release.yaml --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a0c5033..06dae2f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -47,7 +47,7 @@ jobs: restore-keys: | ${{ runner.os }}-mix- - run: mix deps.get - - run: "dir env: ; mix release" + - run: mix release - uses: actions/upload-artifact@v3 with: name: ${{ matrix.os }}-binary From 0e5e863c1171eee7b9ddeda640dd5870978cd7c6 Mon Sep 17 00:00:00 2001 From: Ilia Borovitinov Date: Wed, 12 Oct 2022 22:01:57 +0300 Subject: [PATCH 12/12] Added autobuild on release --- .github/workflows/release.yaml | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 06dae2f..a951fcd 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,10 +1,7 @@ name: Release on: - push: - tags: - - "v*.*.*" - branches: - - "ilia/ci-*" + release: + types: ["created"] jobs: build_binary: @@ -12,7 +9,7 @@ jobs: strategy: matrix: # os: [windows-latest, ubuntu-20.04, ubuntu-18.04, macos-12, macos-12-m1] - os: [ubuntu-20.04, ubuntu-18.04, macos-12, macos-12-m1] + os: [ubuntu-18.04, macos-12, macos-12-m1] runs-on: ${{ matrix.os }} env: MIX_ENV: prod @@ -52,3 +49,21 @@ jobs: with: name: ${{ matrix.os }}-binary path: _build/prod/rel/bakeware/electric + attach_artifacts: + name: Attach artifacts to release + if: github.event_name == 'release' + runs-on: ubuntu-20.04 + needs: build_binary + steps: + - uses: actions/download-artifact@v3 + with: + path: ./ + - run: | + mv ubuntu-18.04-binary/electic electricsql_cli_${{ github.event.release.tag_name }}_linux + mv macos-12-binary/electic electricsql_cli_${{ github.event.release.tag_name }}_intel_mac + mv macos-12-m1-binary/electic electricsql_cli_${{ github.event.release.tag_name }}_arm_mac + - uses: irongut/EditRelease@v1.2.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + id: ${{ github.event.release.id }} + files: "electricsql_cli_${{ github.event.release.tag_name }}_linux,electricsql_cli_${{ github.event.release.tag_name }}_intel_mac,electricsql_cli_${{ github.event.release.tag_name }}_arm_mac"