Skip to content

Commit

Permalink
Try with github.event.inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
stephen-riggs committed Aug 15, 2024
1 parent e7aaf03 commit acb2960
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/ci/action.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Run tests

on:
workflow_call:
inputs:
Expand All @@ -12,10 +14,10 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Use Python ${{ inputs.PYTHON_VERSION }}
- name: Use Python ${{ github.event.inputs.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.PYTHON_VERSION }}
python-version: ${{ github.event.inputs.PYTHON_VERSION }}

- name: Get pre-built package
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -72,7 +74,7 @@ jobs:
PYTHONDEVMODE=1 pytest tests -ra --cov=ispyb --cov-report=xml --cov-branch
- name: Publish coverage stats
run: bash <(curl -s https://codecov.io/bash) -n "Python ${{ inputs.PYTHON_VERSION }}"
run: bash <(curl -s https://codecov.io/bash) -n "Python ${{ github.event.inputs.PYTHON_VERSION }}"
continue-on-error: true
working-directory: ./src
timeout-inutes: 2
8 changes: 5 additions & 3 deletions .github/workflows/update-orm/action.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Check if ORM update is needed

on:
workflow_call:
inputs:
Expand All @@ -24,11 +26,11 @@ jobs:
run: |
set -eu
CURRENT_VERSION=$(grep __schema_version__ _auto_db_schema.py | cut -d'"' -f2)
diff -a <(echo ${CURRENT_VERSION}) <(echo ${{ inputs.DATABASE_SCHEMA }}) >/dev/null && {
diff -a <(echo ${CURRENT_VERSION}) <(echo ${{ github.event.inputs.DATABASE_SCHEMA }}) >/dev/null && {
echo "##[section]ORM is up to date (${CURRENT_VERSION})"
echo "needsUpdate=false" >> $GITHUB_OUTPUT
} || {
echo "##[warning]ORM needs to be updated (${CURRENT_VERSION} -> ${{ inputs.DATABASE_SCHEMA }})."
echo "##[warning]ORM needs to be updated (${CURRENT_VERSION} -> ${{ github.event.inputs.DATABASE_SCHEMA }})."
echo "needsUpdate=talse" >> $GITHUB_OUTPUT
}
working-directory: ./src/ispyb/sqlalchemy
Expand Down Expand Up @@ -88,7 +90,7 @@ jobs:
# This code produces false positives due to non-deterministic ordering.
# Add an identifier to the file, and only update/PR the changes when the
# identifier indicates the file is out of date.
cat <(echo "__schema_version__ = \"$(DATABASE_SCHEMA)\"") _auto_db_schema.py.in > _auto_db_schema.py
cat <(echo "__schema_version__ = \"${{ github.event.inputs.DATABASE_SCHEMA }}\"") _auto_db_schema.py.in > _auto_db_schema.py
rm _auto_db_schema.py.in
pre-commit run --files _auto_db_schema.py || echo pre-commit exited with non-zero return code
working-directory: ./src/ispyb/sqlalchemy
Expand Down

0 comments on commit acb2960

Please sign in to comment.