Encode JSON as Uint8Arrays before calling globals.write(). #38
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
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| name: Run unit tests | |
| env: | |
| IMAGE_VERSION: master | |
| jobs: | |
| # Building the artifacts in R to be read by Javascript. | |
| artifacts-from-r: | |
| runs-on: ubuntu-latest | |
| container: bioconductor/bioconductor_docker:devel | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Set directories | |
| run: | | |
| echo "R_PKG_DIR=${R_HOME}/site-library" >> $GITHUB_ENV | |
| - name: Restore the package directory | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.R_PKG_DIR }} | |
| key: r-deps-${{ hashFiles('tests/r-dependencies.txt') }} | |
| - name: Install packages | |
| shell: Rscript {0} | |
| run: | | |
| deps <- readLines("tests/r-dependencies.txt") | |
| BiocManager::install(deps) | |
| - name: Build artifacts from R | |
| shell: Rscript {0} | |
| run: | | |
| for (fname in list.files("tests", pattern="-generate.R$")) { | |
| cat("Currently running", fname, "\n") | |
| source(file.path("tests", fname)) | |
| } | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifacts-from-r | |
| path: artifacts | |
| test-read-in-js: | |
| runs-on: ubuntu-latest | |
| needs: [ artifacts-from-r ] | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Cache modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: '**/node_modules' | |
| key: npm-${{ hashFiles('**/package.json') }} | |
| - name: Update NPM packages | |
| run: npm i --include=dev | |
| - name: Fetch artifacts from R | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: artifacts-from-r | |
| path: artifacts | |
| - name: Run tests | |
| run: npm run test | |
| artifacts-from-js: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Cache modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: '**/node_modules' | |
| key: npm-${{ hashFiles('**/package.json') }} | |
| - name: Update NPM packages | |
| run: npm i --include=dev | |
| - name: Build artifacts from Javascript | |
| if: steps.cache-artifacts-from-js.outputs.cache-hit != 'true' | |
| run: | | |
| for fname in $(ls tests/*-generate.js); do | |
| node $fname | |
| done | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifacts-from-js | |
| path: artifacts2 | |
| test-read-in-r: | |
| runs-on: ubuntu-latest | |
| needs: [ artifacts-from-js ] | |
| container: bioconductor/bioconductor_docker:devel | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Set directories | |
| run: | | |
| echo "R_PKG_DIR=${R_HOME}/site-library" >> $GITHUB_ENV | |
| - name: Restore the package directory | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.R_PKG_DIR }} | |
| key: r-deps-${{ hashFiles('tests/r-dependencies.txt') }} | |
| - name: Install packages | |
| shell: Rscript {0} | |
| run: | | |
| deps <- readLines("tests/r-dependencies.txt") | |
| BiocManager::install(deps) | |
| - name: Fetch artifacts from Javascript | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: artifacts-from-js | |
| path: artifacts2 | |
| - name: Build artifacts from R | |
| shell: Rscript {0} | |
| run: | | |
| library(testthat) | |
| for (fname in list.files("tests", pattern="-read.R$")) { | |
| cat("Currently testing", fname, "\n") | |
| source(file.path("tests", fname)) | |
| } |