You've already forked training_material
mirror of
https://github.com/AdaCore/training_material.git
synced 2026-02-12 13:08:57 -08:00
160 lines
4.7 KiB
YAML
160 lines
4.7 KiB
YAML
name: CI
|
|
|
|
# Controls when the action will run. Triggers the workflow on push or pull request
|
|
# events but only for the master branch
|
|
on: push
|
|
|
|
jobs:
|
|
List-Courses:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
# Black magic to generate the list of courses from the python script to JSON
|
|
-
|
|
id: set-courses
|
|
run: |
|
|
courses="$(python3 contrib/ci/course.py find courses/ --json)"
|
|
echo "courses=$courses" >> $GITHUB_OUTPUT
|
|
|
|
outputs:
|
|
matrix: ${{steps.set-courses.outputs.courses}}
|
|
|
|
Slides:
|
|
needs: List-Courses
|
|
|
|
runs-on: ubuntu-latest
|
|
container: public.ecr.aws/w0s6m4g9/pandoc-beamer:latest
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
# Import list of courses from the List-Courses job
|
|
source: ${{fromJson(needs.List-Courses.outputs.matrix)}}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Check source is updated with prelude
|
|
run: python3 contrib/ci/fix_prelude.py
|
|
|
|
- name: Prepare slides environment
|
|
run: python3 contrib/ci/slides.py ${{ format('{0}/{1}', 'courses', matrix.source) }} printenv >> $GITHUB_ENV
|
|
|
|
- name: ${{ env.PRETTY_NAME }} - Build
|
|
run: python3 pandoc/pandoc_fe.py --output-dir ${{ env.OUTPUT_DIR }} --hush --extension pdf --source ${{ env.SOURCES }}
|
|
|
|
- name: ${{ env.PRETTY_NAME }} - Package and upload
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ env.PRETTY_NAME }}
|
|
path: ${{ env.ARTIFACTS }}
|
|
if-no-files-found: error
|
|
|
|
Labs-Slides:
|
|
runs-on: ubuntu-latest
|
|
container: sawertyu/pandoc_beamer:latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: GNAT SAS - Package
|
|
run: python3 contrib/ci/package_labs.py courses/gnatsas/labs/ && mv out/labs out/gnatsas_labs && unzip out/gnatsas_labs/labs.zip -d out/gnatsas_labs/pkg
|
|
|
|
- name: GNAT SAS - Upload
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: GNAT SAS labs
|
|
path: out/gnatsas_labs/pkg/*
|
|
if-no-files-found: error
|
|
|
|
- name: GNAT Project Facility - Package
|
|
run: python3 contrib/ci/package_labs.py courses/gnat_project_facility/labs/ && mv out/labs out/gnat_project_facility_labs && unzip out/gnat_project_facility_labs/labs.zip -d out/gnat_project_facility_labs/pkg
|
|
|
|
- name: GNAT Project Facility - Upload
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: GNAT Project Facility labs
|
|
path: out/gnat_project_facility_labs/pkg/*
|
|
if-no-files-found: error
|
|
|
|
- name: Mini Cinema - Package
|
|
run: python3 contrib/ci/package_labs.py courses/ada_essentials/mini_projects/cinema && unzip out/cinema/cinema.zip -d out/cinema/pkg
|
|
|
|
- name: Mini Cinema - Upload
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: Mini Project - Mini Cinema
|
|
path: out/cinema/pkg/*
|
|
if-no-files-found: error
|
|
|
|
labs-build:
|
|
|
|
name: Labs # intentionly short
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest] #windows-latest TODO
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
container: sawertyu/alr:latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Update base system
|
|
run: |
|
|
apt update
|
|
apt install -y python3
|
|
|
|
- name: Install GNAT & GPRbuild
|
|
run: |
|
|
alr toolchain --install gnat_native=12.2.1 gprbuild=22.0.1
|
|
|
|
- name: Solution build for Ada Essentials
|
|
run: |
|
|
. contrib/ci/lab_env.profile
|
|
python3 contrib/ci/build_labs_check.py courses/ada_essentials
|
|
|
|
python-black:
|
|
name: Python scripts black lint check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.10'
|
|
|
|
- name: Install black
|
|
run: python3 -m pip install "black>=24.0.0,<25.0.0"
|
|
|
|
- name: Run black on contrib/
|
|
run: python3 -m black --check $(find contrib -name '*.py')
|
|
|
|
- name: Run black on pandoc/
|
|
run: python3 -m black --check $(find pandoc -name '*.py')
|
|
|
|
pytest:
|
|
name: Contrib scripts check
|
|
runs-on: ubuntu-latest
|
|
container: sawertyu/alr:latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Update base system
|
|
run: |
|
|
apt update
|
|
apt install -y python3 python3-pip pandoc
|
|
|
|
- name: Install GNAT & GPRbuild
|
|
run: |
|
|
alr toolchain --install gnat_native=12.2.1 gprbuild=22.0.1
|
|
|
|
- name: Setup Python
|
|
run: python3 -m pip install pytest epycs pandocfilters adacut
|
|
|
|
- name: Check Quizes
|
|
run: |
|
|
. contrib/ci/alr_gnat_env.profile
|
|
python3 contrib/quiz_update.py -v courses/ada_essentials/quiz/
|