|
| 1 | +name: Build and test |
| 2 | +on: [push] |
| 3 | + |
| 4 | +jobs: |
| 5 | + build-and-check: |
| 6 | + name: Build and check |
| 7 | + runs-on: ubuntu-latest |
| 8 | + steps: |
| 9 | + - uses: actions/checkout@v4 |
| 10 | + - uses: actions/setup-java@v4 |
| 11 | + with: |
| 12 | + java-version: '17' |
| 13 | + distribution: 'temurin' |
| 14 | + |
| 15 | + - name: Setup Gradle |
| 16 | + uses: gradle/actions/setup-gradle@v4 |
| 17 | + with: |
| 18 | + cache-read-only: false |
| 19 | + |
| 20 | + - name: Generate and submit dependency graph |
| 21 | + uses: gradle/actions/dependency-submission@v4 |
| 22 | + if: ${{ github.ref == 'refs/heads/master' }} |
| 23 | + |
| 24 | + - name: Build, check and test |
| 25 | + run: ./gradlew shadowJar annotation:jar check integrationTest |
| 26 | + |
| 27 | + - name: Upload artifact |
| 28 | + uses: actions/upload-artifact@v4 |
| 29 | + with: |
| 30 | + name: Jars |
| 31 | + path: | |
| 32 | + agent/build/libs/*.jar |
| 33 | + annotation/build/libs/*.jar |
| 34 | +
|
| 35 | + test-suite: |
| 36 | + strategy: |
| 37 | + matrix: |
| 38 | + java: ['17', '11', '8'] |
| 39 | + runs-on: ubuntu-latest |
| 40 | + name: Run test suite with Java ${{ matrix.java }} |
| 41 | + needs: build-and-check |
| 42 | + steps: |
| 43 | + - uses: actions/checkout@v4 |
| 44 | + |
| 45 | + - uses: actions/setup-java@v4 |
| 46 | + name: Set up Java |
| 47 | + with: |
| 48 | + java-version: ${{ matrix.java }} |
| 49 | + distribution: 'temurin' |
| 50 | + |
| 51 | + - name: Suid root tar |
| 52 | + # Required for the bats libraries cache to restore properly |
| 53 | + run: sudo chmod +s /bin/tar |
| 54 | + |
| 55 | + - name: Setup Bats and bats libs |
| 56 | + id: setup-bats |
| 57 | + uses: bats-core/bats-action@3.0.0 |
| 58 | + |
| 59 | + - name: Remove suid root tar |
| 60 | + run: sudo chmod -s /bin/tar |
| 61 | + |
| 62 | + - uses: sbt/setup-sbt@v1 |
| 63 | + |
| 64 | + - name: Download artifact |
| 65 | + uses: actions/download-artifact@v4 |
| 66 | + with: |
| 67 | + name: Jars |
| 68 | + |
| 69 | + - name: Clone test projects |
| 70 | + shell: bash |
| 71 | + env: |
| 72 | + BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }} |
| 73 | + TERM: xterm |
| 74 | + working-directory: ./agent |
| 75 | + run: bin/test_projects |
| 76 | + |
| 77 | + - uses: actions/setup-java@v4 |
| 78 | + name: Set up Gradle cache |
| 79 | + with: |
| 80 | + java-version: ${{ matrix.java }} |
| 81 | + distribution: 'temurin' |
| 82 | + cache: gradle |
| 83 | + |
| 84 | + - uses: actions/setup-java@v4 |
| 85 | + name: Set up Maven cache |
| 86 | + with: |
| 87 | + java-version: ${{ matrix.java }} |
| 88 | + distribution: 'temurin' |
| 89 | + cache: maven |
| 90 | + |
| 91 | + - uses: actions/setup-java@v4 |
| 92 | + name: Set up sbt cache |
| 93 | + with: |
| 94 | + java-version: ${{ matrix.java }} |
| 95 | + distribution: 'temurin' |
| 96 | + cache: sbt |
| 97 | + |
| 98 | + - name: Build test projects |
| 99 | + shell: bash |
| 100 | + env: |
| 101 | + BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }} |
| 102 | + TERM: xterm |
| 103 | + working-directory: ./agent |
| 104 | + run: bin/test_install |
| 105 | + |
| 106 | + - name: Run tests |
| 107 | + shell: bash |
| 108 | + env: |
| 109 | + BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }} |
| 110 | + TERM: xterm |
| 111 | + working-directory: ./agent |
| 112 | + run: bin/test_run |
| 113 | + |
| 114 | + release: |
| 115 | + name: Release |
| 116 | + runs-on: ubuntu-latest |
| 117 | + needs: test-suite |
| 118 | + if: ${{ github.ref == 'refs/heads/master' }} |
| 119 | + steps: |
| 120 | + - uses: actions/checkout@v4 |
| 121 | + - uses: actions/setup-java@v4 |
| 122 | + with: |
| 123 | + java-version: '17' |
| 124 | + distribution: 'temurin' |
| 125 | + - name: Setup Gradle |
| 126 | + uses: gradle/actions/setup-gradle@v4 |
| 127 | + - uses: actions/download-artifact@v4 |
| 128 | + with: |
| 129 | + name: Jars |
| 130 | + - name: Install semantic-release |
| 131 | + run: | |
| 132 | + npm i -g \ |
| 133 | + semantic-release \ |
| 134 | + @semantic-release/exec \ |
| 135 | + @semantic-release/git \ |
| 136 | + @semantic-release/changelog \ |
| 137 | + @google/semantic-release-replace-plugin |
| 138 | + - name: Run semantic-release |
| 139 | + env: |
| 140 | + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
| 141 | + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }} |
| 142 | + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }} |
| 143 | + ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.ORG_GRADLE_PROJECT_OSSRHUSERNAME }} |
| 144 | + ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.ORG_GRADLE_PROJECT_OSSRHPASSWORD }} |
| 145 | + run: semantic-release |
0 commit comments