Check that all dependencies are pinned in extern/CMakeLists.txt. #532
This file contains 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: Test JS bindings | |
env: | |
IMAGE_VERSION: master | |
jobs: | |
prepare-version: | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "null" | |
outputs: | |
version: ${{ env.IMAGE_VERSION }} | |
# Building the RDS files for the various RDS-reading utilities. | |
create_rds: | |
runs-on: ubuntu-latest | |
container: rocker/r-base:latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Cache RDS files | |
id: cache-rds | |
uses: actions/cache@v4 | |
with: | |
path: tests/rds/*.rds | |
key: rds-${{ hashFiles('tests/rds/generate.R') }} | |
- name: Build RDS files | |
if: steps.cache-rds.outputs.cache-hit != 'true' | |
run: | | |
cd tests/rds | |
R -f generate.R | |
build_deps: | |
runs-on: ubuntu-latest | |
needs: [prepare-version] | |
container: ghcr.io/kanaverse/emcmake-docker/builder:${{ needs.prepare-version.outputs.version }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Cache installed | |
id: installed | |
uses: actions/cache@v4 | |
with: | |
path: extern/installed | |
key: deps-${{ hashFiles('extern/**/build.sh') }}-${{ env.IMAGE_VERSION }} | |
- name: Build HDF5 | |
if: steps.installed.outputs.cache-hit != 'true' | |
run: | | |
cd extern/hdf5 | |
./build.sh | |
- name: Build igraph | |
if: steps.installed.outputs.cache-hit != 'true' | |
run: | | |
cd extern/igraph | |
./build.sh | |
test: | |
runs-on: ubuntu-latest | |
needs: [ create_rds, build_deps, prepare-version] | |
container: ghcr.io/kanaverse/emcmake-docker/builder:${{ needs.prepare-version.outputs.version }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- 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: Cache installed | |
uses: actions/cache@v4 | |
with: | |
path: extern/installed | |
key: deps-${{ hashFiles('extern/**/build.sh') }}-${{ env.IMAGE_VERSION }} | |
- name: Cache RDS files | |
uses: actions/cache@v4 | |
with: | |
path: tests/rds/*.rds | |
key: rds-${{ hashFiles('tests/rds/generate.R') }} | |
- name: Cache node build | |
id: wasm-build | |
uses: actions/cache@v4 | |
with: | |
path: js/wasm | |
key: wasm-${{ hashFiles('build.sh', 'extern/**/build.sh', 'CMakeLists.txt', 'extern/CMakeLists.txt', 'src/*') }}-${{ env.IMAGE_VERSION }} | |
- name: Update node build | |
if: steps.wasm-build.outputs.cache-hit != 'true' | |
run: bash build.sh main | |
- name: Check all transitive dependencies are pinned | |
if: steps.wasm-build.outputs.cache-hit != 'true' | |
shell: /bin/bash -e {0} | |
run: | | |
cat extern/CMakeLists.txt | \ | |
grep "FetchContent_MakeAvailable" | \ | |
sed "s/FetchContent_MakeAvailable(//" | \ | |
sed "s/)//" | \ | |
tr '[:upper:]' '[:lower:]' | \ | |
sort > requested.txt | |
ls build_main/_deps/ | \ | |
grep "src$" | \ | |
sed "s/-src//" | \ | |
sort > observed.txt | |
diffs=$(diff observed.txt requested.txt ) | |
if [[ $diffs != '' ]] | |
then | |
exit 1 | |
fi | |
- name: Run tests | |
run: | | |
export CHECK_RDS=1 | |
npm run test |