Skip to content

Glotter

Glotter #4641

Workflow file for this run

# This workflow will install Python dependencies, download Docker images, and test every script in the repo
name: Glotter
permissions:
contents: read
on:
push:
branches: [ main ]
paths:
- 'archive/**'
- '.glotter.yml'
- 'repo-config.yml'
- '.github/workflows/test-suite.yml'
- 'pyproject.toml'
- 'poetry.lock'
- '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.exists }}
changed_files: ${{ steps.changed-files.outputs.files }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Get changed code files
id: changed-files
uses: yumemi-inc/changed-files@v3
with:
patterns: |
archive/**
.glotter.yml
repo-config.yml
.github/workflows/test-suite.yml
pyproject.toml
poetry.lock
scripts/run_tests.py
!**/*.md
- name: List all relevant changed files
if: steps.changed-files.outputs.exists == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.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' }}
runs-on: ubuntu-latest
steps:
- name: Maximize build space
uses: AdityaGarg8/remove-unwanted-software@v5
with:
remove-dotnet: true
remove-android: true
remove-haskell: true
remove-codeql: true
remove-cached-tools: true
- uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Read repo config
uses: pietrobolcato/[email protected]
id: repo-config
with:
config: repo-config.yml
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "${{ steps.repo-config.outputs['python-version'] }}"
- name: Run Poetry Image
uses: abatilo/actions-poetry@v3
with:
poetry-version: "${{ steps.repo-config.outputs['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 ${{ steps.repo-config.outputs['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