From 5c2e859f7d027f602aa15aa1470e2c69f03a3a79 Mon Sep 17 00:00:00 2001 From: Dan Schultzer <1254724+danschultzer@users.noreply.github.com> Date: Sat, 18 Nov 2023 06:00:12 -0800 Subject: [PATCH] Clean up Github Actions --- .github/workflows/build.yml | 50 ----------------------------------- .github/workflows/ci.yml | 35 ++++++++++++++++++++++++ .github/workflows/publish.yml | 25 ++++++++++++++++++ 3 files changed, 60 insertions(+), 50 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 9c3bad1..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: CI - -on: - push: - pull_request: - release: - types: - - published - -jobs: - test: - # This ensures we run the test for only the PR or the push - if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name - strategy: - matrix: - version: - - otp: 26.0 - elixir: 1.15.0 - os: ubuntu-latest - - otp: 22.0 - elixir: 1.12.0 - # It's necessary to run on ubuntu 20.04 for OTP 20 - 23 - # See https://github.com/erlef/setup-beam - os: ubuntu-20.04 - runs-on: ${{ matrix.version.os }} - name: OTP ${{matrix.version.otp}} / Elixir ${{matrix.version.elixir}} - steps: - - uses: actions/checkout@v3 - - uses: erlef/setup-beam@v1 - with: - otp-version: ${{matrix.version.otp}} - elixir-version: ${{matrix.version.elixir}} - - run: mix deps.get - - run: mix test - - run: MIX_ENV=test mix credo - deploy: - needs: test - runs-on: ubuntu-latest - if: github.event_name == 'release' && github.event.action == 'published' - name: Deploy published release - env: - HEX_API_KEY: ${{secrets.HEX_API_KEY}} - steps: - - uses: actions/checkout@v3 - - uses: erlef/setup-beam@v1 - with: - otp-version: 25.0 - elixir-version: 1.14 - - run: mix deps.get - - run: mix hex.publish --yes \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..05872c9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + workflow_call: + +jobs: + test: + strategy: + matrix: + version: + - otp: 26.0 + elixir: 1.15 + os: ubuntu-latest + - otp: 22.0 + elixir: 1.12 + # It's necessary to run on ubuntu 20.04 for OTP 20 - 23 + # See https://github.com/erlef/setup-beam + os: ubuntu-20.04 + runs-on: ${{ matrix.version.os }} + name: OTP ${{matrix.version.otp}} / Elixir ${{matrix.version.elixir}} + env: + MIX_ENV: test + steps: + - uses: actions/checkout@v3 + - uses: erlef/setup-beam@v1 + with: + otp-version: ${{matrix.version.otp}} + elixir-version: ${{matrix.version.elixir}} + - run: mix deps.get + - run: mix compile --warnings-as-errors + - run: mix test + - run: mix credo diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..f54cc52 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,25 @@ +name: Publish + +on: + release: + types: + - published + +jobs: + test: + uses: ./.github/workflows/ci.yml + + publish: + needs: test + runs-on: ubuntu-latest + name: Publish release + env: + HEX_API_KEY: ${{secrets.HEX_API_KEY}} + steps: + - uses: actions/checkout@v3 + - uses: erlef/setup-beam@v1 + with: + otp-version: 26.0 + elixir-version: 1.15 + - run: mix deps.get + - run: mix hex.publish --yes