Skip to content

Commit b2ee761

Browse files
ci: Unify test-*.yml
Also rename `build-artifact` to use `matrix.os` for compatibility with testing across OS.
1 parent 256994b commit b2ee761

File tree

2 files changed

+36
-94
lines changed

2 files changed

+36
-94
lines changed

.github/workflows/test-linux.yml .github/workflows/test-build.yml

+36-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and run tests (Linux)
1+
name: Build and run tests
22

33
on:
44
pull_request:
@@ -9,18 +9,18 @@ on:
99
- master
1010

1111
jobs:
12-
build-linux:
13-
runs-on: ${{ matrix.os.id }}
12+
build-yosys:
13+
runs-on: ${{ matrix.os }}
1414
env:
1515
CC: ${{ matrix.compiler }}
1616
CXX: ${{ matrix.compiler }}
1717
CXXSTD: ${{ matrix.cpp_std }}
1818
strategy:
1919
matrix:
2020
os:
21-
- { id: ubuntu-20.04, name: focal }
21+
- ubuntu-20.04
22+
- macos-13
2223
compiler:
23-
- 'clang'
2424
- 'clang-12'
2525
- 'gcc-11'
2626
cpp_std:
@@ -29,21 +29,34 @@ jobs:
2929
- 'c++17'
3030
- 'c++20'
3131
include:
32-
# Limit the older compilers to C++11 mode
33-
- os: { id: ubuntu-20.04, name: focal }
32+
# Build for testing
33+
- os: ubuntu-20.04
34+
compiler: 'clang'
35+
cpp_std: 'c++11'
36+
# Limited testing for older compilers
37+
- os: ubuntu-20.04
3438
compiler: 'clang-11'
3539
cpp_std: 'c++11'
36-
- os: { id: ubuntu-20.04, name: focal }
40+
- os: ubuntu-20.04
3741
compiler: 'gcc-10'
3842
cpp_std: 'c++11'
43+
# Add os_name
44+
- os: ubuntu-20.04
45+
os_name: focal
3946
fail-fast: false
4047
steps:
41-
- name: Install Dependencies
48+
- name: Install Linux Dependencies
49+
if: runner.os == 'Linux'
4250
shell: bash
4351
run: |
4452
sudo apt-get update
4553
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
4654
55+
- name: Install macOS Dependencies
56+
if: runner.os == 'macOS'
57+
run: |
58+
brew install bison flex gawk libffi pkg-config bash
59+
4760
- name: Setup GCC
4861
if: startsWith(matrix.compiler, 'gcc')
4962
shell: bash
@@ -62,18 +75,28 @@ jobs:
6275
wget https://apt.llvm.org/llvm-snapshot.gpg.key
6376
sudo apt-key add llvm-snapshot.gpg.key
6477
rm llvm-snapshot.gpg.key
65-
sudo apt-add-repository "deb https://apt.llvm.org/${{ matrix.os.name }}/ llvm-toolchain-${{ matrix.os.name }} main"
78+
sudo apt-add-repository "deb https://apt.llvm.org/${{ matrix.os_name }}/ llvm-toolchain-${{ matrix.os_name }} main"
6679
sudo apt-get update
6780
CXX=${CC/#clang/clang++}
6881
sudo apt-get install $CC $CXX
6982
echo "CXX=$CXX" >> $GITHUB_ENV
7083
71-
- name: Runtime environment
84+
- name: Linux runtime environment
85+
if: runner.os == 'Linux'
7286
shell: bash
7387
run: |
7488
echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH
7589
echo "procs=$(nproc)" >> $GITHUB_ENV
7690
91+
- name: macOS runtime environment
92+
if: runner.os == 'macOS'
93+
shell: bash
94+
run: |
95+
echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH
96+
echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH
97+
echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH
98+
echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
99+
77100
- name: Tool versions
78101
shell: bash
79102
run: |
@@ -101,7 +124,7 @@ jobs:
101124
if: (matrix.cpp_std == 'c++11') && (matrix.compiler == 'clang')
102125
uses: actions/upload-artifact@v4
103126
with:
104-
name: build-artifact
127+
name: build-${{ matrix.os }}
105128
path: build.tar
106129
retention-days: 1
107130

@@ -159,7 +182,7 @@ jobs:
159182
- name: Download build artifact
160183
uses: actions/download-artifact@v4
161184
with:
162-
name: build-artifact
185+
name: build-${{ matrix.os }}
163186

164187
- name: Uncompress build
165188
shell: bash

.github/workflows/test-macos.yml

-81
This file was deleted.

0 commit comments

Comments
 (0)