From 719fc825e22bb09130d7ac79968f2cfd683148bd Mon Sep 17 00:00:00 2001 From: Ilyich Vismara Date: Mon, 4 May 2026 21:35:45 +0200 Subject: [PATCH 1/2] ci: matrix checks --- .github/workflows/ci.yml | 154 ++++++++++++++++++++++++++++++ .github/workflows/coverage.yml | 60 ------------ .github/workflows/publish_hex.yml | 63 ------------ 3 files changed, 154 insertions(+), 123 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/coverage.yml delete mode 100644 .github/workflows/publish_hex.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7b5aac3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,154 @@ +name: CI +on: + push: + tags: + - "v*" + branches: [main] + pull_request: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + +jobs: + test: + name: Build and Test (OTP ${{ matrix.otp }} | Elixir ${{ matrix.elixir }}) + runs-on: ubuntu-latest + env: + MIX_ENV: test + strategy: + fail-fast: false + matrix: + include: + - elixir: "1.16.3" + otp: "26.2.5" + - elixir: "1.18.4" + otp: "26.2.5" + coverage: true + services: + postgres: + image: postgres + env: + POSTGRES_PASSWORD: postgres + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 + steps: + - uses: actions/checkout@v4 + - name: Set up Elixir + uses: erlef/setup-beam@v1 + with: + elixir-version: ${{ matrix.elixir }} + otp-version: ${{ matrix.otp }} + - name: Restore deps and _build cache + uses: actions/cache@v4 + with: + path: | + deps + _build + key: deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }} + restore-keys: | + deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }} + - name: Install dependencies + run: mix deps.get + - name: Compile dependencies + run: mix deps.compile + - name: Build package + run: mix hex.build + - name: Run tests + run: mix coveralls.json + # todo: remove after tests are added + continue-on-error: true + env: + MIX_ENV: test + DB_HOSTNAME: postgres + DB_NAME: test + DB_USER: postgres + DB_PASSWORD: postgres + - name: Upload to Codecov + if: ${{ matrix.coverage }} + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./cover/excoveralls.json + directory: cover + fail_ci_if_error: true + verbose: true + + hex_publish: + name: Hex Publish + runs-on: ubuntu-latest + needs: test + if: always() && !failure() && !cancelled() && startsWith(github.ref, 'refs/tags/v') + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Elixir + uses: erlef/setup-beam@v1 + with: + elixir-version: "1.18.4" + otp-version: "26.2.5" + - name: Restore dependencies cache + uses: actions/cache@v4 + with: + path: deps + key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} + restore-keys: ${{ runner.os }}-mix- + - name: Install dependencies + run: mix deps.get + - name: Compile dependencies + run: mix deps.compile + - name: Build package + run: mix hex.build + - name: Release & Publish + run: mix hex.publish --yes + env: + HEX_API_KEY: ${{ secrets.HEX_API_KEY }} + + github_release: + name: GitHub Release + runs-on: ubuntu-latest + needs: hex_publish + if: always() && !failure() && !cancelled() && startsWith(github.ref, 'refs/tags/v') + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Generate release notes + id: release_notes + uses: orhun/git-cliff-action@v4 + with: + config: cliff.toml + args: --verbose --latest --strip header + env: + GITHUB_REPO: ${{ github.repository }} + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + body: ${{ steps.release_notes.outputs.content }} + - name: Generate changelog + uses: orhun/git-cliff-action@v4 + with: + config: cliff.toml + args: --verbose + env: + OUTPUT: CHANGELOG.md + GITHUB_REPO: ${{ github.repository }} + - name: Commit + run: | + git checkout main + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' + git add CHANGELOG.md + git diff --staged --quiet || git commit -m "Update changelog" + git push origin main diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml deleted file mode 100644 index 74ac393..0000000 --- a/.github/workflows/coverage.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Test 🧪 -on: - workflow_dispatch: - # Triggers the workflow on pull request events but only for the main branch - pull_request: - branches: # matches refs/heads/main`` - - 'main' -env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - -jobs: - test: - runs-on: ubuntu-latest - container: node:10.18-jessie - name: Create Coverage Report - services: - postgres: - image: postgres - ports: - - 5432:5432 - env: - POSTGRES_PASSWORD: postgres - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - strategy: - matrix: - otp: [24.0] - elixir: [1.13.2] - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-elixir@v1 - with: - otp-version: ${{matrix.otp}} - elixir-version: ${{matrix.elixir}} - - name: Get dependencies - run: mix deps.get - - - name: Generating XML - run: mix coveralls.json - # todo: remove after tests are added - continue-on-error: true - env: - MIX_ENV: test - DB_HOSTNAME: postgres - DB_NAME: test - DB_USER: postgres - DB_PASSWORD: postgres - - name: Upload to Codecov - uses: codecov/codecov-action@v2 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: ./cover/excoveralls.json - directory: cover - fail_ci_if_error: true - verbose: true - diff --git a/.github/workflows/publish_hex.yml b/.github/workflows/publish_hex.yml deleted file mode 100644 index 5b04755..0000000 --- a/.github/workflows/publish_hex.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: Publish package to Hex 📦 -on: - push: - tags: - - "v[0-9]+.[0-9]+.[0-9]+" - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Set up Elixir - uses: erlef/setup-beam@v1 - with: - elixir-version: "1.16.3" - otp-version: "26.0" - - name: Restore dependencies cache - uses: actions/cache@v4 - with: - path: deps - key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} - restore-keys: ${{ runner.os }}-mix- - - name: Install dependencies - run: mix deps.get - - name: Compile dependencies - run: mix deps.compile - - name: Build package - run: mix hex.build - - name: Release & Publish - run: mix hex.publish --yes - env: - HEX_API_KEY: ${{ secrets.HEX_API_KEY }} - - name: Generate release notes - id: release_notes - uses: orhun/git-cliff-action@v4 - with: - config: cliff.toml - args: --verbose --latest --strip header - env: - GITHUB_REPO: ${{ github.repository }} - - name: Create GitHub Release - uses: softprops/action-gh-release@v2 - with: - body: ${{ steps.release_notes.outputs.content }} - - name: Generate a changelog - uses: orhun/git-cliff-action@v4 - with: - config: cliff.toml - args: --verbose - env: - OUTPUT: CHANGELOG.md - GITHUB_REPO: ${{ github.repository }} - - name: Commit - run: | - git checkout main - git config user.name 'github-actions[bot]' - git config user.email 'github-actions[bot]@users.noreply.github.com' - git add CHANGELOG.md - git diff --staged --quiet || git commit -m "Update changelog" - git push origin main From 60343c85ce8c91d200308fbaa8058df7ffd3cb6b Mon Sep 17 00:00:00 2001 From: Ilyich Vismara Date: Mon, 4 May 2026 21:43:58 +0200 Subject: [PATCH 2/2] ci: remove codecov --- .github/workflows/ci.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b5aac3..647ff79 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,15 +70,6 @@ jobs: DB_NAME: test DB_USER: postgres DB_PASSWORD: postgres - - name: Upload to Codecov - if: ${{ matrix.coverage }} - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: ./cover/excoveralls.json - directory: cover - fail_ci_if_error: true - verbose: true hex_publish: name: Hex Publish