ci: more context var use

Also reduce `${{}}` expansion in `run` blocks.
This commit is contained in:
Krystine Sherwin 2024-02-06 12:18:52 +13:00
parent 1ef21efe3f
commit 93bee0fc3b
No known key found for this signature in database
1 changed files with 9 additions and 18 deletions

View File

@ -27,6 +27,9 @@ jobs:
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 }}
env:
CC: ${{ matrix.compiler }}
CXXSTD: ${{ matrix.cpp_std }}
strategy: strategy:
matrix: matrix:
os: os:
@ -63,11 +66,8 @@ jobs:
sudo apt-add-repository ppa:ubuntu-toolchain-r/test sudo apt-add-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update sudo apt-get update
sudo apt-get install $CC $CXX sudo apt-get install $CC $CXX
echo "CC=$CC" >> $GITHUB_ENV
echo "CXX=$CXX" >> $GITHUB_ENV echo "CXX=$CXX" >> $GITHUB_ENV
echo "CXXFLAGS=-Wp,-D_GLIBCXX_ASSERTIONS" >> $GITHUB_ENV echo "CXXFLAGS=-Wp,-D_GLIBCXX_ASSERTIONS" >> $GITHUB_ENV
env:
CC: ${{ matrix.compiler }}
- name: Setup Clang - name: Setup Clang
if: startsWith(matrix.compiler, 'clang') if: startsWith(matrix.compiler, 'clang')
@ -80,18 +80,12 @@ jobs:
sudo apt-get update sudo apt-get update
CXX=${CC/#clang/clang++} CXX=${CC/#clang/clang++}
sudo apt-get install $CC $CXX sudo apt-get install $CC $CXX
echo "CC=$CC" >> $GITHUB_ENV
echo "CXX=$CXX" >> $GITHUB_ENV echo "CXX=$CXX" >> $GITHUB_ENV
env:
CC: ${{ matrix.compiler }}
- name: Runtime environment - name: Runtime environment
shell: bash shell: bash
env:
WORKSPACE: ${{ github.workspace }}
run: | run: |
echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH
echo "$GITHUB_WORKSPACE/.local/bin" >> $GITHUB_PATH
echo "procs=$(nproc)" >> $GITHUB_ENV echo "procs=$(nproc)" >> $GITHUB_ENV
- name: Tool versions - name: Tool versions
@ -111,7 +105,7 @@ jobs:
mkdir build mkdir build
cd build cd build
make -f ../Makefile config-${CC%%-*} make -f ../Makefile config-${CC%%-*}
make -f ../Makefile -j${{ env.procs }} CXXSTD=${{ matrix.cpp_std }} CC=$CC CXX=$CC LD=$CC make -f ../Makefile -j$procs CXXSTD=$CXXSTD CC=$CC CXX=$CC LD=$CC
- name: Log yosys-config output - name: Log yosys-config output
run: | run: |
@ -149,11 +143,8 @@ jobs:
- name: Runtime environment - name: Runtime environment
shell: bash shell: bash
env:
WORKSPACE: ${{ github.workspace }}
run: | run: |
echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH
echo "$GITHUB_WORKSPACE/.local/bin" >> $GITHUB_PATH
echo "procs=$(nproc)" >> $GITHUB_ENV echo "procs=$(nproc)" >> $GITHUB_ENV
- name: Checkout Yosys - name: Checkout Yosys
@ -178,11 +169,11 @@ jobs:
if: steps.cache-iverilog.outputs.cache-hit != 'true' if: steps.cache-iverilog.outputs.cache-hit != 'true'
shell: bash shell: bash
run: | run: |
mkdir -p $GITHUB_WORKSPACE/.local/ mkdir -p ${{ github.workspace }}/.local/
cd iverilog cd iverilog
autoconf autoconf
CC=gcc CXX=g++ ./configure --prefix=$GITHUB_WORKSPACE/.local CC=gcc CXX=g++ ./configure --prefix=${{ github.workspace }}/.local
make -j${{ env.procs }} make -j$procs
make install make install
- name: Download build artifact - name: Download build artifact