Reorder workflow execution in GHA (#32183)
This patchset refactors our GitHub actions into a single top-level ci workflow that
invokes a series of reusable actions. The main goal of this is to be able to easily
control which tests run and in what order based on the success or failure of top-level
prechecks. Our previous workflows ran in three sets:
* nix tests: style and verification first, then linux and macos tests if successful
* windows tests: style and verification first, then linux and macos tests if successful
* bootstrap tests
As a result, the bootstrap tests ran even if the style failed, and style and verification
had to run on two different platforms despite running identical checks. I'm relatively
sure that's because of the limitation on dependencies between steps in the jobs.
Reusable workflows allow us to run the style, verification and now audit checks once,
then depending on the results, and the files changed, run the appropriate nix, windows
and bootstrap tests. While it saves only a few minutes by itself, this makes it easier to
refactor checks to subset tests without having to replicate tests or other workflow
components in the future.
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2022-09-02 21:09:23 +00:00
|
|
|
name: unit tests
|
2021-03-16 15:16:31 +00:00
|
|
|
|
|
|
|
on:
|
2022-09-07 18:12:57 +00:00
|
|
|
workflow_dispatch:
|
Reorder workflow execution in GHA (#32183)
This patchset refactors our GitHub actions into a single top-level ci workflow that
invokes a series of reusable actions. The main goal of this is to be able to easily
control which tests run and in what order based on the success or failure of top-level
prechecks. Our previous workflows ran in three sets:
* nix tests: style and verification first, then linux and macos tests if successful
* windows tests: style and verification first, then linux and macos tests if successful
* bootstrap tests
As a result, the bootstrap tests ran even if the style failed, and style and verification
had to run on two different platforms despite running identical checks. I'm relatively
sure that's because of the limitation on dependencies between steps in the jobs.
Reusable workflows allow us to run the style, verification and now audit checks once,
then depending on the results, and the files changed, run the appropriate nix, windows
and bootstrap tests. While it saves only a few minutes by itself, this makes it easier to
refactor checks to subset tests without having to replicate tests or other workflow
components in the future.
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2022-09-02 21:09:23 +00:00
|
|
|
workflow_call:
|
2022-06-08 22:46:46 +00:00
|
|
|
|
|
|
|
concurrency:
|
2022-09-07 18:12:57 +00:00
|
|
|
group: unit_tests-${{github.ref}}-${{github.event.pull_request.number || github.run_number}}
|
2022-06-08 22:46:46 +00:00
|
|
|
cancel-in-progress: true
|
|
|
|
|
2021-03-16 15:16:31 +00:00
|
|
|
jobs:
|
|
|
|
# Run unit tests with different configurations on linux
|
Reorder workflow execution in GHA (#32183)
This patchset refactors our GitHub actions into a single top-level ci workflow that
invokes a series of reusable actions. The main goal of this is to be able to easily
control which tests run and in what order based on the success or failure of top-level
prechecks. Our previous workflows ran in three sets:
* nix tests: style and verification first, then linux and macos tests if successful
* windows tests: style and verification first, then linux and macos tests if successful
* bootstrap tests
As a result, the bootstrap tests ran even if the style failed, and style and verification
had to run on two different platforms despite running identical checks. I'm relatively
sure that's because of the limitation on dependencies between steps in the jobs.
Reusable workflows allow us to run the style, verification and now audit checks once,
then depending on the results, and the files changed, run the appropriate nix, windows
and bootstrap tests. While it saves only a few minutes by itself, this makes it easier to
refactor checks to subset tests without having to replicate tests or other workflow
components in the future.
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2022-09-02 21:09:23 +00:00
|
|
|
ubuntu:
|
2022-11-15 21:33:11 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
2021-03-16 15:16:31 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-11-15 21:33:11 +00:00
|
|
|
os: [ubuntu-latest]
|
|
|
|
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
|
2021-12-22 09:46:09 +00:00
|
|
|
concretizer: ['clingo']
|
2022-09-07 18:12:57 +00:00
|
|
|
on_develop:
|
|
|
|
- ${{ github.ref == 'refs/heads/develop' }}
|
2021-12-22 09:46:09 +00:00
|
|
|
include:
|
2022-11-05 14:59:12 +00:00
|
|
|
- python-version: '3.11'
|
2022-11-15 21:33:11 +00:00
|
|
|
os: ubuntu-latest
|
2021-12-22 09:46:09 +00:00
|
|
|
concretizer: original
|
2022-09-08 17:58:53 +00:00
|
|
|
on_develop: ${{ github.ref == 'refs/heads/develop' }}
|
2022-11-15 21:33:11 +00:00
|
|
|
- python-version: '3.6'
|
|
|
|
os: ubuntu-20.04
|
|
|
|
concretizer: clingo
|
|
|
|
on_develop: ${{ github.ref == 'refs/heads/develop' }}
|
2022-09-07 18:12:57 +00:00
|
|
|
exclude:
|
|
|
|
- python-version: '3.7'
|
2022-11-15 21:33:11 +00:00
|
|
|
os: ubuntu-latest
|
2022-09-07 18:12:57 +00:00
|
|
|
concretizer: 'clingo'
|
|
|
|
on_develop: false
|
|
|
|
- python-version: '3.8'
|
2022-11-15 21:33:11 +00:00
|
|
|
os: ubuntu-latest
|
2022-09-07 18:12:57 +00:00
|
|
|
concretizer: 'clingo'
|
|
|
|
on_develop: false
|
|
|
|
- python-version: '3.9'
|
2022-11-15 21:33:11 +00:00
|
|
|
os: ubuntu-latest
|
2022-09-07 18:12:57 +00:00
|
|
|
concretizer: 'clingo'
|
|
|
|
on_develop: false
|
2022-11-05 14:59:12 +00:00
|
|
|
- python-version: '3.10'
|
2022-11-15 21:33:11 +00:00
|
|
|
os: ubuntu-latest
|
2022-11-05 14:59:12 +00:00
|
|
|
concretizer: 'clingo'
|
|
|
|
on_develop: false
|
2022-09-07 18:12:57 +00:00
|
|
|
|
2021-03-16 15:16:31 +00:00
|
|
|
steps:
|
2023-04-15 12:37:52 +00:00
|
|
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # @v2
|
2021-03-16 15:16:31 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-01-16 09:33:12 +00:00
|
|
|
- uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # @v2
|
2021-03-16 15:16:31 +00:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install System packages
|
|
|
|
run: |
|
|
|
|
sudo apt-get -y update
|
|
|
|
# Needed for unit tests
|
2021-06-22 16:51:31 +00:00
|
|
|
sudo apt-get -y install \
|
2021-07-27 21:09:17 +00:00
|
|
|
coreutils cvs gfortran graphviz gnupg2 mercurial ninja-build \
|
2022-11-16 22:28:49 +00:00
|
|
|
cmake bison libbison-dev kcov
|
2021-03-16 15:16:31 +00:00
|
|
|
- name: Install Python packages
|
|
|
|
run: |
|
2023-04-12 17:28:55 +00:00
|
|
|
pip install --upgrade pip six setuptools pytest pytest-xdist pytest-cov
|
2022-11-16 22:28:49 +00:00
|
|
|
pip install --upgrade flake8 "isort>=4.3.5" "mypy>=0.900" "click" "black"
|
2021-03-16 15:16:31 +00:00
|
|
|
- name: Setup git configuration
|
|
|
|
run: |
|
|
|
|
# Need this for the git tests to succeed.
|
|
|
|
git --version
|
|
|
|
. .github/workflows/setup_git.sh
|
2021-08-18 18:14:02 +00:00
|
|
|
- name: Bootstrap clingo
|
2021-03-16 15:16:31 +00:00
|
|
|
if: ${{ matrix.concretizer == 'clingo' }}
|
2021-06-23 11:56:07 +00:00
|
|
|
env:
|
|
|
|
SPACK_PYTHON: python
|
2021-03-16 15:16:31 +00:00
|
|
|
run: |
|
|
|
|
. share/spack/setup-env.sh
|
2022-10-29 19:24:26 +00:00
|
|
|
spack bootstrap disable spack-install
|
2022-11-16 22:28:49 +00:00
|
|
|
spack bootstrap now
|
2021-03-16 15:16:31 +00:00
|
|
|
spack -v solve zlib
|
2022-09-10 13:25:44 +00:00
|
|
|
- name: Run unit tests
|
2021-03-16 15:16:31 +00:00
|
|
|
env:
|
2021-06-23 11:56:07 +00:00
|
|
|
SPACK_PYTHON: python
|
2021-03-16 15:16:31 +00:00
|
|
|
SPACK_TEST_SOLVER: ${{ matrix.concretizer }}
|
2022-09-10 13:25:44 +00:00
|
|
|
SPACK_TEST_PARALLEL: 2
|
|
|
|
COVERAGE: true
|
2022-11-14 12:11:28 +00:00
|
|
|
UNIT_TEST_COVERAGE: ${{ matrix.python-version == '3.11' }}
|
2021-03-16 15:16:31 +00:00
|
|
|
run: |
|
|
|
|
share/spack/qa/run-unit-tests
|
2023-04-12 15:28:39 +00:00
|
|
|
- uses: codecov/codecov-action@40a12dcee2df644d47232dde008099a3e9e4f865
|
2021-03-16 15:16:31 +00:00
|
|
|
with:
|
|
|
|
flags: unittests,linux,${{ matrix.concretizer }}
|
|
|
|
# Test shell integration
|
|
|
|
shell:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-04-15 12:37:52 +00:00
|
|
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # @v2
|
2021-03-16 15:16:31 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-01-16 09:33:12 +00:00
|
|
|
- uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # @v2
|
2021-03-16 15:16:31 +00:00
|
|
|
with:
|
2022-11-05 14:59:12 +00:00
|
|
|
python-version: '3.11'
|
2021-03-16 15:16:31 +00:00
|
|
|
- name: Install System packages
|
|
|
|
run: |
|
|
|
|
sudo apt-get -y update
|
|
|
|
# Needed for shell tests
|
2021-08-19 21:03:10 +00:00
|
|
|
sudo apt-get install -y coreutils kcov csh zsh tcsh fish dash bash
|
2021-03-16 15:16:31 +00:00
|
|
|
- name: Install Python packages
|
|
|
|
run: |
|
2023-04-12 17:28:55 +00:00
|
|
|
pip install --upgrade pip six setuptools pytest coverage[toml] pytest-xdist
|
2021-03-16 15:16:31 +00:00
|
|
|
- name: Setup git configuration
|
|
|
|
run: |
|
|
|
|
# Need this for the git tests to succeed.
|
|
|
|
git --version
|
|
|
|
. .github/workflows/setup_git.sh
|
2022-09-08 17:58:53 +00:00
|
|
|
- name: Run shell tests
|
2021-03-16 15:16:31 +00:00
|
|
|
env:
|
|
|
|
COVERAGE: true
|
|
|
|
run: |
|
|
|
|
share/spack/qa/run-shell-tests
|
2023-04-12 15:28:39 +00:00
|
|
|
- uses: codecov/codecov-action@40a12dcee2df644d47232dde008099a3e9e4f865
|
2021-03-16 15:16:31 +00:00
|
|
|
with:
|
|
|
|
flags: shelltests,linux
|
|
|
|
|
2021-03-20 14:16:52 +00:00
|
|
|
# Test RHEL8 UBI with platform Python. This job is run
|
|
|
|
# only on PRs modifying core Spack
|
2021-03-16 15:16:31 +00:00
|
|
|
rhel8-platform-python:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container: registry.access.redhat.com/ubi8/ubi
|
|
|
|
steps:
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
dnf install -y \
|
|
|
|
bzip2 curl file gcc-c++ gcc gcc-gfortran git gnupg2 gzip \
|
|
|
|
make patch tcl unzip which xz
|
2023-04-15 12:37:52 +00:00
|
|
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # @v2
|
2021-03-16 15:16:31 +00:00
|
|
|
- name: Setup repo and non-root user
|
|
|
|
run: |
|
|
|
|
git --version
|
|
|
|
git fetch --unshallow
|
|
|
|
. .github/workflows/setup_git.sh
|
|
|
|
useradd spack-test
|
|
|
|
chown -R spack-test .
|
|
|
|
- name: Run unit tests
|
|
|
|
shell: runuser -u spack-test -- bash {0}
|
|
|
|
run: |
|
|
|
|
source share/spack/setup-env.sh
|
2022-12-06 10:54:02 +00:00
|
|
|
spack -d bootstrap now --dev
|
2021-06-22 16:51:31 +00:00
|
|
|
spack unit-test -k 'not cvs and not svn and not hg' -x --verbose
|
2021-03-16 15:16:31 +00:00
|
|
|
# Test for the clingo based solver (using clingo-cffi)
|
|
|
|
clingo-cffi:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-04-15 12:37:52 +00:00
|
|
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # @v2
|
2021-04-22 07:35:17 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-01-16 09:33:12 +00:00
|
|
|
- uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # @v2
|
2021-04-22 07:35:17 +00:00
|
|
|
with:
|
2022-11-05 14:59:12 +00:00
|
|
|
python-version: '3.11'
|
2021-04-22 07:35:17 +00:00
|
|
|
- name: Install System packages
|
|
|
|
run: |
|
|
|
|
sudo apt-get -y update
|
2022-11-16 22:28:49 +00:00
|
|
|
sudo apt-get -y install coreutils cvs gfortran graphviz gnupg2 mercurial ninja-build kcov
|
2021-04-22 07:35:17 +00:00
|
|
|
- name: Install Python packages
|
|
|
|
run: |
|
2023-04-12 17:28:55 +00:00
|
|
|
pip install --upgrade pip six setuptools pytest coverage[toml] pytest-cov clingo pytest-xdist
|
2021-04-22 07:35:17 +00:00
|
|
|
- name: Setup git configuration
|
|
|
|
run: |
|
|
|
|
# Need this for the git tests to succeed.
|
|
|
|
git --version
|
|
|
|
. .github/workflows/setup_git.sh
|
|
|
|
- name: Run unit tests (full suite with coverage)
|
|
|
|
env:
|
|
|
|
COVERAGE: true
|
|
|
|
SPACK_TEST_SOLVER: clingo
|
|
|
|
run: |
|
|
|
|
share/spack/qa/run-unit-tests
|
2023-04-12 15:28:39 +00:00
|
|
|
- uses: codecov/codecov-action@40a12dcee2df644d47232dde008099a3e9e4f865 # @v2.1.0
|
2021-04-22 07:35:17 +00:00
|
|
|
with:
|
|
|
|
flags: unittests,linux,clingo
|
2021-03-16 15:16:31 +00:00
|
|
|
# Run unit tests on MacOS
|
Reorder workflow execution in GHA (#32183)
This patchset refactors our GitHub actions into a single top-level ci workflow that
invokes a series of reusable actions. The main goal of this is to be able to easily
control which tests run and in what order based on the success or failure of top-level
prechecks. Our previous workflows ran in three sets:
* nix tests: style and verification first, then linux and macos tests if successful
* windows tests: style and verification first, then linux and macos tests if successful
* bootstrap tests
As a result, the bootstrap tests ran even if the style failed, and style and verification
had to run on two different platforms despite running identical checks. I'm relatively
sure that's because of the limitation on dependencies between steps in the jobs.
Reusable workflows allow us to run the style, verification and now audit checks once,
then depending on the results, and the files changed, run the appropriate nix, windows
and bootstrap tests. While it saves only a few minutes by itself, this makes it easier to
refactor checks to subset tests without having to replicate tests or other workflow
components in the future.
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2022-09-02 21:09:23 +00:00
|
|
|
macos:
|
2021-03-16 15:16:31 +00:00
|
|
|
runs-on: macos-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-10-27 18:25:26 +00:00
|
|
|
python-version: ["3.10"]
|
2021-03-16 15:16:31 +00:00
|
|
|
steps:
|
2023-04-15 12:37:52 +00:00
|
|
|
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # @v2
|
2021-03-16 15:16:31 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-01-16 09:33:12 +00:00
|
|
|
- uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # @v2
|
2021-03-16 15:16:31 +00:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install Python packages
|
|
|
|
run: |
|
|
|
|
pip install --upgrade pip six setuptools
|
2023-04-12 17:28:55 +00:00
|
|
|
pip install --upgrade pytest coverage[toml] pytest-xdist pytest-cov
|
2021-03-16 15:16:31 +00:00
|
|
|
- name: Setup Homebrew packages
|
|
|
|
run: |
|
|
|
|
brew install dash fish gcc gnupg2 kcov
|
|
|
|
- name: Run unit tests
|
2021-08-27 09:10:03 +00:00
|
|
|
env:
|
|
|
|
SPACK_TEST_SOLVER: clingo
|
2022-09-10 13:25:44 +00:00
|
|
|
SPACK_TEST_PARALLEL: 4
|
2021-03-16 15:16:31 +00:00
|
|
|
run: |
|
|
|
|
git --version
|
|
|
|
. .github/workflows/setup_git.sh
|
|
|
|
. share/spack/setup-env.sh
|
2022-10-29 19:24:26 +00:00
|
|
|
$(which spack) bootstrap disable spack-install
|
2021-08-27 09:10:03 +00:00
|
|
|
$(which spack) solve zlib
|
2022-09-07 18:12:57 +00:00
|
|
|
common_args=(--dist loadfile --tx '4*popen//python=./bin/spack-tmpconfig python -u ./bin/spack python' -x)
|
2022-11-01 18:04:45 +00:00
|
|
|
$(which spack) unit-test --cov --cov-config=pyproject.toml --cov-report=xml:coverage.xml "${common_args[@]}"
|
2023-04-12 15:28:39 +00:00
|
|
|
- uses: codecov/codecov-action@40a12dcee2df644d47232dde008099a3e9e4f865
|
2021-03-16 15:16:31 +00:00
|
|
|
with:
|
|
|
|
flags: unittests,macos
|