Skip to content

Commit

Permalink
ci: Unify test-*.yml
Browse files Browse the repository at this point in the history
Also rename `build-artifact` to use `matrix.os` for compatibility with testing across OS.
  • Loading branch information
KrystalDelusion committed Feb 6, 2024
1 parent 256994b commit b2ee761
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 94 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and run tests (Linux)
name: Build and run tests

on:
pull_request:
Expand All @@ -9,18 +9,18 @@ on:
- master

jobs:
build-linux:
runs-on: ${{ matrix.os.id }}
build-yosys:
runs-on: ${{ matrix.os }}
env:
CC: ${{ matrix.compiler }}
CXX: ${{ matrix.compiler }}
CXXSTD: ${{ matrix.cpp_std }}
strategy:
matrix:
os:
- { id: ubuntu-20.04, name: focal }
- ubuntu-20.04
- macos-13
compiler:
- 'clang'
- 'clang-12'
- 'gcc-11'
cpp_std:
Expand All @@ -29,21 +29,34 @@ jobs:
- 'c++17'
- 'c++20'
include:
# Limit the older compilers to C++11 mode
- os: { id: ubuntu-20.04, name: focal }
# Build for testing
- os: ubuntu-20.04
compiler: 'clang'
cpp_std: 'c++11'
# Limited testing for older compilers
- os: ubuntu-20.04
compiler: 'clang-11'
cpp_std: 'c++11'
- os: { id: ubuntu-20.04, name: focal }
- os: ubuntu-20.04
compiler: 'gcc-10'
cpp_std: 'c++11'
# Add os_name
- os: ubuntu-20.04
os_name: focal
fail-fast: false
steps:
- name: Install Dependencies
- name: Install Linux Dependencies
if: runner.os == 'Linux'
shell: bash
run: |
sudo apt-get update
sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev
- name: Install macOS Dependencies
if: runner.os == 'macOS'
run: |
brew install bison flex gawk libffi pkg-config bash
- name: Setup GCC
if: startsWith(matrix.compiler, 'gcc')
shell: bash
Expand All @@ -62,18 +75,28 @@ jobs:
wget https://apt.llvm.org/llvm-snapshot.gpg.key
sudo apt-key add llvm-snapshot.gpg.key
rm llvm-snapshot.gpg.key
sudo apt-add-repository "deb https://apt.llvm.org/${{ matrix.os.name }}/ llvm-toolchain-${{ matrix.os.name }} main"
sudo apt-add-repository "deb https://apt.llvm.org/${{ matrix.os_name }}/ llvm-toolchain-${{ matrix.os_name }} main"
sudo apt-get update
CXX=${CC/#clang/clang++}
sudo apt-get install $CC $CXX
echo "CXX=$CXX" >> $GITHUB_ENV
- name: Runtime environment
- name: Linux runtime environment
if: runner.os == 'Linux'
shell: bash
run: |
echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH
echo "procs=$(nproc)" >> $GITHUB_ENV
- name: macOS runtime environment
if: runner.os == 'macOS'
shell: bash
run: |
echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH
echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH
echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH
echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
- name: Tool versions
shell: bash
run: |
Expand Down Expand Up @@ -101,7 +124,7 @@ jobs:
if: (matrix.cpp_std == 'c++11') && (matrix.compiler == 'clang')
uses: actions/upload-artifact@v4
with:
name: build-artifact
name: build-${{ matrix.os }}
path: build.tar
retention-days: 1

Expand Down Expand Up @@ -159,7 +182,7 @@ jobs:
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: build-artifact
name: build-${{ matrix.os }}

- name: Uncompress build
shell: bash
Expand Down
81 changes: 0 additions & 81 deletions .github/workflows/test-macos.yml

This file was deleted.

0 comments on commit b2ee761

Please sign in to comment.