|
| 1 | +# This is a github actions workflow which runs htsjdk tests and spotbugs. |
| 2 | + |
| 3 | +name: Build and Test |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: [master] |
| 7 | + pull_request: |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + test: |
| 12 | + env: |
| 13 | + HTSJDK_SAMTOOLS_BIN: /usr/bin/samtools |
| 14 | + runs-on: ubuntu-latest |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + java: [ 8, 11 ] |
| 18 | + experimental: [false] |
| 19 | +# include: |
| 20 | +# - java: 17 |
| 21 | +# experimental: true |
| 22 | + fail-fast: false |
| 23 | + continue-on-error: ${{ matrix.experimental }} |
| 24 | + name: Java ${{ matrix.Java }} build and test |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v2 |
| 27 | + - name: Set up java ${{ matrix.Java }} |
| 28 | + uses: actions/setup-java@v2 |
| 29 | + with: |
| 30 | + java-version: ${{ matrix.Java }} |
| 31 | + distribution: 'adopt' |
| 32 | + cache: gradle |
| 33 | + - name: Grant execute permission for gradlew |
| 34 | + run: chmod +x gradlew |
| 35 | + - name: Compile with Gradle |
| 36 | + run: ./gradlew compileJava |
| 37 | + - name: Install Samtools |
| 38 | + run: scripts/install-samtools.sh |
| 39 | + - name: Start the htsget server |
| 40 | + run: scripts/htsget-scripts/start-htsget-test-server.sh |
| 41 | + - name: Run tests |
| 42 | + run: ./gradlew test jacocoTestReport |
| 43 | + - name: Upload to codecov |
| 44 | + run: bash <(curl -s https://raw.githubusercontent.com/broadinstitute/codecov-bash-uploader/main/codecov-verified.bash) |
| 45 | + - name: Upload test results |
| 46 | + if: always() |
| 47 | + uses: actions/upload-artifact@v2 |
| 48 | + with: |
| 49 | + name: test-results-${{ matrix.Java }} |
| 50 | + path: build/reports/tests |
| 51 | + testExternalApis: |
| 52 | + continue-on-error: true |
| 53 | + runs-on: ubuntu-latest |
| 54 | + name: Tests that require external APIs |
| 55 | + steps: |
| 56 | + - uses: actions/checkout@v2 |
| 57 | + - name: Set up java 8 |
| 58 | + uses: actions/setup-java@v2 |
| 59 | + with: |
| 60 | + java-version: '8' |
| 61 | + distribution: 'adopt' |
| 62 | + cache: gradle |
| 63 | + - name: Grant execute permission for gradlew |
| 64 | + run: chmod +x gradlew |
| 65 | + - name: Compile with Gradle |
| 66 | + run: ./gradlew compileJava |
| 67 | + - name: Run tests |
| 68 | + run: ./gradlew testFTP jacocoTestReport |
| 69 | + - name: Upload to codecov |
| 70 | + run: bash <(curl -s https://raw.githubusercontent.com/broadinstitute/codecov-bash-uploader/main/codecov-verified.bash) |
| 71 | + - name: Upload test results |
| 72 | + if: always() |
| 73 | + uses: actions/upload-artifact@v2 |
| 74 | + with: |
| 75 | + name: test-results-external-apis |
| 76 | + path: build/reports/tests |
| 77 | + testFTP: |
| 78 | + continue-on-error: true |
| 79 | + runs-on: ubuntu-latest |
| 80 | + name: FTP tests |
| 81 | + steps: |
| 82 | + - uses: actions/checkout@v2 |
| 83 | + - name: Set up java 8 |
| 84 | + uses: actions/setup-java@v2 |
| 85 | + with: |
| 86 | + java-version: '8' |
| 87 | + distribution: 'adopt' |
| 88 | + cache: gradle |
| 89 | + - name: Grant execute permission for gradlew |
| 90 | + run: chmod +x gradlew |
| 91 | + - name: Compile with Gradle |
| 92 | + run: ./gradlew compileJava |
| 93 | + - name: Run tests |
| 94 | + run: ./gradlew testFTP jacocoTestReport |
| 95 | + - name: Upload to codecov |
| 96 | + run: bash <(curl -s https://raw.githubusercontent.com/broadinstitute/codecov-bash-uploader/main/codecov-verified.bash) |
| 97 | + - name: Upload test results |
| 98 | + if: always() |
| 99 | + uses: actions/upload-artifact@v2 |
| 100 | + with: |
| 101 | + name: test-results-ftp |
| 102 | + path: build/reports/tests |
| 103 | + spotBugs: |
| 104 | + runs-on: ubuntu-latest |
| 105 | + name: SpotBugs |
| 106 | + steps: |
| 107 | + - uses: actions/checkout@v2 |
| 108 | + - name: Set up java 8 |
| 109 | + uses: actions/setup-java@v2 |
| 110 | + with: |
| 111 | + java-version: '8' |
| 112 | + distribution: 'adopt' |
| 113 | + cache: gradle |
| 114 | + - name: Grant execute permission for gradlew |
| 115 | + run: chmod +x gradlew |
| 116 | + - name: Compile with Gradle |
| 117 | + run: ./gradlew spotBugsMain spotBugsTest |
| 118 | + - name: Upload spotBugs Report |
| 119 | + if: failure() |
| 120 | + uses: actions/upload-artifact@v2 |
| 121 | + with: |
| 122 | + name: spotBugs-Report |
| 123 | + path: build/reports/spotbugs |
| 124 | + |
| 125 | + |
| 126 | + |
0 commit comments