Skip to content

setup GHA based CI

setup GHA based CI #2

Workflow file for this run

name: Elixir CI Checks
env:
SHA: ${{ github.sha }}
JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
DEBIAN_FRONTEND: noninteractive
REPOSITORY: grpc
ELIXIR_VERSION: 1.10.x # Elixir version used during package publishing
OTP_VERSION: 22.x # OTP version used during package publishing
RUNNER_OS: ubuntu22 # Must match Elixir/OTP version in described in action erlef/setup-beam@v1
RELEVANT_FILES: "mix.lock mix.exs lib config test" # Important, this controls the caching, make sure to keep this right
DEPENDENCY_FILE: mix.lock
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
pull_request:
types:
- synchronize
- opened
- reopened
jobs:
static:
name: Static Checks (Elixir ${{ matrix.elixir }})
runs-on: runs-on,runner=4cpu-linux-x64
outputs:
HASH: ${{ steps.prepare.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:
- name: Checkout and compile dependencies
id: prepare
uses: surgeventures/platform-tribe-actions/elixir/precompile@fast-elixir-repo-setup
with:
repository: ${{ env.REPOSITORY }}
dependency-file: ${{ env.DEPENDENCY_FILE }}
sha: ${{ env.SHA }}
token: ${{ secrets.GITHUB_TOKEN }}
hex-token: ${{ secrets.HEX_ORGANIZATION_WRITE_KEY }}
mix-env: dev
relevant-files: ${{ env.RELEVANT_FILES }}
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
runner-os: ${{ matrix.runner-os }}
- name: Compile the application
id: compile
uses: surgeventures/platform-tribe-actions/elixir/compile@fast-elixir-repo-setup
with:
build-hash: ${{ steps.prepare.outputs.HASH }}
warnings-as-errors: 'true'
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Run Static Checks
uses: surgeventures/platform-tribe-actions/elixir/static-check@fast-elixir-repo-setup
id: static
with:
dialyzer: true
hex-token: ${{ secrets.HEX_ORGANIZATION_WRITE_KEY }}
test:
name: Unit Tests (Elixir ${{ matrix.elixir }})
runs-on: runs-on,runner=1cpu-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
steps:
- name: Checkout and compile dependencies
id: prepare
uses: surgeventures/platform-tribe-actions/elixir/precompile@fast-elixir-repo-setup
with:
repository: ${{ env.REPOSITORY }}
dependency-file: ${{ env.DEPENDENCY_FILE }}
sha: ${{ env.SHA }}
token: ${{ secrets.GITHUB_TOKEN }}
hex-token: ${{ secrets.HEX_ORGANIZATION_WRITE_KEY }}
mix-env: test
relevant-files: ${{ env.RELEVANT_FILES }}
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
runner-os: ${{ matrix.runner-os }}
- name: Compile the application
id: compile
uses: surgeventures/platform-tribe-actions/elixir/compile@fast-elixir-repo-setup
with:
build-hash: ${{ steps.prepare.outputs.HASH }}
mix-env: test
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Run Unit Tests
uses: surgeventures/platform-tribe-actions/elixir/test@fast-elixir-repo-setup
id: test
interop_tests:
runs-on: ubuntu-latest
name: Interop tests
container:
image: elixir:1.9-slim
steps:
- uses: actions/checkout@v4
- name: Install Dependencies
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
working-directory: ./interop
- name: Run interop tests
run: mix run script/run.exs
working-directory: ./interop
check_release:
runs-on: ubuntu-latest
name: Check release
container:
image: elixir:1.9-slim
steps:
- uses: actions/checkout@v4
- name: Install Dependencies
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
- name: Build hex
run: mix hex.build
- name: Generate docs
run: mix docs
permit:
name: Permit Package Publishing
needs: [static, test, interop_tests, check_release]
runs-on: runs-on,runner=1cpu-linux-x64
outputs:
PUBLISH: ${{ steps.permit.outputs.PUBLISH }}
steps:
- name: Verify elibility for publishing the package
uses: surgeventures/platform-tribe-actions/elixir/permit@fast-elixir-repo-setup
id: permit
with:
repository: ${{ env.REPOSITORY }}
sha: ${{ env.SHA }}
relevant-files: ${{ env.RELEVANT_FILES}}
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: Publish Package
uses: surgeventures/platform-tribe-actions/elixir/publish@fast-elixir-repo-setup
with:
repository: ${{ env.REPOSITORY }}
sha: ${{ env.SHA }}
token: ${{ secrets.GITHUB_TOKEN }}
hex-token: ${{ secrets.HEX_ORGANIZATION_WRITE_KEY }}
elixir-version: ${{ env.ELIXIR_VERSION }}
otp-version: ${{ env.OTP_VERSION }}
runner-os: ${{ env.RUNNER_OS }}