Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup GHA based CI #13

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 131 additions & 40 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,122 @@
name: CI
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:
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
steps:
- uses: actions/checkout@v1
- name: Install Dependencies
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
- name: Check format
run: mix format --check-formatted

tests:
runs-on: ubuntu-latest
name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
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
needs: check_format
steps:
- uses: actions/checkout@v1
- uses: actions/[email protected]
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 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 }}

interop-tests:
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
needs: check_format
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Install Dependencies
run: |
mix local.rebar --force
Expand All @@ -70,11 +130,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
Expand All @@ -84,3 +143,35 @@ jobs:
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 }}
39 changes: 39 additions & 0 deletions .github/workflows/dev-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Elixir Dev Publish

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:
workflow_dispatch:
inputs: {}

jobs:
dev-publish:
name: Dev Publish
runs-on: runs-on,runner=4cpu-linux-x64
steps:
- name: Publish Hex package
uses: surgeventures/platform-tribe-actions/elixir/dev-publish@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
elixir-version: ${{ env.ELIXIR_VERSION }}
otp-version: ${{ env.OTP_VERSION }}
runner-os: ${{ env.RUNNER_OS }}
relevant-files: ${{ env.RELEVANT_FILES}}
Loading