From 208f1504fbee321c059ad2b55271ab4f0757021a Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Sun, 13 Jun 2021 20:38:24 +0100 Subject: [PATCH] CI: Add -m32 build --- .github/workflows/build.yml | 72 +++++++++++++++++------------------- .github/workflows/format.yml | 1 + ci/ci-install.bash | 10 ++++- ci/ci-script.bash | 10 ++++- 4 files changed, 51 insertions(+), 42 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6426f4bd3..2575fb44f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,43 +25,34 @@ defaults: jobs: - - Matrix: - runs-on: ubuntu-latest - name: Generate Build matrix - outputs: - matrix: ${{ steps.generate.outputs.matrix }} - steps: - - id: generate - working-directory: ${{ github.workspace }} - run: | - if [ '${{ github.event_name }}' = 'pull_request' ]; then - matrix='[ "ubuntu-20.04" ]' - else - matrix='[ "ubuntu-20.04", "ubuntu-18.04", "ubuntu-16.04" ]' - fi - echo "::set-output name=matrix::$matrix" - - - Build: - needs: Matrix + build: strategy: fail-fast: false matrix: - os: ${{ fromJson(needs.Matrix.outputs.matrix) }} + os: [ubuntu-20.04, ubuntu-18.04, ubuntu-16.04] compiler: - { cc: clang, cxx: clang++ } - { cc: gcc, cxx: g++ } + m32: [0, 1] + exclude: + # Build pull requests only with ubuntu-20.04 and without m32 + - os: ${{ github.event_name == 'pull_request' && 'ubuntu-18.04' || 'do-not-exclude' }} + - os: ${{ github.event_name == 'pull_request' && 'ubuntu-16.04' || 'do-not-exclude' }} + - m32: ${{ github.event_name == 'pull_request' && 1 || 'do-not-exclude' }} + # Build -m32 only on ubuntu-20.04 + - {os: ubuntu-18.04, m32: 1} + - {os: ubuntu-16.04, m32: 1} runs-on: ${{ matrix.os }} - name: Build | ${{ matrix.os }} | ${{ matrix.compiler.cc }} + name: Build | ${{ matrix.os }} | ${{ matrix.compiler.cc }} ${{ matrix.m32 && '| -m32' || '' }} env: CI_BUILD_STAGE_NAME: build CI_RUNS_ON: ${{ matrix.os }} + CI_M32: ${{ matrix.m32 }} CC: ${{ matrix.compiler.cc }} CXX: ${{ matrix.compiler.cxx }} - CACHE_BASE_KEY: build-${{ matrix.os }}-${{ matrix.compiler.cc }} - CCACHE_MAXSIZE: 250M # Per build matrix entry (1500M in total) - VERILATOR_ARCHIVE: verilator-${{ github.sha }}-${{ matrix.os }}-${{ matrix.compiler.cc }}.tar.gz + CACHE_BASE_KEY: build-${{ matrix.os }}-${{ matrix.compiler.cc }}-m32=${{ matrix.m32 }} + CCACHE_MAXSIZE: 250M # Per build matrix entry (2000M in total) + VERILATOR_ARCHIVE: verilator-${{ github.sha }}-${{ matrix.os }}-${{ matrix.compiler.cc }}${{ matrix.m32 && '-m32' || '' }}.tar.gz steps: - name: Checkout @@ -96,31 +87,36 @@ jobs: name: ${{ env.VERILATOR_ARCHIVE }} - Test: - needs: [ Matrix, Build ] + test: + needs: build strategy: fail-fast: false matrix: - os: ${{ fromJson(needs.Matrix.outputs.matrix) }} + os: [ubuntu-20.04, ubuntu-18.04, ubuntu-16.04] compiler: - { cc: clang, cxx: clang++ } - { cc: gcc, cxx: g++ } - suite: - - dist-vlt-0 - - dist-vlt-1 - - dist-vlt-2 - - vltmt-0 - - vltmt-1 + m32: [0, 1] + suite: [dist-vlt-0, dist-vlt-1, dist-vlt-2, vltmt-0, vltmt-1] + exclude: + # Build pull requests only with ubuntu-20.04 and without m32 + - os: ${{ github.event_name == 'pull_request' && 'ubuntu-18.04' || 'do-not-exclude' }} + - os: ${{ github.event_name == 'pull_request' && 'ubuntu-16.04' || 'do-not-exclude' }} + - m32: ${{ github.event_name == 'pull_request' && 1 || 'do-not-exclude' }} + # Build -m32 only on ubuntu-20.04 + - {os: ubuntu-18.04, m32: 1} + - {os: ubuntu-16.04, m32: 1} runs-on: ${{ matrix.os }} - name: Test | ${{ matrix.os }} | ${{ matrix.compiler.cc }} | ${{ matrix.suite }} + name: Test | ${{ matrix.os }} | ${{ matrix.compiler.cc }} | ${{ matrix.suite }} ${{ matrix.m32 && '| -m32' || '' }} env: CI_BUILD_STAGE_NAME: test CI_RUNS_ON: ${{ matrix.os }} + CI_M32: ${{ matrix.m32 }} CC: ${{ matrix.compiler.cc }} CXX: ${{ matrix.compiler.cxx }} - CACHE_BASE_KEY: test-${{ matrix.os }}-${{ matrix.compiler.cc }}-${{ matrix.suite }} - CCACHE_MAXSIZE: 64M # Per build matrix entry (1920M in total) - VERILATOR_ARCHIVE: verilator-${{ github.sha }}-${{ matrix.os }}-${{ matrix.compiler.cc }}.tar.gz + CACHE_BASE_KEY: test-${{ matrix.os }}-${{ matrix.compiler.cc }}-m32=${{ matrix.m32 }}-${ matrix.suite }} + CCACHE_MAXSIZE: 64M # Per build matrix entry (2160M in total) + VERILATOR_ARCHIVE: verilator-${{ github.sha }}-${{ matrix.os }}-${{ matrix.compiler.cc }}${{ matrix.m32 && '-m32' || '' }}.tar.gz steps: - name: Download tar archive diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 6d6d68887..7e670e2ce 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -16,6 +16,7 @@ jobs: CI_OS_NAME: linux CI_RUNS_ON: ubuntu-20.04 CI_COMMIT: ${{ github.sha }} + CI_M32: 0 steps: - name: Checkout uses: actions/checkout@v2 diff --git a/ci/ci-install.bash b/ci/ci-install.bash index 6b4e517ff..c13328d0e 100755 --- a/ci/ci-install.bash +++ b/ci/ci-install.bash @@ -23,6 +23,12 @@ fatal() { echo "ERROR: $(basename "$0"): $1" >&2; exit 1; } +if [ "$CI_M32" = "0" ]; then + unset CI_M32 +elif [ "$CI_M32" != "1" ]; then + fatal "\$CI_M32 must be '0' or '1'"; +fi + if [ "$CI_OS_NAME" = "linux" ]; then MAKE=make elif [ "$CI_OS_NAME" = "osx" ]; then @@ -55,7 +61,7 @@ if [ "$CI_BUILD_STAGE_NAME" = "build" ]; then if [ "$COVERAGE" = 1 ]; then yes yes | sudo cpan -fi Parallel::Forker fi - if [ "$M32" = 1 ]; then + if [ "$CI_M32" = 1 ]; then sudo apt-get install gcc-multilib g++-multilib fi elif [ "$CI_OS_NAME" = "osx" ]; then @@ -82,7 +88,7 @@ elif [ "$CI_BUILD_STAGE_NAME" = "test" ]; then if [ "$CI_RUNS_ON" = "ubuntu-20.04" ]; then sudo apt-get install libsystemc-dev fi - if [ "$M32" = 1 ]; then + if [ "$CI_M32" = 1 ]; then sudo apt-get install lib32z1-dev gcc-multilib g++-multilib fi elif [ "$CI_OS_NAME" = "osx" ]; then diff --git a/ci/ci-script.bash b/ci/ci-script.bash index 6ff282a78..6ffcda655 100755 --- a/ci/ci-script.bash +++ b/ci/ci-script.bash @@ -21,6 +21,12 @@ fatal() { echo "ERROR: $(basename "$0"): $1" >&2; exit 1; } +if [ "$CI_M32" = "0" ]; then + unset CI_M32 +elif [ "$CI_M32" != "1" ]; then + fatal "\$CI_M32 must be '0' or '1'"; +fi + if [ "$CI_OS_NAME" = "linux" ]; then export MAKE=make NPROC=$(nproc) @@ -40,7 +46,7 @@ if [ "$CI_BUILD_STAGE_NAME" = "build" ]; then if [ "$COVERAGE" != 1 ]; then autoconf - ./configure --enable-longtests --enable-ccwarn + ./configure --enable-longtests --enable-ccwarn ${CI_M32:+--enable-m32} ccache -z "$MAKE" -j "$NPROC" -k ccache -s @@ -82,7 +88,7 @@ elif [ "$CI_BUILD_STAGE_NAME" = "test" ]; then fi # Run sanitize on Ubuntu 20.04 only - [ "$CI_RUNS_ON" = 'ubuntu-20.04' ] && sanitize='--sanitize' || sanitize='' + [ "$CI_RUNS_ON" = 'ubuntu-20.04' ] && [ "$CI_M32" = "" ] && sanitize='--sanitize' || sanitize='' # Run the specified test ccache -z