ci: Introduce artifacts

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.
This commit is contained in:
Krystine Sherwin 2024-02-05 21:48:25 +13:00
parent 1a54e8d47b
commit 69eb39582b
No known key found for this signature in database
2 changed files with 61 additions and 14 deletions

View File

@ -1,6 +1,12 @@
name: Build and run tests (Linux)
on: [push, pull_request]
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
pre_job:
@ -17,7 +23,7 @@ jobs:
# only run on push *or* pull_request, not both
concurrent_skipping: 'same_content_newer'
test-linux:
build-linux:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ${{ matrix.os.id }}
@ -123,25 +129,61 @@ 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 }} CXXSTD=${{ 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: Log yosys-config output
run: |
./yosys-config || true
- 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: compiled-yosys
path: yosys
name: build-artifact
path: build.tar
retention-days: 1
- name: Run tests
if: (matrix.cpp_std == 'c++11') && (matrix.compiler == 'gcc-11')
test-linux:
name: Run tests
needs: build-linux
runs-on: ubuntu-latest
steps:
- name: Install Dependencies
shell: bash
run: |
make -j${{ env.procs }} test CXXSTD=${{ matrix.cpp_std }} CC=$CC CXX=$CC LD=$CC
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: Log yosys-config output
- name: Runtime environment
shell: bash
env:
WORKSPACE: ${{ github.workspace }}
run: |
./yosys-config || true
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 TARGETS= EXTRA_TARGETS=

View File

@ -1,6 +1,12 @@
name: Build and run tests (macOS)
on: [push, pull_request]
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
pre_job:
@ -27,7 +33,6 @@ jobs:
- { id: macos-13, name: 'Ventura' }
cpp_std:
- 'c++11'
- 'c++17'
fail-fast: false
steps:
- name: Install Dependencies