Skip to content

Update registered exports #141

Update registered exports

Update registered exports #141

Workflow file for this run

name: main-ci
on:
pull_request: # default types: opened, synchronize, reopened
branches: [main]
paths:
- 'modules/**'
- '.github/workflows/main-ci.yml'
workflow_dispatch:
env:
SCHEMATIC_VERSION: 24.7.2 # please update .devcontainer as well until this can be set globally somewhere...
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository
- name: Get skip flags
id: check_skip_flags
run: echo "HEAD_COMMIT_MESSAGE=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT"
- name: Setup custom build tools and make jsonld
shell: bash
run: |
bash < <(curl -s https://raw.githubusercontent.com/babashka/babashka/master/install)
git clone --depth 1 https://github.com/anngvu/retold.git
make
- name: Install tools and regenerate registered jsons for Superdataset, PortalDataset, etc
run: |
pip install linkml==v1.8.1
npm install -g json-dereference-cli
make PortalDataset
make PortalStudy
make Superdataset
make PortalPublication
make Protocol
# Set up supported python.
- uses: actions/setup-python@v5
with:
python-version: '3.10.12'
- name: Setup schematic and do another convert pass
id: schematic-convert
run: |
pip install schematicpy==${{ env.SCHEMATIC_VERSION }}
pip show schematicpy
schematic schema convert NF.jsonld
- name: Commit files if there are changes
run: |
if [[ $(git diff --exit-code) ]]; then
echo "Changes in src modules affect final jsonld or json artifacts and will be committed"
git config --local user.email "[email protected]"
git config --local user.name "nf-osi[bot]"
git add .
git commit -m "Rebuild NF.jsonld, json"
else
echo "Changes in src modules did not affect final jsonld or json artifacts"
echo "Note that tests will still be run in the next job"
fi
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.event.pull_request.head.ref }}
# Additionally test PRs
test:
name: Test with schematic current version
needs: [build]
runs-on: ubuntu-latest
env:
SCHEMATIC_SERVICE_ACCT_CREDS: ${{ secrets.SCHEMATIC_SERVICE_ACCT_CREDS }}
permissions:
pull-requests: write
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip tests') }}
# strategy:
# matrix:
# cannot actually do parallel/concurrent testing because of API rate limits,
# so we currently only test with one schematic version because it takes much too long with sequential
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 1
- uses: actions/setup-python@v5
with:
python-version: '3.10.12'
- name: Setup schematic
id: setup-schematic
run: |
pip install schematicpy==${{ env.SCHEMATIC_VERSION }}
pip show schematicpy
- name: Test generate
working-directory: tests/generate
continue-on-error: true
run: ./basic_templates.sh
- name: Test validate
working-directory: tests/validate
continue-on-error: true
run: ./run_config.sh
- name: Test submit
working-directory: tests/submit
continue-on-error: true
# Only test submit needs SYNAPSE_AUTH_TOKEN
env:
SYNAPSE_AUTH_TOKEN: ${{ secrets.SYNAPSE_AUTH_TOKEN }}
# Need to set up csvtool for use in test environment
run: |
sudo apt install csvtool
printf "[authentication]\nSYNAPSE_AUTH_TOKEN=$SYNAPSE_AUTH_TOKEN" > .synapseConfig
./test_submit.sh
- name: Create test suite report
working-directory: tests
continue-on-error: true
run: docker run -v $(pwd):/tests -e SCHEMATIC=${{ env.SCHEMATIC_VERSION }} rocker/tidyverse R -e "rmarkdown::render('tests/test-suite-report.Rmd')"
- name: Report on test suite as PR comment
uses: mshick/add-pr-comment@v2
with:
message-id: test-suite-report-${{ env.SCHEMATIC_VERSION }}
message-path: |
tests/test-suite-report.md
- name: Upload test artifacts
uses: actions/upload-artifact@v4
with:
name: test-logs-${{ env.SCHEMATIC_VERSION }}
path: tests/**/logs