Feat/json schema workflow #1
Workflow file for this run
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
name: main-ci | |
on: | |
pull_request: # default types: opened, synchronize, reopened | |
branches: [main] | |
paths: | |
- 'modules/**' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
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: 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 LinkML and regenerate registered jsons for Superdataset, PortalDataset, etc | |
run: | | |
pip install linkml | |
make Dataset | |
make Superdataset | |
make PortalDataset | |
make PortalStudy | |
- name: Check changes in any of the schema files | |
run: | | |
if git diff-index --quiet HEAD --; then | |
echo 'FOLLOWUP_COMMIT=true' >> $GITHUB_ENV | |
else | |
echo 'FOLLOWUP_COMMIT=false' >> $GITHUB_ENV | |
fi | |
- name: Commit files | |
if: ${{ env.FOLLOWUP_COMMIT == true }} | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "nf-osi[bot]" | |
git add . | |
git commit -m "Rebuild NF.jsonld, json" | |
- name: Push changes | |
if: ${{ env.FOLLOWUP_COMMIT == true }} | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.event.pull_request.head.ref }} | |
# - name: Build confirmation message | |
# uses: mshick/add-pr-comment@v2 | |
# with: | |
# message-id: build-message | |
# message: "You made some changes in the last commit that triggered rebuild: ${{ env.FOLLOWUP_COMMIT }}" | |
# Additionally test PRs | |
test: | |
name: Test with schematic | |
needs: [build] | |
runs-on: ubuntu-latest | |
env: | |
SCHEMATIC_SERVICE_ACCT_CREDS: ${{ secrets.SCHEMATIC_SERVICE_ACCT_CREDS }} | |
permissions: | |
pull-requests: write | |
strategy: | |
matrix: | |
schematic-version: [24.1.1] | |
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==${{ matrix.schematic-version }} | |
- name: Sanity-check successful installation and version | |
run: 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 | |
# TODO Step for test submission of data | |
- name: Create test suite report | |
working-directory: tests | |
continue-on-error: true | |
run: docker run -v $(pwd):/tests 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 | |
message-path: | | |
tests/test-suite-report.md | |
- name: Upload test artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-logs-${{ matrix.schematic-version }} | |
path: tests/**/logs | |