From 54245ccce8781c0e66ecbd728ea8fd367fd75ef9 Mon Sep 17 00:00:00 2001 From: Pascal Charbonneau Date: Sat, 28 Feb 2026 09:11:37 -0700 Subject: [PATCH] Restore local CI/release workflows for project subdirectory layout --- .github/workflows/ci.yml | 89 +++++++++++++++++++++----- .github/workflows/release.yml | 117 ++++++++++++++++++++++++++-------- 2 files changed, 166 insertions(+), 40 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b48beb2..61909c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,20 +5,79 @@ on: push: branches: - main - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + - "codex/**" jobs: - lint: - name: Lint - uses: agentjido/github-actions/.github/workflows/elixir-lint.yml@main - - test: - name: Test - uses: agentjido/github-actions/.github/workflows/elixir-test.yml@main - with: - otp_versions: '["27", "28"]' - elixir_versions: '["1.18", "1.19"]' - test_command: mix test + test-matrix: + name: Test (Elixir ${{ matrix.elixir }} / OTP ${{ matrix.otp }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - elixir: "1.17.3" + otp: "26.2" + - elixir: "1.18.4" + otp: "27.3" + + defaults: + run: + working-directory: project + + steps: + - uses: actions/checkout@v4 + + - name: Setup Elixir + uses: erlef/setup-beam@v1 + with: + elixir-version: ${{ matrix.elixir }} + otp-version: ${{ matrix.otp }} + + - name: Cache deps and build + uses: actions/cache@v4 + with: + path: | + project/deps + project/_build + key: ${{ runner.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('project/mix.lock') }} + + - name: Install dependencies + run: mix deps.get + + - name: Run CI gate + run: mix ci + + - name: Run tests + run: mix test + + static-analysis: + name: Static Analysis + runs-on: ubuntu-latest + + defaults: + run: + working-directory: project + + steps: + - uses: actions/checkout@v4 + + - name: Setup Elixir + uses: erlef/setup-beam@v1 + with: + elixir-version: "1.18.4" + otp-version: "27.3" + + - name: Install dependencies + run: mix deps.get + + - name: Format check + run: mix format --check-formatted + + - name: Compile with warnings as errors + run: mix compile --warnings-as-errors + + - name: Credo + run: mix credo --strict + + - name: Dialyzer + run: mix dialyzer --format short diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 746b02f..52afb22 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,31 +3,98 @@ name: Release on: workflow_dispatch: inputs: - dry_run: - description: "Dry run (no git push, no tag, no GitHub release, no Hex publish)" - required: false - type: boolean - default: false - hex_dry_run: - description: "Hex dry run only (run all git/release steps, but skip actual Hex publish)" - required: false - type: boolean - default: false - skip_tests: - description: "Skip tests before release" - required: false - type: boolean - default: false - -permissions: - contents: write + version: + description: "Version to release (for example 0.1.1)" + required: true + type: string + push: + tags: + - "v*" jobs: + verify: + runs-on: ubuntu-latest + defaults: + run: + working-directory: project + + steps: + - uses: actions/checkout@v4 + - uses: erlef/setup-beam@v1 + with: + elixir-version: "1.18.4" + otp-version: "27.3" + - run: mix deps.get + - run: mix ci + + create-notes: + runs-on: ubuntu-latest + needs: verify + defaults: + run: + working-directory: project + + steps: + - uses: actions/checkout@v4 + - uses: erlef/setup-beam@v1 + with: + elixir-version: "1.18.4" + otp-version: "27.3" + - run: mix deps.get + - name: Update changelog + run: mix jido.changelog --version "${{ github.ref_name }}" + - name: Generate release notes + run: mix jido.release_notes --version "${{ github.ref_name }}" + - name: Upload release artifacts + uses: actions/upload-artifact@v4 + with: + name: release-notes + path: | + project/CHANGELOG.md + project/RELEASE_NOTES.md + + signed-tag: + if: github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + needs: verify + steps: + - uses: actions/checkout@v4 + - name: Import GPG key + if: ${{ secrets.RELEASE_GPG_PRIVATE_KEY != '' && secrets.RELEASE_GPG_PASSPHRASE != '' }} + uses: crazy-max/ghaction-import-gpg@v6 + with: + gpg_private_key: ${{ secrets.RELEASE_GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.RELEASE_GPG_PASSPHRASE }} + - name: Create signed tag + if: ${{ secrets.RELEASE_GPG_PRIVATE_KEY != '' && secrets.RELEASE_GPG_PASSPHRASE != '' }} + run: | + VERSION="v${{ github.event.inputs.version }}" + git tag -s "$VERSION" -m "Release $VERSION" + git push origin "$VERSION" + release: - name: Release - uses: agentjido/github-actions/.github/workflows/elixir-release.yml@main - with: - dry_run: ${{ inputs.dry_run }} - hex_dry_run: ${{ inputs.hex_dry_run }} - skip_tests: ${{ inputs.skip_tests }} - secrets: inherit + runs-on: ubuntu-latest + needs: create-notes + defaults: + run: + working-directory: project + + steps: + - uses: actions/checkout@v4 + - uses: erlef/setup-beam@v1 + with: + elixir-version: "1.18.4" + otp-version: "27.3" + - run: mix deps.get + - name: Build docs + run: mix docs + - name: Publish package to Hex + if: ${{ secrets.HEX_API_KEY != '' }} + env: + HEX_API_KEY: ${{ secrets.HEX_API_KEY }} + run: mix hex.publish --yes + - name: Publish docs to HexDocs + if: ${{ secrets.HEX_API_KEY != '' }} + env: + HEX_API_KEY: ${{ secrets.HEX_API_KEY }} + run: mix hex.publish docs --yes