test: add basic tests for run & main.R
#3
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: tests | |
| on: | |
| push: | |
| branches: [main, dev] | |
| pull_request: | |
| branches: [main, dev] | |
| permissions: | |
| contents: read | |
| jobs: | |
| tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Parse environment.json and set Docker image | |
| id: docker_image | |
| run: | | |
| IMAGE=$(jq -r '.base_image' .codeocean/environment.json) | |
| IMAGE=${IMAGE//codeocean/nciccbr} | |
| echo "image=$IMAGE" >> $GITHUB_OUTPUT | |
| echo "Using Docker image: $IMAGE" | |
| - name: Run tests in Docker | |
| run: | | |
| docker run --rm \ | |
| -v ${{ github.workspace }}:/workspace \ | |
| -w /workspace \ | |
| ${{ steps.docker_image.outputs.image }} \ | |
| Rscript tests/testthat.R |