verilator/.github/workflows/build.yml

170 lines
5.8 KiB
YAML
Raw Normal View History

2020-12-04 22:11:00 +00:00
# DESCRIPTION: Github actions config
# This name is key to badges in README.rst, so we use the name build
2020-12-10 02:10:34 +00:00
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
2020-12-04 22:39:53 +00:00
2020-12-04 22:11:00 +00:00
name: build
2020-12-10 01:30:18 +00:00
on:
2020-12-04 22:11:00 +00:00
push:
pull_request:
2020-12-10 01:30:18 +00:00
workflow_dispatch:
2020-12-04 22:11:00 +00:00
schedule:
2020-12-04 22:39:53 +00:00
- cron: '0 0 * * 0' # weekly
env:
CI_OS_NAME: linux
CI_COMMIT: ${{ github.sha }}
CCACHE_COMPRESS: 1
CCACHE_DIR: ${{ github.workspace }}/.ccache
2021-06-13 00:25:10 +00:00
CCACHE_LIMIT_MULTIPLE: 0.95
defaults:
run:
shell: bash
working-directory: repo
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
2020-12-10 17:33:26 +00:00
2021-06-13 19:38:24 +00:00
build:
strategy:
fail-fast: false
matrix:
2023-01-05 12:25:34 +00:00
os: [ubuntu-22.04, ubuntu-20.04]
compiler:
2020-12-10 17:33:26 +00:00
- { cc: clang, cxx: clang++ }
- { cc: gcc, cxx: g++ }
2023-09-25 15:28:44 +00:00
# m32 1 is deprecated, not here to speed up regressions
m32: [0]
2021-06-13 19:38:24 +00:00
exclude:
# Build pull requests only with ubuntu-22.04 and without m32
2023-06-23 11:08:04 +00:00
# - os: ${{ github.event_name == 'pull_request' && 'ubuntu-18.04' || 'do-not-exclude' }}
# - os: ${{ github.event_name == 'pull_request' && 'ubuntu-20.04' || 'do-not-exclude' }}
# - m32: ${{ github.event_name == 'pull_request' && 1 || 'do-not-exclude' }}
2023-05-24 02:24:47 +00:00
# Build -m32 only on ubuntu-22.04 clang++
2021-06-13 19:38:24 +00:00
- {os: ubuntu-18.04, m32: 1}
- {os: ubuntu-20.04, m32: 1}
2023-05-24 02:35:07 +00:00
- compiler: { cc: gcc, cxx: g++ }
2023-05-24 02:34:27 +00:00
m32: 1
include:
# Build GCC 10 on ubuntu-20.04
- os: ubuntu-20.04
compiler: { cc: gcc-10, cxx: g++-10 }
m32: 0
runs-on: ${{ matrix.os }}
2021-06-13 19:38:24 +00:00
name: Build | ${{ matrix.os }} | ${{ matrix.compiler.cc }} ${{ matrix.m32 && '| -m32' || '' }}
2020-12-04 22:39:53 +00:00
env:
CI_BUILD_STAGE_NAME: build
CI_RUNS_ON: ${{ matrix.os }}
2021-06-13 19:38:24 +00:00
CI_M32: ${{ matrix.m32 }}
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
2021-06-13 19:38:24 +00:00
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
2020-12-04 22:39:53 +00:00
steps:
2020-12-10 17:33:26 +00:00
- name: Checkout
2022-10-20 23:57:50 +00:00
uses: actions/checkout@v3
with:
path: repo
- name: Cache $CCACHE_DIR
uses: actions/cache@v3
env:
CACHE_KEY: ${{ env.CACHE_BASE_KEY }}-ccache
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ env.CACHE_KEY }}-${{ github.sha }}
restore-keys: |
${{ env.CACHE_KEY }}-
- name: Install packages for build
run: ./ci/ci-install.bash
- name: Build
run: ./ci/ci-script.bash
- name: Tar up repository
working-directory: ${{ github.workspace }}
run: tar --posix -c -z -f ${{ env.VERILATOR_ARCHIVE }} repo
- name: Upload tar archive
uses: actions/upload-artifact@v3
with:
path: ${{ github.workspace }}/${{ env.VERILATOR_ARCHIVE }}
name: ${{ env.VERILATOR_ARCHIVE }}
2021-06-13 19:38:24 +00:00
test:
needs: build
strategy:
fail-fast: false
matrix:
2023-01-05 12:25:34 +00:00
os: [ubuntu-22.04, ubuntu-20.04]
compiler:
- { cc: clang, cxx: clang++ }
- { cc: gcc, cxx: g++ }
2023-09-25 16:30:25 +00:00
m32: [0]
2021-06-13 19:38:24 +00:00
suite: [dist-vlt-0, dist-vlt-1, dist-vlt-2, vltmt-0, vltmt-1]
exclude:
# Build pull requests only with ubuntu-22.04 and without m32
2023-06-23 11:08:04 +00:00
# - os: ${{ github.event_name == 'pull_request' && 'ubuntu-18.04' || 'do-not-exclude' }}
# - os: ${{ github.event_name == 'pull_request' && 'ubuntu-20.04' || 'do-not-exclude' }}
# - m32: ${{ github.event_name == 'pull_request' && 1 || 'do-not-exclude' }}
# Build -m32 only on ubuntu-22.04
2021-06-13 19:38:24 +00:00
- {os: ubuntu-18.04, m32: 1}
- {os: ubuntu-20.04, m32: 1}
2023-05-24 03:04:24 +00:00
- compiler: { cc: gcc, cxx: g++ }
m32: 1
include:
# Test with GCC 10 on ubuntu-20.04 without m32
- {os: ubuntu-20.04, compiler: { cc: gcc-10, cxx: g++-10 }, m32: 0, suite: dist-vlt-0}
- {os: ubuntu-20.04, compiler: { cc: gcc-10, cxx: g++-10 }, m32: 0, suite: dist-vlt-1}
- {os: ubuntu-20.04, compiler: { cc: gcc-10, cxx: g++-10 }, m32: 0, suite: dist-vlt-2}
- {os: ubuntu-20.04, compiler: { cc: gcc-10, cxx: g++-10 }, m32: 0, suite: vltmt-0}
- {os: ubuntu-20.04, compiler: { cc: gcc-10, cxx: g++-10 }, m32: 0, suite: vltmt-1}
runs-on: ${{ matrix.os }}
2021-06-13 19:38:24 +00:00
name: Test | ${{ matrix.os }} | ${{ matrix.compiler.cc }} | ${{ matrix.suite }} ${{ matrix.m32 && '| -m32' || '' }}
env:
CI_BUILD_STAGE_NAME: test
CI_RUNS_ON: ${{ matrix.os }}
2021-06-13 19:38:24 +00:00
CI_M32: ${{ matrix.m32 }}
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
2022-05-30 17:35:46 +00:00
CACHE_BASE_KEY: test-${{ matrix.os }}-${{ matrix.compiler.cc }}-m32=${{ matrix.m32 }}-${{ matrix.suite }}
2021-06-13 19:38:24 +00:00
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
uses: actions/download-artifact@v3
with:
name: ${{ env.VERILATOR_ARCHIVE }}
path: ${{ github.workspace }}
- name: Unpack tar archive
working-directory: ${{ github.workspace }}
run: tar -x -z -f ${{ env.VERILATOR_ARCHIVE }}
- name: Cache $CCACHE_DIR
uses: actions/cache@v3
env:
CACHE_KEY: ${{ env.CACHE_BASE_KEY }}-ccache
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ env.CACHE_KEY }}-${{ github.sha }}
restore-keys: |
${{ env.CACHE_KEY }}-
- name: Install test dependencies
run: ./ci/ci-install.bash
- name: Test
env:
TESTS: ${{ matrix.suite }}
run: ./ci/ci-script.bash