Skip to content
Merged
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
229 changes: 12 additions & 217 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2025 James Harton
# SPDX-FileCopyrightText: 2026 James Harton
#
# SPDX-License-Identifier: Apache-2.0

Expand All @@ -12,221 +12,16 @@ on:
branches: [main]

permissions:
contents: read
contents: write
security-events: write
pages: write
id-token: write

jobs:
build-test:
name: MIX_ENV=test mix compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: team-alembic/staple-actions/actions/install-elixir@59199173e18eee6748b65d01626ef82d51c6e963 # main
- name: Set OS deps compile partition count
run: echo "MIX_OS_DEPS_COMPILE_PARTITION_COUNT=$(($(lscpu -p | grep -v '^#' | sort -u -t, -k 2,4 | wc -l) / 2))" >> $GITHUB_ENV
- uses: team-alembic/staple-actions/actions/mix-compile@04f27881d51ef973841fc40c549aefb7b52db7f7 # main
with:
mix-env: test
args: "--warnings-as-errors"

test:
name: mix test
runs-on: ubuntu-latest
needs: build-test
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: team-alembic/staple-actions/actions/mix-test@59199173e18eee6748b65d01626ef82d51c6e963 # main
with:
mix-env: test

credo:
name: mix credo --strict
runs-on: ubuntu-latest
needs: build-test
permissions:
security-events: write
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: team-alembic/staple-actions/actions/mix-credo@59199173e18eee6748b65d01626ef82d51c6e963 # main
with:
mix-env: test
- name: Run Credo SAST
uses: team-alembic/staple-actions/actions/mix-task@59199173e18eee6748b65d01626ef82d51c6e963 # main
with:
task: credo --format sarif > results.sarif
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9
with:
sarif_file: results.sarif
category: credo

formatter:
name: mix format --check-formatted
runs-on: ubuntu-latest
needs: build-test
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: team-alembic/staple-actions/actions/mix-format@59199173e18eee6748b65d01626ef82d51c6e963 # main
with:
mix-env: test

dialyzer:
name: mix dialyzer
runs-on: ubuntu-latest
needs: build-test
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: team-alembic/staple-actions/actions/mix-dialyzer@59199173e18eee6748b65d01626ef82d51c6e963 # main
with:
mix-env: dev

audit:
name: mix deps.audit + hex.audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: team-alembic/staple-actions/actions/mix-hex-audit@59199173e18eee6748b65d01626ef82d51c6e963 # main
- uses: team-alembic/staple-actions/actions/mix-task@59199173e18eee6748b65d01626ef82d51c6e963 # main
with:
task: deps.audit

unused-deps:
name: mix deps.unlock --check-unused
runs-on: ubuntu-latest
needs: build-test
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: team-alembic/staple-actions/actions/mix-task@59199173e18eee6748b65d01626ef82d51c6e963 # main
with:
mix-env: test
task: deps.unlock --check-unused

reuse:
name: REUSE compliance
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: REUSE compliance check
uses: fsfe/reuse-action@v6

build-docs:
name: mix docs
runs-on: ubuntu-latest
needs:
- build-test
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: team-alembic/staple-actions/actions/mix-docs@59199173e18eee6748b65d01626ef82d51c6e963 # main
with:
mix-env: dev
use-cache: false
- uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
with:
path: doc/

deploy-docs:
name: Deploy docs to GitHub Pages
runs-on: ubuntu-latest
needs: build-docs
if: github.ref == 'refs/heads/main'
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5

release:
name: Publish to Hex.pm
runs-on: ubuntu-latest
needs:
- test
- dialyzer
- credo
- formatter
- audit
- unused-deps
- reuse
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Extract release notes from CHANGELOG.md
id: extract-notes
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
VERSION=${TAG_NAME#v}

# Extract the section for this version from CHANGELOG.md
awk -v version="$VERSION" '
/^## \[v?[0-9]/ {
if (found) exit
if (index($0, "[v" version "]") || index($0, "[" version "]")) {
found = 1
next
}
}
found {
if (/^## \[v?[0-9]/) exit
print
}
' CHANGELOG.md > release_notes.md

# Check if notes were found
if [ -s release_notes.md ]; then
echo "has_notes=true" >> $GITHUB_OUTPUT
echo "Release notes extracted for version $VERSION"
else
echo "has_notes=false" >> $GITHUB_OUTPUT
echo "No release notes found for version $VERSION, will use auto-generated notes"
fi
- name: Create prerelease with changelog notes
if: ${{ (contains(github.ref, '-rc') || contains(github.ref, '-beta') || contains(github.ref, '-alpha') || contains(github.ref, '-pre')) && steps.extract-notes.outputs.has_notes == 'true' }}
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release create \
--repo ${{ github.repository }} \
--title ${GITHUB_REF#refs/tags/} \
--prerelease \
--notes-file release_notes.md \
${GITHUB_REF#refs/tags/}
- name: Create prerelease with generated notes
if: ${{ (contains(github.ref, '-rc') || contains(github.ref, '-beta') || contains(github.ref, '-alpha') || contains(github.ref, '-pre')) && steps.extract-notes.outputs.has_notes != 'true' }}
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release create \
--repo ${{ github.repository }} \
--title ${GITHUB_REF#refs/tags/} \
--prerelease \
--generate-notes \
${GITHUB_REF#refs/tags/}
- name: Create release with changelog notes
if: ${{ (!contains(github.ref, '-rc') && !contains(github.ref, '-beta') && !contains(github.ref, '-alpha') && !contains(github.ref, '-pre')) && steps.extract-notes.outputs.has_notes == 'true' }}
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release create \
--repo ${{ github.repository }} \
--title ${GITHUB_REF#refs/tags/} \
--notes-file release_notes.md \
${GITHUB_REF#refs/tags/}
- name: Create release with generated notes
if: ${{ (!contains(github.ref, '-rc') && !contains(github.ref, '-beta') && !contains(github.ref, '-alpha') && !contains(github.ref, '-pre')) && steps.extract-notes.outputs.has_notes != 'true' }}
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release create \
--repo ${{ github.repository }} \
--title ${GITHUB_REF#refs/tags/} \
--generate-notes \
${GITHUB_REF#refs/tags/}
- uses: team-alembic/staple-actions/actions/mix-hex-publish@59199173e18eee6748b65d01626ef82d51c6e963 # main
with:
mix-env: dev
hex-api-key: ${{ secrets.HEX_API_KEY }}
CI:
uses: beam-bots/.github/.github/workflows/elixir-ci.yml@61ed48adfb0acec3baa9a32114d377546ee70478 # main
with:
enable-docs-deploy: true
enable-release: true
secrets:
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}