Merge pull request #38 from clj-codes/chore/update-jdk-21 #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: [ main ] | |
paths-ignore: | |
- 'README.md' | |
- 'docs/**' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
run_tests: | |
strategy: | |
matrix: | |
namespace: [ unit, integration ] | |
operating-system: [ubuntu-latest] | |
runs-on: ${{ matrix.operating-system }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Prepare java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
- name: Install clojure cli | |
uses: DeLaGuardo/setup-clojure@master | |
with: | |
cli: 1.11.3.1463 | |
- name: Cache Maven packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/deps.edn') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Execute clojure code | |
run: clojure -M:dev:test ${{ matrix.namespace }} | |
build_jar: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Prepare java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
- name: Install clojure cli | |
uses: DeLaGuardo/setup-clojure@master | |
with: | |
cli: 1.11.3.1463 | |
- name: Cache Maven packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/deps.edn') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Generate uberjar | |
run: clojure -T:build uberjar | |
- name: Upload uberjar artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: built-uberjar | |
path: target/service.jar | |
retention-days: 1 | |
deploy: | |
runs-on: ubuntu-latest | |
needs: [run_tests, build_jar] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download uberjar artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: built-uberjar | |
- uses: superfly/flyctl-actions/setup-flyctl@master | |
# --ha=false because by default fly.io spins two machines for high availability | |
- run: flyctl deploy --remote-only --ha=false | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |