ci: fix container image def #20
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
| # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
|
Check failure on line 1 in .github/workflows/R-CMD-check.yaml
|
||
| # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
| on: | ||
| push: | ||
| branches: [main, master, dev, DEV] | ||
| pull_request: | ||
| branches: [main, master, dev, DEV] | ||
| workflow_dispatch: | ||
| name: R-CMD-check | ||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| env: | ||
| CONTAINER_IMAGE: nciccbr/scworkflow:v1.0.2_79e5d37 | ||
| jobs: | ||
| R-CMD-check: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| config: | ||
| - { os: ubuntu-latest, r: '4.1.3' } | ||
| #- { os: ubuntu-latest, r: 'oldrel-1' } | ||
| #- { os: macos-latest, r: 'release' } | ||
| runs-on: ${{ matrix.config.os }} | ||
| name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | ||
| env: | ||
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
| R_KEEP_PKG_SOURCE: yes | ||
| container: | ||
| image: ${{ env.CONTAINER_IMAGE }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: r-lib/actions/setup-r-dependencies@v2 | ||
| with: | ||
| extra-packages: local::. | ||
| needs: dev | ||
| - uses: r-lib/actions/check-r-package@v2 | ||
| with: | ||
| upload-snapshots: true | ||
| lint: | ||
| runs-on: ubuntu-latest | ||
| container: | ||
| image: ${{ env.CONTAINER_IMAGE }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: r-lib/actions/setup-r-dependencies@v2 | ||
| with: | ||
| needs: dev | ||
| - name: Good Practice checks | ||
| shell: Rscript {0} | ||
| run: | | ||
| g <- goodpractice::gp() | ||
| g | ||
| n_failed <- length(goodpractice::failed_checks(g)) | ||
| if (n_failed > 0) { | ||
| warning(paste(n_failed, "failed checks")) | ||
| } | ||
| - name: Lint | ||
| shell: Rscript {0} | ||
| run: lintr::lint_package() | ||
| env: | ||
| LINTR_ERROR_ON_LINT: false | ||
| test-coverage: | ||
| runs-on: ubuntu-latest | ||
| container: | ||
| image: ${{ env.CONTAINER_IMAGE }} | ||
| env: | ||
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: r-lib/actions/setup-r-dependencies@v2 | ||
| with: | ||
| needs: dev | ||
| - name: Test coverage | ||
| run: | | ||
| cov <- covr::package_coverage( | ||
| quiet = FALSE, | ||
| clean = FALSE, | ||
| install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") | ||
| ) | ||
| covr::to_cobertura(cov) | ||
| shell: Rscript {0} | ||
| - uses: codecov/codecov-action@v4 | ||
| with: | ||
| fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }} | ||
| file: ./cobertura.xml | ||
| plugin: noop | ||
| disable_search: true | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| - name: Show testthat output | ||
| if: always() | ||
| run: | | ||
| ## -------------------------------------------------------------------- | ||
| find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true | ||
| shell: bash | ||
| - name: Upload test results | ||
| if: failure() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage-test-failures | ||
| path: ${{ runner.temp }}/package | ||
| check: # make sure all check jobs pass. https://github.com/orgs/community/discussions/4324#discussioncomment-3477871 | ||
| runs-on: ubuntu-latest | ||
| needs: [R-CMD-check, lint, test-coverage] | ||
| if: always() | ||
| steps: | ||
| - name: Successful build | ||
| if: ${{ !(contains(needs.*.result, 'failure')) }} | ||
| run: exit 0 | ||
| - name: Failing build | ||
| if: ${{ contains(needs.*.result, 'failure') }} | ||
| run: exit 1 | ||