Skip to content

Coord git

Coord git #8260

Workflow file for this run

name: Unit tests
on:
push:
branches:
- master
- fake-master
paths-ignore:
- '**.md'
- '**.txt'
- '.**ignore'
- 'docs/**'
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]
paths-ignore:
- '**.md'
- '**.txt'
- '.**ignore'
- 'docs/**'
workflow_call: {}
jobs:
build:
if: (github.event_name == 'workflow_call') || (github.event_name == 'push' && github.event.head_commit.author.email != 'PPTeam@STJUDE.ORG') || (github.event_name == 'pull_request')
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 10
- uses: actions/setup-node@v4
with:
cache: 'npm'
node-version: '20'
- run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run ESLint
run: npx eslint . --ext .ts --quiet
- name: Copy serverconfig.json to root
run: |
cd server/test/
node -e 'const fs = require("fs"); const serverconfig = JSON.parse(fs.readFileSync("serverconfig.json")); tpmasterdir = "/home/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }}/server/test/tp"; fs.writeFileSync("data.json", JSON.stringify(serverconfig));'
TPMASTERDIR=$(node -p "require('./serverconfig.json').tpmasterdir")
mv serverconfig.json ../../
- name: Run tsc
run: |
# !!! TODO: run type check at the proteinpaint dir !!!
cd shared/types
npm run build
npx tsc
cd ../utils
npx tsc
cd ../../server
npx tsc
cd ../client
npm run tsc
- name: Create server cache folder
run: if [[ ! -d "server/cache" ]]; then mkdir server/cache; fi
- name: Detect workspaces to test
run: |
# default to running tests on all workspaces, in case there is an error in requiresTest
echo "WS_TO_TEST=client server rust" >> $GITHUB_ENV
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
# override with only the workspaces that have relevant changes
echo "WS_TO_TEST=$(./build/requiresTest.sh)" >> $GITHUB_ENV
fi
- name: 🔎 Run shared/utils test
if: contains(env.WS_TO_TEST, 'shared/utils')
run: npm test --workspace="shared/utils"
# TODO: no need to run pack test once esbuild is used for package release
- name: 🔎 Run client pack test
if: contains(env.WS_TO_TEST, 'client')
run: npm pack --workspace="client"
- name: 🔎 Run client tests
if: contains(env.WS_TO_TEST, 'client')
run: |
sudo apt-get install xvfb
xvfb-run --auto-servernum npm run test:unit --workspace="client"
- name: 🔎 Run augen tests
if: contains(env.WS_TO_TEST, 'augen')
run: |
npm test --workspace="augen"
- name: 🔎 Server unit tests
if: contains(env.WS_TO_TEST, 'server')
run: npm run test:unit --workspace="server"
- name: Install HDF5
run: |
sudo apt-get update
sudo apt-get install -y libhdf5-dev
- name: ⚡ Cache
if: contains(env.WS_TO_TEST, 'rust')
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
./rust/target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1.0.6
if: contains(env.WS_TO_TEST, 'rust')
with:
toolchain: stable
override: true
- name: 🔎 Rust unit tests
if: contains(env.WS_TO_TEST, 'rust')
run: |
npm run build --workspace="rust"
npm run test:unit --workspace="rust"