GitLab CI: Simplify finding binaries (copy #2669) #3276
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
# PRs can only use caches from their target branch. We therefore need to | |
# make sure we run on 'master' too. | |
- master | |
pull_request: | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build_mac_windows: | |
name: Build and run limited tests | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["macOS", "windows"] | |
ghc: ["8.6", "8.8", "8.10", "9.0", "9.2", "9.4", "9.6", "9.8"] | |
include: | |
- stack: latest | |
# The latest stack image uses aarch64, for which this GHC doesn't | |
# exist | |
- os: macOS | |
ghc: 8.6 | |
stack: 2.11.1 | |
# The latest stack image uses aarch64, for which this GHC doesn't | |
# exist | |
- os: macOS | |
ghc: 8.8 | |
stack: 2.11.1 | |
# The latest stack image gives error: | |
# ld: unknown option: --version | |
# <no location info>: error: | |
# Warning: Couldn't figure out LLVM version! | |
# Make sure you have installed LLVM between [9 and 13) | |
- os: macOS | |
ghc: 9.0 | |
stack: 2.11.1 | |
exclude: | |
# Some tests fail with a mysterious -11 error code. | |
- os: macOS | |
ghc: 8.10 | |
# Windows gets non-deterministically gets stuck in infinite loops | |
# or segfaults while running the testcase. | |
- os: windows | |
ghc: 8.8 | |
# GHC 9.0 fails to compile clash-cores due to a template haskell | |
# failure | |
- os: windows | |
ghc: 9.0 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: haskell-actions/setup@v2 | |
id: setup-haskell | |
with: | |
enable-stack: true | |
stack-no-global: true | |
stack-version: ${{ matrix.stack }} | |
- name: Install IVerilog (macOS) | |
if: matrix.os == 'macOS' | |
run: brew install icarus-verilog | |
- name: Install IVerilog (Windows) | |
if: matrix.os == 'Windows' | |
run: choco install --no-progress iverilog | |
- name: General Setup | |
shell: bash | |
run: | | |
cp .ci/stack-${{ matrix.ghc }}.yaml stack.yaml | |
# Print out stack.yaml for debugging purposes | |
cat stack.yaml | |
- name: Cache (Windows) | |
if: ${{ runner.os == 'Windows' }} | |
uses: actions/cache@v4 | |
with: | |
# On windows we have to use "\" as a path separator, otherwise caching fails | |
path: | | |
${{ steps.setup-haskell.outputs.stack-root }}\snapshots | |
key: ${{ matrix.os }}-${{ matrix.ghc }}-${{ hashFiles('stack.yaml', '**/*.cabal', '.github/workflows/ci.yml') }} | |
restore-keys: ${{ matrix.os }}-${{ matrix.ghc }}- | |
- name: Cache (non-Windows) | |
if: ${{ runner.os != 'Windows' }} | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ steps.setup-haskell.outputs.stack-root }}/snapshots | |
key: ${{ matrix.os }}-${{ matrix.ghc }}-${{ hashFiles('stack.yaml', '**/*.cabal', '.github/workflows/ci.yml') }} | |
restore-keys: ${{ matrix.os }}-${{ matrix.ghc }}- | |
# https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/188 | |
# https://github.com/commercialhaskell/stack/issues/4937 | |
# - name: Use system GHC | |
# run: stack config set system-ghc --global true | |
# Retry Stack initialization, see: | |
# https://github.com/commercialhaskell/stack/issues/5770 | |
- name: Initialize Stack | |
shell: bash | |
run: ./.ci/retry.sh stack build base | |
# Building 'happy' sometimes fails on Windows for some obscure reason | |
- name: Build happy with Stack | |
shell: bash | |
run: ./.ci/retry.sh stack build happy | |
# Note: the --pedantic switch adds -Wall -Werror to the options passed to | |
# GHC. Options specified in stack.yaml (like -Wcompat) are still passed; | |
# it is cumulative. Future versions of Stack might add behavior to | |
# --pedantic. | |
- name: Build with Stack | |
run: stack build --pedantic | |
- name: Run Vector testsuite | |
if: github.ref != 'refs/heads/master' | |
run: stack run -- clash-testsuite --hide-successes -p .Vector. --no-ghdl --no-verilator --no-modelsim --no-vivado | |
build_and_test: | |
# Only run for external PRs | |
if: github.event.pull_request.head.repo.full_name != github.repository | |
runs-on: ubuntu-latest | |
name: Build and Test | |
strategy: | |
fail-fast: false | |
matrix: | |
ghc: [ "8.6.5", "9.0.2", "9.6.6" ] | |
include: | |
- multiple_hidden: yes | |
- ghc: 8.6.5 | |
multiple_hidden: no | |
workaround_ghc_mmap_crash: yes | |
- ghc: 9.0.2 | |
workaround_ghc_mmap_crash: yes | |
# Run steps inside the clash CI docker image | |
container: | |
image: ghcr.io/clash-lang/clash-ci:${{ matrix.ghc }}-20241008 | |
env: | |
THREADS: 2 | |
CABAL_JOBS: 2 | |
MULTIPLE_HIDDEN: ${{ matrix.multiple_hidden }} | |
CI_COMMIT_BRANCH: ${{ github.base_ref }} | |
WORKAROUND_GHC_MMAP_CRASH: ${{ matrix.workaround_ghc_mmap_crash }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
ref: ${{ github.event.pull_request.head.ref }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
- name: Setup CI | |
run: | | |
export CABAL_DIR=$HOME/.cabal | |
./.ci/setup.sh | |
cabal v2-freeze | |
# We only want this for caching, and it makes the CI scripts way | |
# more brittle than is ideal. | |
mv cabal.project.freeze frozen | |
- name: Restore Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
dist-newstyle | |
~/.cabal/store | |
key: ${{ matrix.ghc }}-${{ hashFiles('frozen', 'cabal.project') }} | |
restore-keys: ${{ matrix.ghc }}- | |
- name: Build Clash | |
run: | | |
export CABAL_DIR=$HOME/.cabal | |
./.ci/build.sh | |
- name: Unit Tests | |
if: github.ref != 'refs/heads/master' | |
run: | | |
export CABAL_DIR=$HOME/.cabal | |
cabal v2-test clash-prelude | |
cabal v2-test clash-lib | |
cabal v2-test clash-cores | |
cabal v2-test clash-cosim | |
- name: Testsuite (VHDL) | |
if: github.ref != 'refs/heads/master' | |
run: | | |
export CABAL_DIR=$HOME/.cabal | |
cabal v2-run clash-testsuite -- -j$THREADS --hide-successes -p .VHDL --no-vivado | |
- name: Testsuite (Verilog) | |
if: github.ref != 'refs/heads/master' | |
run: | | |
export CABAL_DIR=$HOME/.cabal | |
cabal v2-run clash-testsuite -- -j$THREADS --hide-successes -p .Verilog --no-vivado | |
- name: Testsuite (SystemVerilog) | |
if: github.ref != 'refs/heads/master' | |
run: | | |
export CABAL_DIR=$HOME/.cabal | |
cabal v2-run clash-testsuite -- -j$THREADS --hide-successes -p .SystemVerilog --no-modelsim --no-vivado | |
all: | |
name: All jobs finished | |
if: always() | |
needs: [ | |
build_mac_windows, | |
build_and_test, | |
] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Check dependencies for failures | |
run: | | |
# Test all dependencies for success/failure | |
set -x | |
success="${{ contains(needs.*.result, 'success') }}" | |
fail="${{ contains(needs.*.result, 'failure') }}" | |
set +x | |
# Test whether success/fail variables contain sane values | |
if [[ "${success}" != "true" && "${success}" != "false" ]]; then exit 1; fi | |
if [[ "${fail}" != "true" && "${fail}" != "false" ]]; then exit 1; fi | |
# We want to fail if one or more dependencies fail. For safety, we introduce | |
# a second check: if no dependencies succeeded something weird is going on. | |
if [[ "${fail}" == "true" || "${success}" == "false" ]]; then | |
echo "One or more dependency failed, or no dependency succeeded." | |
exit 1 | |
fi | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install python3-yaml | |
- name: Check that the 'all' job depends on all other jobs | |
run: | | |
.ci/all_check.py |