|
| 1 | +name: Weekly Branch Tests |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Run every Sunday at 02:30 UTC (30 minutes after download test) |
| 6 | + - cron: '30 2 * * 0' |
| 7 | + workflow_dispatch: # Allow manual triggering |
| 8 | + |
| 9 | +jobs: |
| 10 | + weekly-test: |
| 11 | + runs-on: ${{ matrix.config.os }} |
| 12 | + if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' |
| 13 | + |
| 14 | + strategy: |
| 15 | + fail-fast: false |
| 16 | + matrix: |
| 17 | + config: |
| 18 | + - { name: 'ubuntu_latest', os: ubuntu-latest } |
| 19 | + - { name: 'macos_latest', os: macos-latest } |
| 20 | + java: |
| 21 | + - { ver: '11', run_nextflow: true, run_coverage: false, nxf_ver: "22.04.5" } |
| 22 | + - { ver: '17', run_nextflow: true, run_coverage: true, nxf_ver: latest } |
| 23 | + - { ver: '21', run_nextflow: true, run_coverage: false, nxf_ver: latest-edge } |
| 24 | + branch: |
| 25 | + - main |
| 26 | + - develop_0_9 |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Checkout ${{ matrix.branch }} branch |
| 30 | + uses: actions/checkout@v5 |
| 31 | + with: |
| 32 | + ref: ${{ matrix.branch }} |
| 33 | + |
| 34 | + - uses: viash-io/viash-actions/project/update-docker-engine@v6 |
| 35 | + if: runner.os == 'Linux' |
| 36 | + |
| 37 | + - name: Set up R |
| 38 | + uses: r-lib/actions/setup-r@v2 |
| 39 | + with: |
| 40 | + use-public-rspm: true |
| 41 | + |
| 42 | + - name: Set up R dependencies |
| 43 | + uses: r-lib/actions/setup-r-dependencies@v2 |
| 44 | + with: |
| 45 | + packages: | |
| 46 | + processx |
| 47 | + testthat |
| 48 | +
|
| 49 | + - name: Set up java |
| 50 | + uses: actions/setup-java@v5 |
| 51 | + with: |
| 52 | + distribution: temurin |
| 53 | + java-version: ${{ matrix.java.ver }} |
| 54 | + |
| 55 | + - name: Set up sbt |
| 56 | + uses: sbt/setup-sbt@v1 |
| 57 | + |
| 58 | + - name: Set up Scala |
| 59 | + run: | |
| 60 | + if [[ "${{ matrix.config.os }}" =~ ^macos.*$ ]]; then |
| 61 | + brew install scala |
| 62 | + else |
| 63 | + sudo apt-get update |
| 64 | + sudo apt-get install -y scala |
| 65 | + fi |
| 66 | +
|
| 67 | + - name: Set up Python |
| 68 | + uses: actions/setup-python@v6 |
| 69 | + with: |
| 70 | + python-version: '3.x' |
| 71 | + |
| 72 | + - name: Set up Nextflow |
| 73 | + if: ${{ runner.os == 'Linux' && matrix.java.run_nextflow }} |
| 74 | + uses: nf-core/setup-nextflow@v2 |
| 75 | + with: |
| 76 | + version: ${{ matrix.java.nxf_ver }} |
| 77 | + |
| 78 | + - name: Run tests |
| 79 | + run: | |
| 80 | + if [[ "${{ matrix.config.name }}" =~ ^ubuntu.*$ ]] && [[ "${{ matrix.java.run_coverage }}" == "true" ]]; then |
| 81 | + # only run coverage on main runner |
| 82 | + sbt clean coverage test coverageReport |
| 83 | + elif [[ "${{ matrix.config.name }}" =~ ^ubuntu.*$ ]] && [[ "${{ matrix.java.run_nextflow }}" == "false" ]]; then |
| 84 | + sbt 'testOnly -- -l io.viash.NextflowTest' |
| 85 | + elif [[ "${{ matrix.config.os }}" =~ ^macos.*$ ]]; then |
| 86 | + # macOS on github actions does not have Docker, so skip those |
| 87 | + sbt 'testOnly -- -l io.viash.DockerTest -l io.viash.NextflowTest' |
| 88 | + else |
| 89 | + sbt test |
| 90 | + fi |
| 91 | +
|
| 92 | + - name: Upload coverage on success |
| 93 | + if: ${{ matrix.java.run_coverage }} |
| 94 | + run: bash <(curl -s https://codecov.io/bash) |
| 95 | + |
| 96 | + - name: Upload check results on fail |
| 97 | + if: failure() |
| 98 | + uses: actions/upload-artifact@master |
| 99 | + with: |
| 100 | + name: ${{ matrix.config.name }}_${{ matrix.branch }}_${{ matrix.java.ver }}_results |
| 101 | + path: check |
| 102 | + |
| 103 | + - name: Notify on failure |
| 104 | + if: failure() |
| 105 | + run: | |
| 106 | + curl -X POST \ |
| 107 | + -H 'Content-Type: application/json' \ |
| 108 | + -d '{ |
| 109 | + "text": "🚨 *Weekly Tests Failed*\n\n• **Branch**: ${{ matrix.branch }}\n• **OS**: ${{ matrix.config.name }}\n• **Java**: ${{ matrix.java.ver }}\n• **Repository**: ${{ github.repository }}\n• **Run**: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Logs>" |
| 110 | + }' \ |
| 111 | + "${{ secrets.GOOGLE_CHAT_WEBHOOK_URL }}" |
0 commit comments