Write all results to CI artifacts; store new integration tests artifa… #1159
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: tests | |
on: | |
push: | |
pull_request: | |
types: [opened, ready_for_review] | |
jobs: | |
code-quality-checks: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get contents from tip of branch on push | |
uses: actions/checkout@v4 | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
- name: Install Node dependencies | |
run: npm install | |
- name: Check for valid JSON | |
run: grunt jsonreview -v | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8==6.0 | |
- name: Check Python code quality | |
run: flake8 --exclude docs/conf.py --max-line-length=100 | |
python-tests: | |
runs-on: ubuntu-latest | |
# Specify python versions to run | |
strategy: | |
matrix: | |
python: ['3.10', '3.11', '3.12'] | |
steps: | |
- name: Get contents from tip of branch on push | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install scout package | |
run: | | |
python -m pip install --upgrade pip | |
pip install . | |
- name: Run tests | |
run: python -m unittest discover -p '*_test.py' tests/ | |
check-docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get contents from tip of branch on push | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
scout | |
docs | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install scout package | |
run: | | |
python -m pip install --upgrade pip | |
pip install . | |
- name: Generate readable configuration file | |
run: python docs/generate_readable_cfg.py -o config_readable_ci.yml | |
- name: Compare readable configuration files | |
run: | | |
if ! cmp -s docs/config_readable.yml config_readable_ci.yml; then | |
echo "docs/config_readable.yml is not up to date with scout/supporting_data/config_schema.yml. Update file by running docs/generate_readable_cfg.py" | |
exit 1 | |
fi | |
check-PR: | |
# Check if there is a PR - allows one main workflow with dependency on previous jobs | |
needs: [code-quality-checks, python-tests, check-docs] | |
runs-on: ubuntu-latest | |
outputs: | |
PR_status: ${{ steps.PR.outputs.pr_found }} | |
PR: ${{ steps.PR.outputs.pr }} | |
steps: | |
- name: Check if PR | |
uses: 8BitJonny/gh-get-current-pr@2.2.0 | |
id: PR | |
with: | |
filterOutClosed: true | |
filterOutDraft: true | |
integration-tests: | |
needs: [check-PR] | |
if: | | |
(needs.check-PR.outputs.PR_status == 'true' && fromJSON(needs.check-PR.outputs.PR).base.ref == 'master') || | |
(github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'master' && github.event.pull_request.draft == false) || | |
github.ref == 'refs/heads/master' | |
uses: ./.github/workflows/integration_tests.yml | |
secrets: inherit |