Merge pull request #583 from DataDog/jszwedko/bump-0.51.1-snapshot #181
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| pull_request: | |
| permissions: read-all | |
| jobs: | |
| lint: | |
| name: Lint (OpenJDK 8) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 | |
| - name: Set up JDK 8 | |
| uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 | |
| with: | |
| java-version: '8' | |
| distribution: 'temurin' | |
| - name: Cache Maven packages | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: ~/.m2 | |
| key: ${{ runner.os }}-m2-${{ github.ref }}-${{ hashFiles('**/pom.xml') }}-lint | |
| restore-keys: | | |
| ${{ runner.os }}-m2-${{ github.ref }}- | |
| ${{ runner.os }}-m2- | |
| - name: Run lint | |
| run: ./mvnw verify -B -Dhttps.protocols=TLSv1.2 -DskipTests | |
| jdk7-verification: | |
| name: JDK 7 verification | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 | |
| - name: Set up JDK 8 | |
| uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 | |
| with: | |
| java-version: '8' | |
| distribution: 'temurin' | |
| - name: Cache Maven packages | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: ~/.m2 | |
| key: ${{ runner.os }}-m2-${{ github.ref }}-${{ hashFiles('**/pom.xml') }}-jdk7 | |
| restore-keys: | | |
| ${{ runner.os }}-m2-${{ github.ref }}- | |
| ${{ runner.os }}-m2- | |
| - name: Build JMXFetch | |
| run: ./mvnw clean package -DskipTests | |
| - name: Run using JDK 7 | |
| run: docker run -i --rm -v $(pwd):/app -w /app openjdk:7-jdk java -jar ./target/jmxfetch-0.51.1-SNAPSHOT-jar-with-dependencies.jar --help | |
| test: | |
| name: Test (OpenJDK ${{ matrix.java-version }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| strategy: | |
| matrix: | |
| java-version: | |
| - 8 | |
| - 11 | |
| - 17 | |
| - 21 | |
| - 24 # Latest JDK version | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 | |
| - name: Set up JDK ${{ matrix.java-version }} | |
| uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 | |
| with: | |
| java-version: ${{ matrix.java-version }} | |
| distribution: 'temurin' | |
| - name: Cache Maven packages | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: ~/.m2 | |
| key: ${{ runner.os }}-m2-${{ github.ref }}-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-m2-${{ github.ref }}- | |
| ${{ runner.os }}-m2- | |
| - name: Set up Docker | |
| uses: docker/setup-docker-action@b60f85385d03ac8acfca6d9996982511d8620a19 # v4.3.0 | |
| - name: Run tests | |
| run: ./mvnw test -B -Dhttps.protocols=TLSv1.2 -Dcheckstyle.skip=true -Dtests.log_level=info -Djdk.attach.allowAttachSelf=true | |
| - name: Show test logs on failure | |
| if: failure() | |
| run: | | |
| echo "Test failed. Showing surefire reports:" | |
| for log in target/surefire-reports/*.txt; do | |
| if [ -f "$log" ]; then | |
| echo "$log ========================" | |
| cat "$log" | |
| fi | |
| done |