From 3bddf77f61994fc5cff1a2990213dee91aaec8ad Mon Sep 17 00:00:00 2001 From: Deborah Brouwer Date: Mon, 25 Nov 2024 01:48:50 -0800 Subject: [PATCH] ci: separate python tests and artifacts Currently the python-test job runs pytest and then creates python related artifacts for use by other jobs. But the python-test job isn't triggered by changes to the python scripts and libraries. Instead, changes to python scripts and libraries can currently be merged without running pytest and, if they do generate errors, they will only appear in ci later when trying to generate the python artifacts. Add pytest to the existing linting jobs and expand the rules so that it will be triggered by changes to python scripts and libraries. Remove pytest from the job that creates artifacts. This will ensure that the artifacts are still valid while catching script/library errors before they are merged. Part-of: --- .gitlab-ci.yml | 1 + .gitlab-ci/build/gitlab-ci.yml | 11 ++++++----- .gitlab-ci/lava/lava-gitlab-ci.yml | 2 +- .gitlab-ci/test/gitlab-ci.yml | 13 ++++++++++--- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 906deb52287..12d1e2a67cb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -212,6 +212,7 @@ include: - bin/git_sha1_gen.py - bin/install_megadrivers.py - bin/symbols-check.py + - bin/ci/**/* # GitLab CI - .gitlab-ci.yml - .gitlab-ci/**/* diff --git a/.gitlab-ci/build/gitlab-ci.yml b/.gitlab-ci/build/gitlab-ci.yml index 8e06e886514..c9579dfe628 100644 --- a/.gitlab-ci/build/gitlab-ci.yml +++ b/.gitlab-ci/build/gitlab-ci.yml @@ -86,7 +86,7 @@ # no need to wait on the "first one" to be done. # - job: windows-msvc # optional: true - - job: python-test + - job: python-artifacts optional: true @@ -812,9 +812,9 @@ debian-ppc64el: DRI_LOADERS: -D glvnd=disabled -# This job tests our Python scripts, and also emits our scripts into -# artifacts, so they can be reused for job submission to hardware devices. -python-test: +# This job emits our scripts into artifacts so they can be reused for +# job submission to hardware devices. +python-artifacts: stage: build-for-tests extends: - .use-debian/x86_64_pyutils @@ -824,5 +824,6 @@ python-test: S3_ARTIFACT_NAME: mesa-python-ci-artifacts timeout: 10m script: - - .gitlab-ci/run-pytest.sh - .gitlab-ci/prepare-artifacts-python.sh + tags: + - placeholder-job diff --git a/.gitlab-ci/lava/lava-gitlab-ci.yml b/.gitlab-ci/lava/lava-gitlab-ci.yml index f830ba88082..5022f251d78 100755 --- a/.gitlab-ci/lava/lava-gitlab-ci.yml +++ b/.gitlab-ci/lava/lava-gitlab-ci.yml @@ -46,7 +46,7 @@ variables: artifacts: false - job: debian/x86_64_pyutils artifacts: false - - job: python-test + - job: python-artifacts artifacts: false .lava-test:arm32: diff --git a/.gitlab-ci/test/gitlab-ci.yml b/.gitlab-ci/test/gitlab-ci.yml index 8e47ec5dff1..13ecfe9859e 100644 --- a/.gitlab-ci/test/gitlab-ci.yml +++ b/.gitlab-ci/test/gitlab-ci.yml @@ -43,7 +43,7 @@ rustfmt: - rustfmt --version - rustfmt --verbose src/**/lib.rs -yaml-toml-shell-test: +yaml-toml-shell-py-test: extends: - .use-debian/x86_64_pyutils - .no-auto-retry # this job can't be flaky @@ -57,20 +57,27 @@ yaml-toml-shell-test: - uncollapsed_section_switch shellcheck "shellcheck" - .gitlab-ci/run-shellcheck.sh - section_end + - uncollapsed_section_switch pytest "pytest" + - .gitlab-ci/run-pytest.sh + - section_end rules: - !reference [.disable-farm-mr-rules, rules] - !reference [.never-post-merge-rules, rules] - !reference [.no_scheduled_pipelines-rules, rules] - if: $GITLAB_USER_LOGIN == "marge-bot" - changes: &toml_lint_files + changes: &lint_files - .gitlab-ci/test/gitlab-ci.yml - .gitlab-ci/**/*.sh - .shellcheckrc - bin/toml_lint.py - src/**/ci/*.toml + - .gitlab-ci/tests/**/* + - bin/ci/**/* when: on_success - - changes: *toml_lint_files + - changes: *lint_files when: manual + tags: + - placeholder-job .test-gl: extends: