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) name: Build and run tests (Linux)
on: [push, pull_request] on:
pull_request:
branches:
- master
push:
branches:
- master
jobs: jobs:
pre_job: pre_job:
@ -17,7 +23,7 @@ jobs:
# only run on push *or* pull_request, not both # only run on push *or* pull_request, not both
concurrent_skipping: 'same_content_newer' concurrent_skipping: 'same_content_newer'
test-linux: build-linux:
needs: pre_job needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true' if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ${{ matrix.os.id }} runs-on: ${{ matrix.os.id }}
@ -123,25 +129,61 @@ jobs:
make -j${{ env.procs }} make -j${{ env.procs }}
make install make install
- name: Build yosys - name: Build yosys out-of-tree
shell: bash shell: bash
run: | run: |
make config-${CC%%-*} mkdir build
make -j${{ env.procs }} CXXSTD=${{ matrix.cpp_std }} CC=$CC CXX=$CC LD=$CC 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 - name: Store build artifact
if: (matrix.cpp_std == 'c++11') && (matrix.compiler == 'gcc-11') if: (matrix.cpp_std == 'c++11') && (matrix.compiler == 'gcc-11')
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: compiled-yosys name: build-artifact
path: yosys path: build.tar
retention-days: 1
- name: Run tests test-linux:
if: (matrix.cpp_std == 'c++11') && (matrix.compiler == 'gcc-11') name: Run tests
needs: build-linux
runs-on: ubuntu-latest
steps:
- name: Install Dependencies
shell: bash shell: bash
run: | 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: | 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) name: Build and run tests (macOS)
on: [push, pull_request] on:
pull_request:
branches:
- master
push:
branches:
- master
jobs: jobs:
pre_job: pre_job:
@ -27,7 +33,6 @@ jobs:
- { id: macos-13, name: 'Ventura' } - { id: macos-13, name: 'Ventura' }
cpp_std: cpp_std:
- 'c++11' - 'c++11'
- 'c++17'
fail-fast: false fail-fast: false
steps: steps:
- name: Install Dependencies - name: Install Dependencies