Skip to content

Glotter

Glotter #2628

Workflow file for this run

# This workflow will install Python dependencies, download Docker images, and test every script in the repo
name: Glotter
on:
push:
branches: [ main ]
paths:
- 'archive/**'
- '.github/workflows/test-suite.yml'
- 'scripts/run_tests.py'
- '!**/*.md'
pull_request:
branches:
- 'main'
schedule:
# Run every Wednesday at 10:39 UTC (randomly chosen)
- cron: '39 10 * * 3'
jobs:
# We need this job to check if changed files should trigger testing
changed-files:
name: "Changed Files"
runs-on: ubuntu-latest
outputs:
status: ${{ steps.changed-files.outputs.any_changed }}
changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Get changed code files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: |
archive/**
.github/workflows/test-suite.yml
scripts/run_tests.py
files_ignore: |
**/*.md
- name: List all relevant changed files
if: steps.changed-files.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
done
# We need this job to test all code in the codebase
testing:
name: "Test Suite"
needs: changed-files
if: needs.changed-files.outputs.status == 'true' || ${{ github.event_name == 'schedule' }}
strategy:
fail-fast: true
matrix:
python-version: ["3.11"]
poetry-version: ["1.8.5"]
os: [ubuntu-latest]
num_batches: [6]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Run Poetry Image
uses: abatilo/actions-poetry@v3
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install Dependencies
run: poetry install
- name: Check for Bad Files
run: poetry run glotter check
- name: Download Docker images, Test Appropriate Sample Programs, Remove Docker Images
run: poetry run python scripts/run_tests.py
--event ${{ github.event_name }}
--num-batches ${{ matrix.num_batches }}
--parallel
--remove
${{ needs.changed-files.outputs.changed_files }}
# Because testing uses a matrix, we need this job for branch protections
test-results:
name: Test Results
needs: testing
runs-on: ubuntu-latest
if: ${{ always() }}
steps:
- run: |
result="${{ needs.testing.result }}"
if [[ $result == "success" || $result == "skipped" ]]; then
exit 0
else
exit 1
fi