diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 921c22c..44db3f8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,31 +8,16 @@ on: workflow_dispatch: {} # manual run for testing; publishing remains tag-only permissions: - contents: write # create the GitHub Release + contents: read jobs: - release: + guards: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: '21' - - - uses: DeLaGuardo/setup-clojure@13.6.1 - with: - lein: 2.12.0 - - - uses: actions/cache@v4 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-m2-${{ hashFiles('project.clj') }} - restore-keys: ${{ runner.os }}-m2- - - name: Verify tag matches project.clj version if: github.ref_type == 'tag' run: | @@ -79,9 +64,6 @@ jobs: exit 1 fi - - name: Test - run: lein test - - name: Extract release notes from CHANGELOG if: github.ref_type == 'tag' run: | @@ -98,6 +80,47 @@ jobs: fi cat release-notes.md + - name: Upload release notes + if: github.ref_type == 'tag' + uses: actions/upload-artifact@v4 + with: + name: release-notes + path: release-notes.md + + verify: + needs: guards + uses: ./.github/workflows/test-matrix.yml + + release: + needs: [guards, verify] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '21' + + - uses: DeLaGuardo/setup-clojure@13.6.1 + with: + lein: 2.12.0 + + - uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-m2-${{ hashFiles('project.clj') }} + restore-keys: ${{ runner.os }}-m2- + + - uses: actions/download-artifact@v4 + if: github.ref_type == 'tag' + with: + name: release-notes + - name: Deploy to Clojars if: github.ref_type == 'tag' env: diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-matrix.yml new file mode 100644 index 0000000..d40c11f --- /dev/null +++ b/.github/workflows/test-matrix.yml @@ -0,0 +1,53 @@ +name: test matrix + +on: + workflow_call: + +permissions: + contents: read + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up clj-kondo + uses: DeLaGuardo/setup-clojure@13.6.1 + with: + clj-kondo: '2026.05.25' + + - name: Run clj-kondo + run: clj-kondo --lint src test + + test: + name: JDK ${{ matrix.jdk }} / Leiningen ${{ matrix.lein }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + jdk: ['8', '17', '21'] + lein: ['2.9.10', '2.11.2', '2.12.0'] + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK ${{ matrix.jdk }} + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: ${{ matrix.jdk }} + + - name: Set up Leiningen ${{ matrix.lein }} + uses: DeLaGuardo/setup-clojure@13.6.1 + with: + lein: ${{ matrix.lein }} + + - name: Cache Maven dependencies + uses: actions/cache@v4 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-lein${{ matrix.lein }}-${{ hashFiles('project.clj') }} + restore-keys: ${{ runner.os }}-m2-lein${{ matrix.lein }}- + + - name: Run tests + run: lein test diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 541f40a..58efc15 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,47 +6,5 @@ on: pull_request: jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Set up clj-kondo - uses: DeLaGuardo/setup-clojure@13.6.1 - with: - clj-kondo: '2026.05.25' - - - name: Run clj-kondo - run: clj-kondo --lint src test - test: - name: JDK ${{ matrix.jdk }} / Leiningen ${{ matrix.lein }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - jdk: ['8', '17', '21'] - lein: ['2.9.10', '2.11.2', '2.12.0'] - steps: - - uses: actions/checkout@v4 - - - name: Set up JDK ${{ matrix.jdk }} - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: ${{ matrix.jdk }} - - - name: Set up Leiningen ${{ matrix.lein }} - uses: DeLaGuardo/setup-clojure@13.6.1 - with: - lein: ${{ matrix.lein }} - - - name: Cache Maven dependencies - uses: actions/cache@v4 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-lein${{ matrix.lein }}-${{ hashFiles('project.clj') }} - restore-keys: ${{ runner.os }}-m2-lein${{ matrix.lein }}- - - - name: Run tests - run: lein test + uses: ./.github/workflows/test-matrix.yml