Skip to content

Commit

Permalink
ci: Introduce artifacts
Browse files Browse the repository at this point in the history
Separates `test-linux` into `build-linux` and `test-linux`, wherein `build-` builds out of tree, and uploading the build for the `test-` job.
Tar compression is done to retain execution permissions when downloading build artifact.
When calling `make test`, override `TARGETS` and `EXTRA_TARGETS` to prevent rebuild.
  • Loading branch information
KrystalDelusion committed Feb 5, 2024
1 parent f5420d7 commit 775dc93
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 20 deletions.
74 changes: 56 additions & 18 deletions .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
name: Build and run tests (Linux)

on: [push, pull_request]
on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
test-linux:
build-linux:
runs-on: ${{ matrix.os.id }}
strategy:
matrix:
Expand All @@ -14,17 +20,6 @@ jobs:
- 'gcc-11'
cpp_std:
- 'c++11'
- 'c++14'
- 'c++17'
- 'c++20'
include:
# Limit the older compilers to C++11 mode
- os: { id: ubuntu-20.04, name: focal }
compiler: 'clang-11'
cpp_std: 'c++11'
- os: { id: ubuntu-20.04, name: focal }
compiler: 'gcc-10'
cpp_std: 'c++11'
fail-fast: false
steps:
- name: Install Dependencies
Expand Down Expand Up @@ -107,14 +102,57 @@ jobs:
make -j${{ env.procs }}
make install
- name: Build yosys
- name: Build yosys out-of-tree
shell: bash
run: |
make config-${CC%%-*}
make -j${{ env.procs }} CCXXSTD=${{ matrix.cpp_std }} CC=$CC CXX=$CC LD=$CC
mkdir build
cd build
make -f ../Makefile config-${CC%%-*}
make -f ../Makefile -j${{ env.procs }} CXXSTD=${{ matrix.cpp_std }} CC=$CC CXX=$CC LD=$CC
- name: Run tests
- name: Compress build
shell: bash
run: |
cd build
tar -cvf ../build.tar Makefile.conf share/ yosys yosys-*
- name: Store build artifact
if: (matrix.cpp_std == 'c++11') && (matrix.compiler == 'gcc-11')
uses: actions/upload-artifact@v4
with:
name: build-artifact
path: build.tar
retention-days: 1

test-linux:
name: Run tests
needs: build-linux
runs-on: ubuntu-latest
steps:
- name: Install Dependencies
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 python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev
- name: Runtime environment
shell: bash
env:
WORKSPACE: ${{ github.workspace }}
run: |
echo "procs=$(nproc)" >> $GITHUB_ENV
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: build-artifact

- name: Uncompress build
shell: bash
run:
tar -xvf build.tar

- name: Run tests
shell: bash
run: |
make -j${{ env.procs }} test CXXSTD=${{ matrix.cpp_std }} CC=$CC CXX=$CC LD=$CC
make -j${{ env.procs }} test TARGETS= EXTRA_TARGETS=
9 changes: 7 additions & 2 deletions .github/workflows/test-macos.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Build and run tests (macOS)

on: [push, pull_request]
on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
test-macos:
Expand All @@ -11,7 +17,6 @@ jobs:
- { id: macos-13, name: 'Ventura' }
cpp_std:
- 'c++11'
- 'c++17'
fail-fast: false
steps:
- name: Install Dependencies
Expand Down

0 comments on commit 775dc93

Please sign in to comment.