Skip to content

(PR40) Workflows and Testing#99

Open
nikolaredstork wants to merge 39 commits intodevelopfrom
feature/workflows
Open

(PR40) Workflows and Testing#99
nikolaredstork wants to merge 39 commits intodevelopfrom
feature/workflows

Conversation

@nikolaredstork
Copy link
Copy Markdown
Collaborator

@nikolaredstork nikolaredstork commented Apr 15, 2026

Summary

This PR introduces CI/CD governance infrastructure for the GEMS repository: structured GitHub issue templates aligned with the formal process framework, automated Antares update detection with integrated E2E test validation, and a complete linting/type-checking pipeline.


Changes

1. GitHub Issue Templates (new)

Five dedicated issue templates — one per governance process — replacing the previous generic process-change.yml template. Each template includes a full Steps 1–10 checklist with process-specific deviations.

  • doc-01.yml — Antares Simulator evolution impact on GEMS Language documentation
    • Captures: previous/new Antares version, trigger, impact on GEMS Language, interpreter support status, validation strategy
    • Full checklist Steps 1–10; deviation: Step 4 documentation update precedes implementation
  • doc-02.yml — Internal documentation improvement
    • Captures: change type (new content / correction / restructuring / translation), description, affected doc sections
    • Full checklist Steps 1–10; deviation: Step 8 versioning may be patch-only
  • lt-01.yml — Antares Simulator evolution impact on model libraries and taxonomies
    • Captures: Antares versions, affected libraries (free-text, reads from libraries/), validation strategy
    • Full checklist Steps 1–10; deviation: Step 4 enforces alignment with GEMS Language semantics
  • lt-02.yml — Internal library or taxonomy development
    • Captures: affected library, change type (major/minor/patch), whether optimization results are impacted
    • Full checklist Steps 1–10; deviation: Step 5 validates no unintended changes to optimization results
  • lt-03.yml — New library or taxonomy
    • Captures: library name, description, design overview, use cases, proof-of-concept plan
    • Full checklist Steps 1–10 with mandatory design phase before implementation; full E2E validation required before release

2. Scheduled Antares Update Workflow (check-antares-update.yml) — new

Daily (06:00 UTC) automated check for a new stable Antares Simulator release.

  • check-update job — Fetches all GitHub tags, filters pre-releases (rc/alpha/beta/nightly), compares with versions/antares-simulator.txt; if a new version is found, fetches release notes from the GitHub API and creates a triage issue containing: version table, release notes, triage checklist (DOC-01 / LT-01 routing), and detailed task checklists (Validation, Compatibility, Documentation, Decision)
  • e2e-new-version job — Calls the reusable run-e2e-tests.yml workflow against the new Antares version (no repo change); exposes test_outcome as output
  • post-results job — Runs if: always(); posts E2E test result (pass/fail + run link) as a comment on the triage issue

3. Reusable E2E Workflow (run-e2e-tests.yml) — new

Extracts all E2E test steps into a reusable workflow_call workflow to avoid duplication between e2e-tests.yml and check-antares-update.yml.

  • Inputs: antares_version (required), artifact_name (optional, default e2e-test-failures)
  • Output: test_outcome (success or failure) — available to callers even when the job fails
  • Steps: checkout, Python setup, install dependencies, override version file, download binary, extract, run tests (continue-on-error: true), upload artifacts on failure, cleanup, fail if tests failed

4. E2E Tests Workflow (e2e-tests.yml) — updated

  • Reads Antares version dynamically from versions/antares-simulator.txt (was hardcoded as 9.3.2) in a read-version job
  • Calls the reusable run-e2e-tests.yml workflow — E2E logic no longer duplicated
  • Updated action versions: actions/checkout@v6, actions/setup-python@v6

Version tracking: The versions/ directory at the repo root is the single source of truth for all component versions (antares-simulator.txt, gems-language.txt, library versions). All workflows read from these files dynamically — no version is hardcoded anywhere in CI.

5. Lint and Format Workflow (lint-and-format.yml) — new

Single job running all checks in sequence — avoids reinstalling the environment three times:

  • ruff check tests/ and ruff format --check tests/
  • mypy (configuration driven by pyproject.toml)
  • yamllint -c .yamllint.yml libraries/ resources/ .github/workflows/

6. Tool Configuration (pyproject.toml) — new

  • Ruff configuration: Python 3.11 target, 100-char line length, rules E/W/F/I/UP/B/C4/RUF, E501 ignored (handled by formatter), isort first-party set to tests
  • Mypy strict mode: covers tests/ directory; excludes tests/e2e_tests/test_* and tests/e2e_tests/conftest.py (pytest fixture injection is not mypy-compatible); utility modules env.py and utils.py are fully type-checked

Testing

  • All unit and E2E tests pass locally on the branch (python -m pytest tests/ -v)
  • ruff check tests/ and ruff format --check tests/ pass with no violations
  • mypy (strict) passes on tests/e2e_tests/env.py, tests/e2e_tests/utils.py, and all unit tests
  • yamllint passes on all YAML files in libraries/, resources/, and .github/workflows/

Process Reference

Process Template Trigger
DOC-01 doc-01.yml Manually opened from triage issue created by check-antares-update.yml
DOC-02 doc-02.yml Manual
LT-01 lt-01.yml Manually opened from triage issue created by check-antares-update.yml
LT-02 lt-02.yml Manual
LT-03 lt-03.yml Manual
Antares version detection check-antares-update.yml (daily cron, auto-creates triage issue)

