From b9574a424bbb8736f110e53e20dca82a79056cbb Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Tue, 20 Aug 2024 19:57:35 -0700 Subject: [PATCH] CI action to check for changed schema --- .github/workflows/model_rebuild.yml | 40 +++++++++++++++++++++++++++++ .github/workflows/tests.yml | 4 +-- 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/model_rebuild.yml diff --git a/.github/workflows/model_rebuild.yml b/.github/workflows/model_rebuild.yml new file mode 100644 index 0000000..b2933fa --- /dev/null +++ b/.github/workflows/model_rebuild.yml @@ -0,0 +1,40 @@ +name: Model Rebuild + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build_models: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install packages + run: | + python -m pip install ./nwb_schema_language + python -m pip install ./nwb_linkml + - name: Build models + run: | + python -m ./scripts/generate_core.py + python -m ./scripts/generate_core.py --hdmf + - name: Test for uncommitted changes + run: | + if [ -z "$(git status --porcelain)" ]; + then + echo "No changes detected" + exit 0 + else + echo "Changes to models detected" + echo "$(git status)" + exit 1 + fi + diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ce2fffc..a11fff9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install system libraries run: | @@ -26,7 +26,7 @@ jobs: sudo apt install -y libhdf5-dev hdf5-tools - name: Set up python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: 'pip'