From 2a1f6b17b5a31bb9942bf208c930d58b97efb182 Mon Sep 17 00:00:00 2001 From: Krukon Date: Thu, 27 Jun 2024 11:51:39 +0200 Subject: [PATCH 1/9] setup GHA based CI for grpc --- .github/workflows/ci.yml | 280 +++++++++++++++++++++++++---- .github/workflows/dev-publish.yaml | 76 ++++++++ 2 files changed, 320 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/dev-publish.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 968b7166..1f1f7f8d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,62 +1,271 @@ -name: CI +name: Elixir CI Checks + +env: + DEBIAN_FRONTEND: noninteractive + DEPENDENCY_FILE: mix.lock + ELIXIR_VERSION: 1.11.4 # Elixir version used during package publishing + JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + OTP_VERSION: 23.3.4.7 # OTP version used during package publishing + RELEVANT_FILES: "mix.lock mix.exs lib priv config test" # Important, this controls the caching, make sure to keep this right + REPOSITORY: grpc + RUNNER_OS: ubuntu20 # Must match Elixir/OTP version in described in action erlef/setup-beam@v1 + SHA: ${{ github.sha }} + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true on: - pull_request: - branches: - - '**' push: branches: - master + pull_request: + types: + - synchronize + - opened + - reopened jobs: - check_format: - runs-on: ubuntu-latest - name: Check format - container: - image: elixir:1.9-slim + static: + name: Static Checks (Elixir ${{ matrix.elixir }}) + runs-on: runs-on,runner=2cpu-linux-x64 + outputs: + HASH: ${{ steps.hash.outputs.HASH }} + strategy: + fail-fast: false + matrix: + otp: [20.x, 21.x, 22.x] + elixir: [1.7.x, 1.8.x, 1.9.x, 1.10.x] + runner-os: [ubuntu20] + exclude: + - otp: 20.x + elixir: 1.10.x steps: - - uses: actions/checkout@v1 - - name: Install Dependencies + - name: Checkout latest codebase + uses: actions/checkout@v4 + with: + ref: ${{ env.SHA }} + clean: false + persist-credentials: true + - name: Setup Elixir + uses: erlef/setup-beam@v1 + env: + ImageOS: ${{ matrix.runner-os }} + with: + elixir-version: ${{ matrix.elixir }} + otp-version: ${{ matrix.otp }} + version-type: strict + - name: Get SHA sum (HASH) of relevant files + id: hash run: | - mix local.rebar --force - mix local.hex --force + git config --global --add safe.directory /__w/${{ env.repository }}/${{ env.repository }} + echo "Get SHA sum (HASH) of relevant files" + HASH="$(git ls-tree ${{ env.SHA }} -- ${{ env.RELEVANT_FILES }} | sha1sum | cut -d' ' -f1)" + echo "BUILD HASH FOR THE CODEBASE IS: $HASH" + echo "HASH=$HASH" >> $GITHUB_OUTPUT + - name: Hex auth + run: mix hex.organization auth fresha --key ${{ secrets.HEX_ORGANIZATION_WRITE_KEY }} + - uses: runs-on/cache@v4 + id: deps-cache + with: + path: | + deps + _build/dev + key: ${{ runner.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-precompile-deps-dev-${{ hashFiles('mix.lock') }} + - name: Install dependencies + if: steps.deps-cache.outputs.cache-hit != 'true' + env: + MIX_ENV: dev + run: | + echo "Installing dependencies" mix deps.get - - name: Check format - run: mix format --check-formatted - - tests: - runs-on: ubuntu-latest - name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}} + mix deps.compile + - uses: runs-on/cache@v4 + id: build-cache + with: + path: '**/*' + key: ${{ runner.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-compile-dev-${{ steps.hash.outputs.HASH }} + - name: Compile with warning as --warnings-as-errors + if: steps.build-cache.outputs.cache-hit != 'true' + run: | + echo "Compiling the app with --warnings-as-errors" + mix compile --warnings-as-errors --force + - name: Run credo + run: | + echo "Running credo" + mix credo --strict + - name: Run format + run: | + echo "Running format" + mix format --check-formatted --dry-run + - name: Run publish --dry-run + env: + HEX_API_KEY: ${{ secrets.HEX_ORGANIZATION_WRITE_KEY }} + run: | + echo "Running publish --dry-run" + mix hex.publish --dry-run + test: + name: Unit Tests (Elixir ${{ matrix.elixir }}) + runs-on: runs-on,runner=2cpu-linux-x64 strategy: + fail-fast: false matrix: otp: [20.x, 21.x, 22.x] elixir: [1.7.x, 1.8.x, 1.9.x, 1.10.x] + runner-os: [ubuntu20] exclude: - otp: 20.x elixir: 1.10.x - needs: check_format steps: - - uses: actions/checkout@v1 - - uses: actions/setup-elixir@v1.2.0 - with: - otp-version: ${{matrix.otp}} - elixir-version: ${{matrix.elixir}} - - name: Install Dependencies - run: | - mix local.rebar --force - mix local.hex --force - mix deps.get - - name: Run Tests - run: mix test + - name: Checkout latest codebase + uses: actions/checkout@v4 + with: + ref: ${{ env.SHA }} + clean: false + persist-credentials: true + - name: Setup Elixir + uses: erlef/setup-beam@v1 + env: + ImageOS: ${{ matrix.runner-os }} + with: + elixir-version: ${{ matrix.elixir }} + otp-version: ${{ matrix.otp }} + version-type: strict + - name: Get SHA sum (HASH) of relevant files + id: hash + run: | + git config --global --add safe.directory /__w/${{ env.repository }}/${{ env.repository }} + echo "Get SHA sum (HASH) of relevant files" + HASH="$(git ls-tree ${{ env.SHA }} -- ${{ env.RELEVANT_FILES }} | sha1sum | cut -d' ' -f1)" + echo "BUILD HASH FOR THE CODEBASE IS: $HASH" + echo "HASH=$HASH" >> $GITHUB_OUTPUT + - name: Hex auth + run: mix hex.organization auth fresha --key ${{ secrets.HEX_ORGANIZATION_WRITE_KEY }} + - uses: runs-on/cache@v4 + id: deps-cache + with: + path: | + deps + _build/test + key: ${{ runner.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-precompile-deps-test-${{ hashFiles('mix.lock') }} + - name: Install dependencies + if: steps.deps-cache.outputs.cache-hit != 'true' + env: + MIX_ENV: test + run: | + echo "Installing dependencies" + mix deps.get + mix deps.compile + - uses: runs-on/cache@v4 + id: build-cache + with: + path: '**/*' + key: ${{ runner.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-compile-test-${{ steps.hash.outputs.HASH }} + - name: Compile with MIX_ENV=test + if: steps.build-cache.outputs.cache-hit != 'true' + env: + MIX_ENV: test + run: | + echo "Compiling the app with MIX_ENV=test" + mix compile --force + - name: Run tests + run: | + echo "Running tests" + mix test --cover + permit: + name: Permit Package Publishing + needs: [static, test] + runs-on: runs-on,runner=1cpu-linux-x64 + outputs: + PUBLISH: ${{ steps.version.outputs.PUBLISH }} + steps: + - name: Checkout latest codebase + uses: actions/checkout@v4 + with: + fetch-depth: 2 + ref: ${{ env.SHA }} + clean: false + persist-credentials: true + - name: Create Approval File + shell: bash + run: | + echo "CI Checks Passed for SHA ${{ env.SHA }} and HASH ${{ needs.static.outputs.HASH }}" > approval.txt + - name: Process Package Version + shell: bash + id: version + run: | + echo "===============================================" + echo "" + git show HEAD~1:mix.exs > mix.old.exs + diff mix.old.exs mix.exs > diff.txt || true + old_version=$(grep -oP 'version: "\K[^"]+' mix.old.exs) + new_version=$(grep -oP 'version: "\K[^"]+' mix.exs) + echo "Old Version: $old_version | New Version: $new_version" + if [ "$new_version" != "$old_version" ]; then + if [ "$new_version" \> "$old_version" ]; then + echo "Version is upped - WILL publish upon merging the PR" + echo "PUBLISH=true" >> $GITHUB_OUTPUT + else + echo "Version is lower than the original version - blocking publication" + echo "PUBLISH=false" >> $GITHUB_OUTPUT + exit 1 + fi + else + echo "PUBLISH=false" >> $GITHUB_OUTPUT + echo "Version is unchanged - WONT publish upon merging the PR" + fi + echo "" + echo "===============================================" + - name: Cache Approval File + uses: runs-on/cache/save@v4 + with: + path: approval.txt + key: ${{ runner.os }}-${{ env.REPOSITORY }}-approval-${{ needs.static.outputs.HASH }} + + publish: + name: Publish Hex Package + needs: [permit] + runs-on: runs-on,runner=2cpu-linux-x64 + if: needs.permit.outputs.PUBLISH == 'true' && github.event_name == 'push' + steps: + - name: Checkout latest codebase + uses: actions/checkout@v4 + with: + ref: ${{ env.SHA }} + clean: false + persist-credentials: true + - name: Setup Elixir + uses: erlef/setup-beam@v1 + env: + ImageOS: ${{ env.RUNNER_OS }} + with: + elixir-version: ${{ env.ELIXIR_VERSION }} + otp-version: ${{ env.OTP_VERSION }} + version-type: strict + - name: Hex auth + run: mix hex.organization auth fresha --key ${{ secrets.HEX_ORGANIZATION_WRITE_KEY }} + shell: bash + - name: Get dependencies + shell: bash + run: | + echo "Getting dependencies" + mix deps.get + - name: Publish dev package + shell: bash + env: + HEX_API_KEY: ${{ secrets.HEX_ORGANIZATION_WRITE_KEY }} + run: | + echo "Publishing package" + mix hex.publish --yes + interop-tests: runs-on: ubuntu-latest name: Interop tests container: image: elixir:1.9-slim - needs: check_format steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Install Dependencies run: | mix local.rebar --force @@ -70,11 +279,10 @@ jobs: check_release: runs-on: ubuntu-latest name: Check release - needs: check_format container: image: elixir:1.9-slim steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Install Dependencies run: | mix local.rebar --force diff --git a/.github/workflows/dev-publish.yaml b/.github/workflows/dev-publish.yaml new file mode 100644 index 00000000..ce8c8eb3 --- /dev/null +++ b/.github/workflows/dev-publish.yaml @@ -0,0 +1,76 @@ +name: Elixir Dev Publish + +env: + DEBIAN_FRONTEND: noninteractive + DEPENDENCY_FILE: mix.lock + ELIXIR_VERSION: 1.11.4 # Elixir version used during package publishing + JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + OTP_VERSION: 23.3.4.7 # OTP version used during package publishing + RELEVANT_FILES: "mix.lock mix.exs lib priv config test" # Important, this controls the caching, make sure to keep this right + REPOSITORY: grpc + RUNNER_OS: ubuntu20 # Must match Elixir/OTP version in described in action erlef/setup-beam@v1 + SHA: ${{ github.sha }} + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + workflow_dispatch: + inputs: {} + +jobs: + dev-publish: + name: Dev Publish + runs-on: runs-on,runner=4cpu-linux-x64 + steps: + - name: Checkout latest codebase + uses: actions/checkout@v4 + with: + ref: ${{ env.sha }} + clean: false + persist-credentials: true + - name: Get SHA sum (HASH) of relevant files + id: hash + shell: bash + run: | + git config --global --add safe.directory /__w/${{ env.REPOSITORY }}/${{ env.REPOSITORY }} + echo "Get SHA sum (HASH) of relevant files" + HASH="$(git ls-tree ${{ env.SHA }} -- ${{ env.RELEVANT_FILES }} | sha1sum | cut -d' ' -f1)" + echo "BUILD HASH FOR THE CODEBASE IS: $HASH" + echo "IT WILL BE USED TO DETERMINE ELIGIBILITY OF THE CODEBASE FOR THE RELEASE" + echo "APPROVAL PRODUCED BY SUCCESSFULL CHECKS EXECUTION WILL LAND IN CACHE" + echo "HASH=$HASH" >> $GITHUB_OUTPUT + - name: Check for CI successes + uses: runs-on/cache/restore@v4 + with: + key: ${{ runner.os }}-${{ env.repository }}-approval-${{ steps.hash.outputs.HASH }} + path: approval.txt + fail-on-cache-miss: true + - name: Setup Elixir + uses: erlef/setup-beam@v1 + env: + ImageOS: ${{ env.RUNNER_OS }} + with: + elixir-version: ${{ env.ELIXIR_VERSION }} + otp-version: ${{ env.OTP_VERSION }} + version-type: strict + - name: Hex auth + run: mix hex.organization auth fresha --key ${{ secrets.HEX_ORGANIZATION_WRITE_KEY }} + shell: bash + - name: Get dependencies + shell: bash + run: | + echo "Getting dependencies" + mix deps.get + - name: Mark package version with dev suffix + shell: bash + run: | + sed -i "s/version: \"[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+/&-git-$(git rev-parse --verify --short=4 HEAD)/" mix.exs + - name: Publish dev package + shell: bash + env: + HEX_API_KEY: ${{ secrets.HEX_ORGANIZATION_WRITE_KEY }} + run: | + echo "Publishing dev package" + mix hex.publish --yes \ No newline at end of file From abfab0cdd99a83faf9c237d001d9f607edf5a9ac Mon Sep 17 00:00:00 2001 From: Krukon Date: Thu, 27 Jun 2024 12:05:05 +0200 Subject: [PATCH 2/9] bump versions --- .github/workflows/ci.yml | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f1f7f8d..9c48559e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,12 +3,12 @@ name: Elixir CI Checks env: DEBIAN_FRONTEND: noninteractive DEPENDENCY_FILE: mix.lock - ELIXIR_VERSION: 1.11.4 # Elixir version used during package publishing + ELIXIR_VERSION: 1.16.3 # Elixir version used during package publishing JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - OTP_VERSION: 23.3.4.7 # OTP version used during package publishing + OTP_VERSION: 26.2.5.1 # OTP version used during package publishing RELEVANT_FILES: "mix.lock mix.exs lib priv config test" # Important, this controls the caching, make sure to keep this right REPOSITORY: grpc - RUNNER_OS: ubuntu20 # Must match Elixir/OTP version in described in action erlef/setup-beam@v1 + RUNNER_OS: ubuntu22 # Must match Elixir/OTP version in described in action erlef/setup-beam@v1 SHA: ${{ github.sha }} concurrency: @@ -34,12 +34,9 @@ jobs: strategy: fail-fast: false matrix: - otp: [20.x, 21.x, 22.x] - elixir: [1.7.x, 1.8.x, 1.9.x, 1.10.x] - runner-os: [ubuntu20] - exclude: - - otp: 20.x - elixir: 1.10.x + otp: [23, 24, 25] + elixir: [1.14, 1.15, 1.16] + runner-os: [ubuntu22] steps: - name: Checkout latest codebase uses: actions/checkout@v4 @@ -110,12 +107,9 @@ jobs: strategy: fail-fast: false matrix: - otp: [20.x, 21.x, 22.x] - elixir: [1.7.x, 1.8.x, 1.9.x, 1.10.x] - runner-os: [ubuntu20] - exclude: - - otp: 20.x - elixir: 1.10.x + otp: [23, 24, 25] + elixir: [1.14, 1.15, 1.16] + runner-os: [ubuntu22] steps: - name: Checkout latest codebase uses: actions/checkout@v4 @@ -263,7 +257,7 @@ jobs: runs-on: ubuntu-latest name: Interop tests container: - image: elixir:1.9-slim + image: elixir:1.16-slim steps: - uses: actions/checkout@v4 - name: Install Dependencies @@ -280,7 +274,7 @@ jobs: runs-on: ubuntu-latest name: Check release container: - image: elixir:1.9-slim + image: elixir:1.16-slim steps: - uses: actions/checkout@v4 - name: Install Dependencies From 027e735230c17fc03ad02fc78b3707ae15c0ef87 Mon Sep 17 00:00:00 2001 From: Krukon Date: Thu, 27 Jun 2024 12:50:44 +0200 Subject: [PATCH 3/9] downgrade --- .github/workflows/ci.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c48559e..925b5e2a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,9 +3,9 @@ name: Elixir CI Checks env: DEBIAN_FRONTEND: noninteractive DEPENDENCY_FILE: mix.lock - ELIXIR_VERSION: 1.16.3 # Elixir version used during package publishing + ELIXIR_VERSION: 1.10.4 # Elixir version used during package publishing JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - OTP_VERSION: 26.2.5.1 # OTP version used during package publishing + OTP_VERSION: 22.3.4.7 # OTP version used during package publishing RELEVANT_FILES: "mix.lock mix.exs lib priv config test" # Important, this controls the caching, make sure to keep this right REPOSITORY: grpc RUNNER_OS: ubuntu22 # Must match Elixir/OTP version in described in action erlef/setup-beam@v1 @@ -34,9 +34,9 @@ jobs: strategy: fail-fast: false matrix: - otp: [23, 24, 25] - elixir: [1.14, 1.15, 1.16] - runner-os: [ubuntu22] + otp: [20.3.8.26, 21.3.8.24, 22.3.4.7] + elixir: [1.9.4, 1.10.4] + runner-os: [ubuntu20] steps: - name: Checkout latest codebase uses: actions/checkout@v4 @@ -107,9 +107,9 @@ jobs: strategy: fail-fast: false matrix: - otp: [23, 24, 25] - elixir: [1.14, 1.15, 1.16] - runner-os: [ubuntu22] + otp: [20.3.8.26, 21.3.8.24, 22.3.4.7] + elixir: [1.9.4, 1.10.4] + runner-os: [ubuntu20] steps: - name: Checkout latest codebase uses: actions/checkout@v4 @@ -254,10 +254,10 @@ jobs: interop-tests: - runs-on: ubuntu-latest + runs-on: runs-on,runner=2cpu-linux-x64 name: Interop tests container: - image: elixir:1.16-slim + image: elixir:1.10-slim steps: - uses: actions/checkout@v4 - name: Install Dependencies @@ -271,10 +271,10 @@ jobs: working-directory: ./interop check_release: - runs-on: ubuntu-latest + runs-on: runs-on,runner=2cpu-linux-x64 name: Check release container: - image: elixir:1.16-slim + image: elixir:1.10-slim steps: - uses: actions/checkout@v4 - name: Install Dependencies From 8cf72a07f261720206d98fa44a62dcd7700346f8 Mon Sep 17 00:00:00 2001 From: Krukon Date: Thu, 27 Jun 2024 12:56:22 +0200 Subject: [PATCH 4/9] full retro --- .github/workflows/ci.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 925b5e2a..c2ace783 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ env: OTP_VERSION: 22.3.4.7 # OTP version used during package publishing RELEVANT_FILES: "mix.lock mix.exs lib priv config test" # Important, this controls the caching, make sure to keep this right REPOSITORY: grpc - RUNNER_OS: ubuntu22 # Must match Elixir/OTP version in described in action erlef/setup-beam@v1 + RUNNER_OS: ubuntu18 # Must match Elixir/OTP version in described in action erlef/setup-beam@v1 SHA: ${{ github.sha }} concurrency: @@ -36,7 +36,10 @@ jobs: matrix: otp: [20.3.8.26, 21.3.8.24, 22.3.4.7] elixir: [1.9.4, 1.10.4] - runner-os: [ubuntu20] + runner-os: [ubuntu18] + exclude: + - elixir: 1.10.4 + otp: 20.3.8.26 steps: - name: Checkout latest codebase uses: actions/checkout@v4 @@ -109,7 +112,10 @@ jobs: matrix: otp: [20.3.8.26, 21.3.8.24, 22.3.4.7] elixir: [1.9.4, 1.10.4] - runner-os: [ubuntu20] + runner-os: [ubuntu18] + exclude: + - elixir: 1.10.4 + otp: 20.3.8.26 steps: - name: Checkout latest codebase uses: actions/checkout@v4 From 2cebb88483ccc3ba74a8ca6329c93454a0d64a31 Mon Sep 17 00:00:00 2001 From: Krukon Date: Thu, 27 Jun 2024 14:55:51 +0200 Subject: [PATCH 5/9] back up from full retro --- .github/workflows/ci.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c2ace783..796dc58d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ env: OTP_VERSION: 22.3.4.7 # OTP version used during package publishing RELEVANT_FILES: "mix.lock mix.exs lib priv config test" # Important, this controls the caching, make sure to keep this right REPOSITORY: grpc - RUNNER_OS: ubuntu18 # Must match Elixir/OTP version in described in action erlef/setup-beam@v1 + RUNNER_OS: ubuntu20 # Must match Elixir/OTP version in described in action erlef/setup-beam@v1 SHA: ${{ github.sha }} concurrency: @@ -36,10 +36,7 @@ jobs: matrix: otp: [20.3.8.26, 21.3.8.24, 22.3.4.7] elixir: [1.9.4, 1.10.4] - runner-os: [ubuntu18] - exclude: - - elixir: 1.10.4 - otp: 20.3.8.26 + runner-os: [ubuntu20] steps: - name: Checkout latest codebase uses: actions/checkout@v4 @@ -110,12 +107,9 @@ jobs: strategy: fail-fast: false matrix: - otp: [20.3.8.26, 21.3.8.24, 22.3.4.7] + otp: [21.3.8.24, 22.3.4.7] elixir: [1.9.4, 1.10.4] - runner-os: [ubuntu18] - exclude: - - elixir: 1.10.4 - otp: 20.3.8.26 + runner-os: [ubuntu20] steps: - name: Checkout latest codebase uses: actions/checkout@v4 From 9a32e9cbf9007172176831e4a88890cc23630496 Mon Sep 17 00:00:00 2001 From: Krukon Date: Thu, 27 Jun 2024 14:56:23 +0200 Subject: [PATCH 6/9] back up from full retro 2 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 796dc58d..35580309 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: strategy: fail-fast: false matrix: - otp: [20.3.8.26, 21.3.8.24, 22.3.4.7] + otp: [21.3.8.24, 22.3.4.7] elixir: [1.9.4, 1.10.4] runner-os: [ubuntu20] steps: From 3a33ebab2c05b66dff0aabf5f1cdc1116dfa30e4 Mon Sep 17 00:00:00 2001 From: Krukon Date: Thu, 27 Jun 2024 15:02:45 +0200 Subject: [PATCH 7/9] disable circleCi --- .circleci/config.yml | 31 ------------------------------- .github/workflows/ci.yml | 4 ++-- 2 files changed, 2 insertions(+), 33 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index a478988e..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,31 +0,0 @@ -version: 2.1 - -orbs: - elixir-orb: fresha/elixir-orb@0.0 - -workflows: - version: 2 - ci: - jobs: - - elixir-orb/test: - executor: elixir-orb/elixir - - hold-for-dev-publish: - type: approval - requires: - - elixir-orb/test - filters: - branches: - ignore: - - master - - elixir-orb/dev-publish: - context: Hex - requires: - - hold-for-dev-publish - - elixir-orb/deploy: - context: Hex - requires: - - elixir-orb/test - filters: - branches: - only: - - master diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35580309..8bb65d70 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ on: jobs: static: - name: Static Checks (Elixir ${{ matrix.elixir }}) + name: Static Checks (Elixir ${{ matrix.elixir }} & OTP ${{ matrix.otp }}) runs-on: runs-on,runner=2cpu-linux-x64 outputs: HASH: ${{ steps.hash.outputs.HASH }} @@ -102,7 +102,7 @@ jobs: echo "Running publish --dry-run" mix hex.publish --dry-run test: - name: Unit Tests (Elixir ${{ matrix.elixir }}) + name: Unit Tests (Elixir ${{ matrix.elixir }} & OTP ${{ matrix.otp }}) runs-on: runs-on,runner=2cpu-linux-x64 strategy: fail-fast: false From 2654fab7bdee0b04dffab293cf33f3c942426cf5 Mon Sep 17 00:00:00 2001 From: Krukon Date: Thu, 27 Jun 2024 15:05:47 +0200 Subject: [PATCH 8/9] credo wasn't ran here --- .github/workflows/ci.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8bb65d70..bcf3cb18 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: fail-fast: false matrix: otp: [21.3.8.24, 22.3.4.7] - elixir: [1.9.4, 1.10.4] + elixir: [1.10.4] runner-os: [ubuntu20] steps: - name: Checkout latest codebase @@ -87,10 +87,6 @@ jobs: run: | echo "Compiling the app with --warnings-as-errors" mix compile --warnings-as-errors --force - - name: Run credo - run: | - echo "Running credo" - mix credo --strict - name: Run format run: | echo "Running format" @@ -108,7 +104,7 @@ jobs: fail-fast: false matrix: otp: [21.3.8.24, 22.3.4.7] - elixir: [1.9.4, 1.10.4] + elixir: [1.10.4] runner-os: [ubuntu20] steps: - name: Checkout latest codebase From ffea93bcddc41213e033b0730bd086cfbca62357 Mon Sep 17 00:00:00 2001 From: Krukon Date: Thu, 27 Jun 2024 16:01:13 +0200 Subject: [PATCH 9/9] handle format --- .github/workflows/ci.yml | 2 +- .github/workflows/dev-publish.yaml | 2 +- examples/route_guide/lib/client.ex | 4 +++- lib/grpc/adapter/cowboy/handler.ex | 4 +++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bcf3cb18..05a636d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ env: ELIXIR_VERSION: 1.10.4 # Elixir version used during package publishing JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} OTP_VERSION: 22.3.4.7 # OTP version used during package publishing - RELEVANT_FILES: "mix.lock mix.exs lib priv config test" # Important, this controls the caching, make sure to keep this right + RELEVANT_FILES: "benchmark config examples interop lib priv src test mix.exs mix.lock" # Important, this controls the caching, make sure to keep this right REPOSITORY: grpc RUNNER_OS: ubuntu20 # Must match Elixir/OTP version in described in action erlef/setup-beam@v1 SHA: ${{ github.sha }} diff --git a/.github/workflows/dev-publish.yaml b/.github/workflows/dev-publish.yaml index ce8c8eb3..0e6551b9 100644 --- a/.github/workflows/dev-publish.yaml +++ b/.github/workflows/dev-publish.yaml @@ -6,7 +6,7 @@ env: ELIXIR_VERSION: 1.11.4 # Elixir version used during package publishing JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} OTP_VERSION: 23.3.4.7 # OTP version used during package publishing - RELEVANT_FILES: "mix.lock mix.exs lib priv config test" # Important, this controls the caching, make sure to keep this right + RELEVANT_FILES: "benchmark config examples interop lib priv src test mix.exs mix.lock" # Important, this controls the caching, make sure to keep this right REPOSITORY: grpc RUNNER_OS: ubuntu20 # Must match Elixir/OTP version in described in action erlef/setup-beam@v1 SHA: ${{ github.sha }} diff --git a/examples/route_guide/lib/client.ex b/examples/route_guide/lib/client.ex index 5d33f4ba..150a751b 100644 --- a/examples/route_guide/lib/client.ex +++ b/examples/route_guide/lib/client.ex @@ -89,7 +89,9 @@ defmodule RouteGuide.Client do Enum.each(result_enum, fn {:ok, note} -> IO.puts( - "Got message #{note.message} at point(#{note.location.latitude}, #{note.location.longitude})" + "Got message #{note.message} at point(#{note.location.latitude}, #{ + note.location.longitude + })" ) end) end diff --git a/lib/grpc/adapter/cowboy/handler.ex b/lib/grpc/adapter/cowboy/handler.ex index 8ccb4e3c..b0ee22df 100644 --- a/lib/grpc/adapter/cowboy/handler.ex +++ b/lib/grpc/adapter/cowboy/handler.ex @@ -249,7 +249,9 @@ defmodule GRPC.Adapter.Cowboy.Handler do if compressor && !Enum.member?(accepted_encodings, compressor.name()) do msg = - "A unaccepted encoding #{compressor.name()} is set, valid are: #{:cowboy_req.header("grpc-accept-encoding", req)}" + "A unaccepted encoding #{compressor.name()} is set, valid are: #{ + :cowboy_req.header("grpc-accept-encoding", req) + }" req = send_error(req, state, msg) {:stop, req, state}