@nikolaredstork nikolaredstork requested a review from aoustry April 17, 2026 07:45
@nikolaredstork nikolaredstork changed the base branch from develop to feature/cluade-md-file April 19, 2026 10:41
@nikolaredstork nikolaredstork changed the title [WIP] Workflows and Testing (PR39) Workflows and Testing Apr 20, 2026
@nikolaredstork nikolaredstork changed the title (PR39) Workflows and Testing (PR40) Workflows and Testing Apr 20, 2026
@nikolaredstork nikolaredstork changed the base branch from feature/cluade-md-file to develop April 20, 2026 08:48
@@ -0,0 +1,45 @@
name: Antares Simulator Update Detected
description: Automatically created when a new Antares Simulator release is detected
title: "[ANTARES UPDATE] New release: v"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why "v" ? Either fetch the version numer or just remove it ?

Suggested change
title: "[ANTARES UPDATE] New release: v"
title: "[ANTARES UPDATE] New release: v"

Copy link
Copy Markdown
Collaborator Author

@nikolaredstork nikolaredstork Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! I've excluded it.

Comment thread .github/ISSUE_TEMPLATE/doc-01.yml Outdated
Comment thread .github/ISSUE_TEMPLATE/lt-01.yml Outdated
Comment thread .github/ISSUE_TEMPLATE/lt-01.yml Outdated
Comment on lines +43 to +46
- label: "`basic_models_library.yml`"
- label: "`antares_legacy_models.yml`"
- label: "`pypsa_models.yml`"
- label: "`andromede_models.yml`"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need to update this eachtime we add a library into GEMS repo ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I will try to make it dynamic!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot make it dynamic, instead I've created text area.

Comment on lines +149 to +238
e2e-new-version:
name: E2E Tests against Antares v${{ needs.check-update.outputs.latest_version }}
runs-on: ubuntu-22.04
needs: check-update
if: needs.check-update.outputs.update == 'true'

steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Set up Python 3.11
uses: actions/setup-python@v6
with:
python-version: '3.11'
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Download new Antares release
run: |
VERSION="${{ needs.check-update.outputs.latest_version }}"
ARCHIVE="antares-${VERSION}-Ubuntu-22.04.tar.gz"
echo "Downloading Antares v${VERSION}..."
curl -L -f -o "${ARCHIVE}" \
"https://github.com/AntaresSimulatorTeam/Antares_Simulator/releases/download/v${VERSION}/${ARCHIVE}"
echo "Download successful. File size: $(ls -lh "${ARCHIVE}" | awk '{print $5}')"

- name: Extract Antares binaries
run: |
VERSION="${{ needs.check-update.outputs.latest_version }}"
tar -xzf "antares-${VERSION}-Ubuntu-22.04.tar.gz"

- name: Point tests at new version
run: |
VERSION="${{ needs.check-update.outputs.latest_version }}"
sed -i "s/ANTARES_SIMULATOR_VERSION=.*/ANTARES_SIMULATOR_VERSION=${VERSION}/" versions/antares-simulator.txt

- name: Run end-to-end tests
id: run_tests
run: python -m pytest tests/e2e_tests -v
continue-on-error: true

- name: Upload test artifacts on failure
if: steps.run_tests.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: e2e-failures-antares-${{ needs.check-update.outputs.latest_version }}
path: |
tmp/
**/*.log
retention-days: 7

- name: Post results to issue
uses: actions/github-script@v9
with:
script: |
const outcome = '${{ steps.run_tests.outcome }}';
const version = '${{ needs.check-update.outputs.latest_version }}';
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
const icon = outcome === 'success' ? '✅' : '❌';
const status = outcome === 'success' ? 'passed' : 'failed';

const body = [
`## E2E Test Results — Antares v${version}`,
'',
`${icon} E2E tests **${status}** against Antares v${version}.`,
'',
`[View full run](${runUrl})`,
].join('\n');

await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: Number('${{ needs.check-update.outputs.issue_number }}'),
body: body,
});

- name: Cleanup
if: always()
run: |
VERSION="${{ needs.check-update.outputs.latest_version }}"
rm -f "antares-${VERSION}-Ubuntu-22.04.tar.gz"
rm -rf "antares-${VERSION}-Ubuntu-22.04"

- name: Fail job if tests failed
if: steps.run_tests.outcome == 'failure'
run: exit 1
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a lot in common with the e2e-test workflow, can we factorize all common steps in another yml and refer to it ? This will avoid double updates in the future or any inconsistencies that may lead to the e2e to pass with this CI job and not with the e2e test one

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created a reusable workflow run-e2e-tests.yml. Both e2e-tests.yml and check-antares-update.yml now call it, E2E logic lives in one place. Please check it out.

Comment thread .github/workflows/lint-and-format.yml Outdated
Comment on lines +38 to +51
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Set up Python 3.11
uses: actions/setup-python@v6
with:
python-version: '3.11'
cache: 'pip'

- name: Install dev dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may avoid reinstalling the whole environement twice

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Comment thread .github/workflows/lint-and-format.yml Outdated
Comment on lines +60 to +73
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Set up Python 3.11
uses: actions/setup-python@v6
with:
python-version: '3.11'
cache: 'pip'

- name: Install dev dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even three times...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Comment thread tests/e2e_tests/env.py Outdated
Comment on lines +50 to +51
antares_version = _read_antares_version(repo_root)
antares_root = repo_root / f"antares-{antares_version}-Ubuntu-22.04"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated code (with following lines)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Comment thread versions/andromede_models.txt Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will consider adding this info directly into the library files with @aoustry , this will avoid these additional files

@nikolaredstork nikolaredstork requested a review from tbittar April 21, 2026 06:13
Base automatically changed from develop to main April 23, 2026 13:47
@nikolaredstork nikolaredstork changed the base branch from main to develop April 23, 2026 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants