 2079b888c8
			
		
	
	2079b888c8
	
	
	
		
			
			The old concretizer is still used to bootstrap clingo from source. If we switch to a DAG model
where compilers are treated as nodes, we need to either:
1. fix the old concretizer to support this (which is a lot of work and possibly research), or
2. bootstrap `clingo` without the old concretizer.
This PR takes the second approach and gets rid of the old concretizer code. To bootstrap
`clingo`, we store some concrete spec prototypes as JSON, select one according to the
coarse-grained system architecture, and tweak them according to the current host.
The old concretizer and related dead code are removed.  In particular, this removes
`Spec.normalize()` and related methods, which were used in many unit-tests to set
up the test context. The tests have been updated not to use `normalize()`.
- [x] Bootstrap clingo concretization based on a JSON file
- [x] Bootstrap clingo *before* patchelf
- [x] Remove any use of the old concretizer, including:
      * Remove only_clingo and only_original fixtures
      * Remove _old_concretize and _new_concretize
      * Remove _concretize_together_old
      * Remove _concretize_together_new
      * Remove any use of `SPACK_TEST_SOLVER`
      * Simplify CI jobs
- [x] ensure bootstrapping `clingo` works on on Darwin and Windows
- [x] Raise an intelligible error when a compiler is missing
- [x] Ensure bootstrapping works on FreeBSD
- [x] remove normalize and related methods
Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
		
	
		
			
				
	
	
		
			248 lines
		
	
	
		
			8.3 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			248 lines
		
	
	
		
			8.3 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
| name: unit tests
 | |
| 
 | |
| on:
 | |
|   workflow_dispatch:
 | |
|   workflow_call:
 | |
| 
 | |
| concurrency:
 | |
|   group: unit_tests-${{github.ref}}-${{github.event.pull_request.number || github.run_number}}
 | |
|   cancel-in-progress: true
 | |
| 
 | |
| jobs:
 | |
|   # Run unit tests with different configurations on linux
 | |
|   ubuntu:
 | |
|     runs-on: ${{ matrix.os }}
 | |
|     strategy:
 | |
|       matrix:
 | |
|         os: [ubuntu-latest]
 | |
|         python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
 | |
|         on_develop:
 | |
|         - ${{ github.ref == 'refs/heads/develop' }}
 | |
|         include:
 | |
|         - python-version: '3.6'
 | |
|           os: ubuntu-20.04
 | |
|           on_develop: ${{ github.ref == 'refs/heads/develop' }}
 | |
|         exclude:
 | |
|         - python-version: '3.7'
 | |
|           os: ubuntu-latest
 | |
|           on_develop: false
 | |
|         - python-version: '3.8'
 | |
|           os: ubuntu-latest
 | |
|           on_develop: false
 | |
|         - python-version: '3.9'
 | |
|           os: ubuntu-latest
 | |
|           on_develop: false
 | |
|         - python-version: '3.10'
 | |
|           os: ubuntu-latest
 | |
|           on_develop: false
 | |
|         - python-version: '3.11'
 | |
|           os: ubuntu-latest
 | |
|           on_develop: false
 | |
| 
 | |
|     steps:
 | |
|     - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
 | |
|       with:
 | |
|         fetch-depth: 0
 | |
|     - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f
 | |
|       with:
 | |
|         python-version: ${{ matrix.python-version }}
 | |
|     - name: Install System packages
 | |
|       run: |
 | |
|           sudo apt-get -y update
 | |
|           # Needed for unit tests
 | |
|           sudo apt-get -y install \
 | |
|               coreutils cvs gfortran graphviz gnupg2 mercurial ninja-build \
 | |
|               cmake bison libbison-dev kcov
 | |
|     - name: Install Python packages
 | |
|       run: |
 | |
|           pip install --upgrade pip setuptools pytest pytest-xdist pytest-cov
 | |
|           pip install --upgrade flake8 "isort>=4.3.5" "mypy>=0.900" "click" "black"
 | |
|     - name: Setup git configuration
 | |
|       run: |
 | |
|           # Need this for the git tests to succeed.
 | |
|           git --version
 | |
|           . .github/workflows/bin/setup_git.sh
 | |
|     - name: Bootstrap clingo
 | |
|       if: ${{ matrix.concretizer == 'clingo' }}
 | |
|       env:
 | |
|           SPACK_PYTHON: python
 | |
|       run: |
 | |
|           . share/spack/setup-env.sh
 | |
|           spack bootstrap disable spack-install
 | |
|           spack bootstrap now
 | |
|           spack -v solve zlib
 | |
|     - name: Run unit tests
 | |
|       env:
 | |
|           SPACK_PYTHON: python
 | |
|           SPACK_TEST_PARALLEL: 2
 | |
|           COVERAGE: true
 | |
|           UNIT_TEST_COVERAGE: ${{ matrix.python-version == '3.11' }}
 | |
|       run: |
 | |
|           share/spack/qa/run-unit-tests
 | |
|     - uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673
 | |
|       with:
 | |
|         flags: unittests,linux,${{ matrix.concretizer }}
 | |
|         token: ${{ secrets.CODECOV_TOKEN }}
 | |
|         verbose: true
 | |
|   # Test shell integration
 | |
|   shell:
 | |
|     runs-on: ubuntu-latest
 | |
|     steps:
 | |
|     - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
 | |
|       with:
 | |
|         fetch-depth: 0
 | |
|     - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f
 | |
|       with:
 | |
|         python-version: '3.11'
 | |
|     - name: Install System packages
 | |
|       run: |
 | |
|           sudo apt-get -y update
 | |
|           # Needed for shell tests
 | |
|           sudo apt-get install -y coreutils kcov csh zsh tcsh fish dash bash
 | |
|     - name: Install Python packages
 | |
|       run: |
 | |
|           pip install --upgrade pip setuptools pytest coverage[toml] pytest-xdist
 | |
|     - name: Setup git configuration
 | |
|       run: |
 | |
|           # Need this for the git tests to succeed.
 | |
|           git --version
 | |
|           . .github/workflows/bin/setup_git.sh
 | |
|     - name: Run shell tests
 | |
|       env:
 | |
|           COVERAGE: true
 | |
|       run: |
 | |
|           share/spack/qa/run-shell-tests
 | |
|     - uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673
 | |
|       with:
 | |
|         flags: shelltests,linux
 | |
|         token: ${{ secrets.CODECOV_TOKEN }}
 | |
|         verbose: true
 | |
| 
 | |
|   # Test RHEL8 UBI with platform Python. This job is run
 | |
|   # only on PRs modifying core Spack
 | |
|   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
 | |
|     - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
 | |
|     - name: Setup repo and non-root user
 | |
|       run: |
 | |
|           git --version
 | |
|           git config --global --add safe.directory /__w/spack/spack
 | |
|           git fetch --unshallow
 | |
|           . .github/workflows/bin/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
 | |
|           spack -d bootstrap now --dev
 | |
|           spack unit-test -k 'not cvs and not svn and not hg' -x --verbose
 | |
|   # Test for the clingo based solver (using clingo-cffi)
 | |
|   clingo-cffi:
 | |
|     runs-on: ubuntu-latest
 | |
|     steps:
 | |
|     - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
 | |
|       with:
 | |
|         fetch-depth: 0
 | |
|     - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f
 | |
|       with:
 | |
|         python-version: '3.11'
 | |
|     - name: Install System packages
 | |
|       run: |
 | |
|           sudo apt-get -y update
 | |
|           sudo apt-get -y install coreutils cvs gfortran graphviz gnupg2 mercurial ninja-build kcov
 | |
|     - name: Install Python packages
 | |
|       run: |
 | |
|           pip install --upgrade pip setuptools pytest coverage[toml] pytest-cov clingo pytest-xdist
 | |
|           pip install --upgrade flake8 "isort>=4.3.5" "mypy>=0.900" "click" "black"
 | |
|     - name: Setup git configuration
 | |
|       run: |
 | |
|           # Need this for the git tests to succeed.
 | |
|           git --version
 | |
|           . .github/workflows/bin/setup_git.sh
 | |
|     - name: Run unit tests (full suite with coverage)
 | |
|       env:
 | |
|           COVERAGE: true
 | |
|       run: |
 | |
|           share/spack/qa/run-unit-tests
 | |
|     - uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673
 | |
|       with:
 | |
|         flags: unittests,linux,clingo
 | |
|         token: ${{ secrets.CODECOV_TOKEN }}
 | |
|         verbose: true
 | |
|   # Run unit tests on MacOS
 | |
|   macos:
 | |
|     runs-on: ${{ matrix.os }}
 | |
|     strategy:
 | |
|       matrix:
 | |
|         os: [macos-13, macos-14]
 | |
|         python-version: ["3.11"]
 | |
|     steps:
 | |
|     - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
 | |
|       with:
 | |
|         fetch-depth: 0
 | |
|     - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f
 | |
|       with:
 | |
|         python-version: ${{ matrix.python-version }}
 | |
|     - name: Install Python packages
 | |
|       run: |
 | |
|           pip install --upgrade pip setuptools
 | |
|           pip install --upgrade pytest coverage[toml] pytest-xdist pytest-cov
 | |
|     - name: Setup Homebrew packages
 | |
|       run: |
 | |
|         brew install dash fish gcc gnupg2 kcov
 | |
|     - name: Run unit tests
 | |
|       env:
 | |
|         SPACK_TEST_PARALLEL: 4
 | |
|       run: |
 | |
|         git --version
 | |
|         . .github/workflows/bin/setup_git.sh
 | |
|         . share/spack/setup-env.sh
 | |
|         $(which spack) bootstrap disable spack-install
 | |
|         $(which spack) solve zlib
 | |
|         common_args=(--dist loadfile --tx '4*popen//python=./bin/spack-tmpconfig python -u ./bin/spack python' -x)
 | |
|         $(which spack) unit-test --verbose --cov --cov-config=pyproject.toml --cov-report=xml:coverage.xml "${common_args[@]}"
 | |
|     - uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673
 | |
|       with:
 | |
|         flags: unittests,macos
 | |
|         token: ${{ secrets.CODECOV_TOKEN }}
 | |
|         verbose: true
 | |
|   # Run unit tests on Windows
 | |
|   windows:
 | |
|     defaults:
 | |
|       run:
 | |
|         shell:
 | |
|           powershell Invoke-Expression -Command "./share/spack/qa/windows_test_setup.ps1"; {0}
 | |
|     runs-on: windows-latest
 | |
|     steps:
 | |
|     - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
 | |
|       with:
 | |
|         fetch-depth: 0
 | |
|     - uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f
 | |
|       with:
 | |
|         python-version: 3.9
 | |
|     - name: Install Python packages
 | |
|       run: |
 | |
|           python -m pip install --upgrade pip pywin32 setuptools pytest-cov clingo
 | |
|     - name: Create local develop
 | |
|       run: |
 | |
|         ./.github/workflows/bin/setup_git.ps1
 | |
|     - name: Unit Test
 | |
|       run: |
 | |
|         spack unit-test -x --verbose --cov --cov-config=pyproject.toml
 | |
|         ./share/spack/qa/validate_last_exit.ps1
 | |
|         coverage combine -a
 | |
|         coverage xml
 | |
|     - uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673
 | |
|       with:
 | |
|         flags: unittests,windows
 | |
|         token: ${{ secrets.CODECOV_TOKEN }}
 | |
|         verbose: true
 |