|
| 1 | +--- |
| 2 | +name: Run tests |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: [master, "1.1.x"] |
| 7 | + pull_request: |
| 8 | + branches: [master, "1.1.x"] |
| 9 | + |
| 10 | +env: |
| 11 | + ACTIONS_CACHE_VERSION: 0 |
| 12 | + |
| 13 | +jobs: |
| 14 | + test: |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + jdk: [8, 11, 17, 21] |
| 18 | + |
| 19 | + name: Java ${{ matrix.jdk }} |
| 20 | + |
| 21 | + runs-on: ubuntu-latest |
| 22 | + |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v3 |
| 25 | + - name: Setup Java ${{ matrix.jdk }} |
| 26 | + |
| 27 | + with: |
| 28 | + distribution: temurin |
| 29 | + java-version: ${{ matrix.jdk }} |
| 30 | + - name: Maven Cache |
| 31 | + id: maven-cache |
| 32 | + uses: actions/cache@v3 |
| 33 | + with: |
| 34 | + path: | |
| 35 | + ~/.m2/repository |
| 36 | + ~/.gitlibs |
| 37 | + key: m2-cache-${{ env.ACTIONS_CACHE_VERSION }}-${{ hashFiles('project.clj') }}-${{ matrix.jdk }} |
| 38 | + restore-keys: | |
| 39 | + m2-cache-${{ env.ACTIONS_CACHE_VERSION }}-${{ hashFiles('project.clj') }}- |
| 40 | + m2-cache-${{ env.ACTIONS_CACHE_VERSION }}- |
| 41 | + - name: Setup Clojure |
| 42 | + uses: DeLaGuardo/setup-clojure@master |
| 43 | + with: |
| 44 | + lein: latest |
| 45 | + - name: Run tests |
| 46 | + run: lein do clean, all midje, all check |
| 47 | + deploy: |
| 48 | + concurrency: deploy |
| 49 | + needs: test |
| 50 | + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} |
| 51 | + runs-on: ubuntu-latest |
| 52 | + steps: |
| 53 | + - name: Checkout |
| 54 | + uses: actions/checkout@v2 |
| 55 | + - name: Maven Cache |
| 56 | + id: maven-cache |
| 57 | + uses: actions/cache@v3 |
| 58 | + with: |
| 59 | + path: | |
| 60 | + ~/.m2/repository |
| 61 | + ~/.gitlibs |
| 62 | + key: m2-cache-${{ env.ACTIONS_CACHE_VERSION }}-${{ hashFiles('project.clj') }}-${{ matrix.jdk }} |
| 63 | + restore-keys: | |
| 64 | + m2-cache-${{ env.ACTIONS_CACHE_VERSION }}-${{ hashFiles('project.clj') }}- |
| 65 | + m2-cache-${{ env.ACTIONS_CACHE_VERSION }}- |
| 66 | + - name: Prepare java |
| 67 | + uses: actions/setup-java@v2 |
| 68 | + with: |
| 69 | + distribution: 'adopt' |
| 70 | + java-version: '11' |
| 71 | + - name: deploy |
| 72 | + env: |
| 73 | + CLOJARS_USER: ${{ secrets.CLOJARS_USER }} |
| 74 | + CLOJARS_TOKEN: ${{ secrets.CLOJARS_TOKEN }} |
| 75 | + COMMIT_MSG: ${{ github.event.head_commit.message }} |
| 76 | + run: | |
| 77 | + if [[ "$COMMIT_MSG" == "Release :major" ]]; then |
| 78 | + lein release :major |
| 79 | + elif [[ "$COMMIT_MSG" == "Release :minor" ]]; then |
| 80 | + lein release :minor |
| 81 | + elif [[ "$COMMIT_MSG" == "Release :patch" ]]; then |
| 82 | + lein release :patch |
| 83 | + elif [[ "$COMMIT_MSG" == "Release :alpha" ]]; then |
| 84 | + lein release :alpha |
| 85 | + elif [[ "$COMMIT_MSG" == "Release :beta" ]]; then |
| 86 | + lein release :beta |
| 87 | + elif [[ "$COMMIT_MSG" == "Release :rc" ]]; then |
| 88 | + lein release :rc |
| 89 | + else |
| 90 | + lein deploy snapshot |
| 91 | + fi |
0 commit comments