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:
|
2021-03-16 15:16:31 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-08-04 13:26:56 +00:00
|
|
|
python-version: ['2.7', '3.6', '3.7', '3.8', '3.9', '3.10']
|
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:
|
|
|
|
- python-version: 2.7
|
|
|
|
concretizer: original
|
2022-09-08 17:58:53 +00:00
|
|
|
on_develop: ${{ github.ref == 'refs/heads/develop' }}
|
2022-09-07 18:12:57 +00:00
|
|
|
- python-version: '3.10'
|
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-09-07 18:12:57 +00:00
|
|
|
exclude:
|
|
|
|
- python-version: '3.7'
|
|
|
|
concretizer: 'clingo'
|
|
|
|
on_develop: false
|
|
|
|
- python-version: '3.8'
|
|
|
|
concretizer: 'clingo'
|
|
|
|
on_develop: false
|
|
|
|
- python-version: '3.9'
|
|
|
|
concretizer: 'clingo'
|
|
|
|
on_develop: false
|
|
|
|
|
2021-03-16 15:16:31 +00:00
|
|
|
steps:
|
2022-04-27 11:47:50 +00:00
|
|
|
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # @v2
|
2021-03-16 15:16:31 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-08-03 07:08:03 +00:00
|
|
|
- uses: actions/setup-python@b55428b1882923874294fa556849718a1d7f2ca5 # @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 \
|
2021-08-19 21:03:10 +00:00
|
|
|
patchelf cmake bison libbison-dev kcov
|
2021-03-16 15:16:31 +00:00
|
|
|
- name: Install Python packages
|
|
|
|
run: |
|
2022-09-10 13:25:44 +00:00
|
|
|
pip install --upgrade pip six setuptools pytest codecov[toml] pytest-cov pytest-xdist
|
2021-07-27 21:09:17 +00:00
|
|
|
# ensure style checks are not skipped in unit tests for python >= 3.6
|
|
|
|
# note that true/false (i.e., 1/0) are opposite in conditions in python and bash
|
|
|
|
if python -c 'import sys; sys.exit(not sys.version_info >= (3, 6))'; then
|
2021-07-06 04:43:52 +00:00
|
|
|
pip install --upgrade flake8 "isort>=4.3.5" "mypy>=0.900" "click==8.0.4" "black<=21.12b0"
|
2021-07-27 21:09:17 +00:00
|
|
|
fi
|
2022-02-08 20:00:20 +00:00
|
|
|
- name: Pin pathlib for Python 2.7
|
|
|
|
if: ${{ matrix.python-version == 2.7 }}
|
|
|
|
run: |
|
|
|
|
pip install -U pathlib2==2.3.6
|
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
|
2021-08-18 18:14:02 +00:00
|
|
|
spack bootstrap untrust spack-install
|
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
|
|
|
|
UNIT_TEST_COVERAGE: ${{ (matrix.concretizer == 'original' && matrix.python-version == '2.7') || (matrix.python-version == '3.10') }}
|
2021-03-16 15:16:31 +00:00
|
|
|
run: |
|
|
|
|
share/spack/qa/run-unit-tests
|
2022-09-10 13:25:44 +00:00
|
|
|
coverage combine -a
|
2021-03-16 15:16:31 +00:00
|
|
|
coverage xml
|
2022-09-10 13:25:44 +00:00
|
|
|
- uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378
|
2021-03-16 15:16:31 +00:00
|
|
|
with:
|
|
|
|
flags: unittests,linux,${{ matrix.concretizer }}
|
|
|
|
# Test shell integration
|
|
|
|
shell:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-04-27 11:47:50 +00:00
|
|
|
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # @v2
|
2021-03-16 15:16:31 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-08-03 07:08:03 +00:00
|
|
|
- uses: actions/setup-python@b55428b1882923874294fa556849718a1d7f2ca5 # @v2
|
2021-03-16 15:16:31 +00:00
|
|
|
with:
|
2022-04-13 21:32:23 +00:00
|
|
|
python-version: '3.10'
|
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: |
|
2022-09-07 18:12:57 +00:00
|
|
|
pip install --upgrade pip six setuptools pytest codecov coverage[toml]==6.2 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
|
2022-09-10 13:25:44 +00:00
|
|
|
- uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378
|
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
|
2022-04-27 11:47:50 +00:00
|
|
|
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # @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
|
2021-09-15 05:44:16 +00:00
|
|
|
spack -d solve zlib
|
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:
|
2022-04-27 11:47:50 +00:00
|
|
|
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # @v2
|
2021-04-22 07:35:17 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-08-03 07:08:03 +00:00
|
|
|
- uses: actions/setup-python@b55428b1882923874294fa556849718a1d7f2ca5 # @v2
|
2021-04-22 07:35:17 +00:00
|
|
|
with:
|
2022-04-13 21:32:23 +00:00
|
|
|
python-version: '3.10'
|
2021-04-22 07:35:17 +00:00
|
|
|
- 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 \
|
|
|
|
coreutils cvs gfortran graphviz gnupg2 mercurial ninja-build \
|
2021-08-19 21:03:10 +00:00
|
|
|
patchelf kcov
|
2021-04-22 07:35:17 +00:00
|
|
|
- name: Install Python packages
|
|
|
|
run: |
|
2022-09-10 13:25:44 +00:00
|
|
|
pip install --upgrade pip six setuptools pytest codecov 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
|
2022-09-10 13:25:44 +00:00
|
|
|
coverage combine -a
|
2021-04-22 07:35:17 +00:00
|
|
|
coverage xml
|
2022-04-27 09:26:19 +00:00
|
|
|
- uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # @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:
|
|
|
|
python-version: [3.8]
|
|
|
|
steps:
|
2022-04-27 11:47:50 +00:00
|
|
|
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # @v2
|
2021-03-16 15:16:31 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-08-03 07:08:03 +00:00
|
|
|
- uses: actions/setup-python@b55428b1882923874294fa556849718a1d7f2ca5 # @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
|
2022-09-10 13:25:44 +00:00
|
|
|
pip install --upgrade pytest codecov 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
|
2021-08-27 09:10:03 +00:00
|
|
|
$(which spack) bootstrap untrust spack-install
|
|
|
|
$(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-09-10 13:25:44 +00:00
|
|
|
$(which spack) unit-test --cov --cov-config=pyproject.toml "${common_args[@]}"
|
|
|
|
coverage combine -a
|
2022-09-08 17:58:53 +00:00
|
|
|
coverage xml
|
|
|
|
# Delete the symlink going from ./lib/spack/docs/_spack_root back to
|
|
|
|
# the initial directory, since it causes ELOOP errors with codecov/actions@2
|
|
|
|
rm lib/spack/docs/_spack_root
|
2022-09-10 13:25:44 +00:00
|
|
|
- uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378
|
2021-03-16 15:16:31 +00:00
|
|
|
with:
|
|
|
|
flags: unittests,macos
|