|
| 1 | +name: "clj" |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [main] |
| 6 | + paths: |
| 7 | + - "**.clj" |
| 8 | + - "**.edn" |
| 9 | + - "**.xml" |
| 10 | + - "**/deps.edn" |
| 11 | + - "build.clj" |
| 12 | + - "workspace.edn" |
| 13 | + - "bb.edn" |
| 14 | + |
| 15 | +run-name: ${{ inputs.name }} |
| 16 | + |
| 17 | +env: |
| 18 | + REGISTRY: ghcr.io |
| 19 | + IMAGE_NAME: ${{ github.repository }} |
| 20 | + |
| 21 | +permissions: |
| 22 | + contents: read |
| 23 | + packages: write |
| 24 | + |
| 25 | +jobs: |
| 26 | + uberjar: |
| 27 | + strategy: |
| 28 | + matrix: |
| 29 | + version: ["java-11", "java-17", "java-21"] |
| 30 | + project: ["agent", "server"] |
| 31 | + runs-on: ubuntu-latest |
| 32 | + steps: |
| 33 | + - name: Checkout |
| 34 | + uses: actions/checkout@v3 |
| 35 | + |
| 36 | + - name: Add tools |
| 37 | + run: | |
| 38 | + sudo apt update |
| 39 | + sudo apt install -y curl git |
| 40 | +
|
| 41 | + - name: Set Java Version |
| 42 | + run: echo "VENN_JAVA_VERSION=$(echo ${{ matrix.version}} | cut -d'-' -f2)" >> $GITHUB_ENV |
| 43 | + |
| 44 | + - name: Set Project |
| 45 | + run: echo "VENN_PROJECT=$(echo ${{ matrix.project}} | cut -d'-' -f2)" >> $GITHUB_ENV |
| 46 | + |
| 47 | + - name: Prepare java |
| 48 | + uses: actions/setup-java@v3 |
| 49 | + with: |
| 50 | + distribution: "zulu" |
| 51 | + java-version: ${{ env.VENN_JAVA_VERSION }} |
| 52 | + |
| 53 | + - name: Install clojure tools |
| 54 | + uses: DeLaGuardo/setup-clojure@9.5 |
| 55 | + with: |
| 56 | + cli: "latest" |
| 57 | + |
| 58 | + - name: Cache clojure dependencies |
| 59 | + uses: actions/cache@v3 |
| 60 | + with: |
| 61 | + path: | |
| 62 | + ~/.m2/repository |
| 63 | + ~/.gitlibs |
| 64 | + ~/.deps.clj |
| 65 | + key: cljdeps-build-uberjar-${{ matrix.project }}-${{ matrix.version }}-${{ hashFiles('deps.edn', 'bb.edn') }} |
| 66 | + restore-keys: cljdeps-build-uberjar-${{ matrix.project }}-${{ matrix.version }}- |
| 67 | + |
| 68 | + - name: Install babashka |
| 69 | + uses: turtlequeue/setup-babashka@v1.5.2 |
| 70 | + with: |
| 71 | + babashka-version: 1.3.182 |
| 72 | + |
| 73 | + - name: Build project |
| 74 | + run: | |
| 75 | + clojure -T:build uberjar :project ${VENN_PROJECT} |
| 76 | +
|
| 77 | + test: |
| 78 | + needs: uberjar |
| 79 | + strategy: |
| 80 | + matrix: |
| 81 | + version: ["java-11", "java-17", "java-21"] |
| 82 | + project: ["agent", "server"] |
| 83 | + runs-on: ubuntu-latest |
| 84 | + steps: |
| 85 | + - name: Checkout |
| 86 | + uses: actions/checkout@v3 |
| 87 | + |
| 88 | + - name: Add tools |
| 89 | + run: | |
| 90 | + sudo apt update |
| 91 | + sudo apt install -y curl git |
| 92 | +
|
| 93 | + - name: Set Java Version |
| 94 | + run: echo "VENN_JAVA_VERSION=$(echo ${{ matrix.version}} | cut -d'-' -f2)" >> $GITHUB_ENV |
| 95 | + |
| 96 | + - name: Set Project |
| 97 | + run: echo "VENN_PROJECT=$(echo ${{ matrix.project}} | cut -d'-' -f2)" >> $GITHUB_ENV |
| 98 | + |
| 99 | + - name: Prepare java |
| 100 | + uses: actions/setup-java@v3 |
| 101 | + with: |
| 102 | + distribution: "zulu" |
| 103 | + java-version: ${{ env.VENN_JAVA_VERSION }} |
| 104 | + |
| 105 | + - name: Install clojure tools |
| 106 | + uses: DeLaGuardo/setup-clojure@9.5 |
| 107 | + with: |
| 108 | + cli: "latest" |
| 109 | + |
| 110 | + - name: Cache clojure dependencies |
| 111 | + uses: actions/cache@v3 |
| 112 | + with: |
| 113 | + path: | |
| 114 | + ~/.m2/repository |
| 115 | + ~/.gitlibs |
| 116 | + ~/.deps.clj |
| 117 | + key: cljdeps-build-uberjar-${{ matrix.project }}-${{ matrix.version }}-${{ hashFiles('deps.edn', 'bb.edn') }} |
| 118 | + restore-keys: cljdeps-build-uberjar-${{ matrix.project }}-${{ matrix.version }}- |
| 119 | + |
| 120 | + - name: Install babashka |
| 121 | + uses: turtlequeue/setup-babashka@v1.5.2 |
| 122 | + with: |
| 123 | + babashka-version: 1.3.182 |
| 124 | + |
| 125 | + - name: Run Tests |
| 126 | + run: | |
| 127 | + clojure -M:poly test project:${{ matrix.project }} |
| 128 | +
|
| 129 | + clj-kondo: |
| 130 | + needs: uberjar |
| 131 | + runs-on: ubuntu-latest |
| 132 | + permissions: |
| 133 | + pull-requests: write |
| 134 | + contents: read |
| 135 | + steps: |
| 136 | + - uses: actions/checkout@v3 |
| 137 | + - name: clj-kondo |
| 138 | + uses: nnichols/clojure-lint-action@v2 |
| 139 | + with: |
| 140 | + github_token: ${{ secrets.github_token }} |
| 141 | + reporter: github-pr-review |
0 commit comments