2024-02-14 15:00:58 -06:00
|
|
|
name: Compiler testing
|
|
|
|
|
2024-04-25 01:37:44 -05:00
|
|
|
on: [push, pull_request]
|
2024-02-14 15:00:58 -06:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
pre_job:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
should_skip: ${{ steps.skip_check.outputs.should_skip }}
|
|
|
|
steps:
|
|
|
|
- id: skip_check
|
|
|
|
uses: fkirc/skip-duplicate-actions@v5
|
|
|
|
with:
|
|
|
|
paths_ignore: '["**/README.md", "docs/**", "guidelines/**"]'
|
|
|
|
# cancel previous builds if a new commit is pushed
|
|
|
|
cancel_others: 'true'
|
|
|
|
# only run on push *or* pull_request, not both
|
|
|
|
concurrent_skipping: 'same_content_newer'
|
|
|
|
|
|
|
|
test-compile:
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
needs: pre_job
|
|
|
|
if: needs.pre_job.outputs.should_skip != 'true'
|
|
|
|
env:
|
2024-03-03 16:37:25 -06:00
|
|
|
CXXFLAGS: ${{ startsWith(matrix.compiler, 'gcc') && '-Wp,-D_GLIBCXX_ASSERTIONS' || ''}}
|
2024-03-03 17:00:51 -06:00
|
|
|
CC_SHORT: ${{ startsWith(matrix.compiler, 'gcc') && 'gcc' || 'clang' }}
|
2024-02-14 15:00:58 -06:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os:
|
2024-04-29 18:11:46 -05:00
|
|
|
- ubuntu-latest
|
2024-02-14 15:00:58 -06:00
|
|
|
compiler:
|
2024-04-29 18:11:46 -05:00
|
|
|
# oldest supported
|
|
|
|
- 'clang-14'
|
|
|
|
- 'gcc-10'
|
2024-11-25 15:18:09 -06:00
|
|
|
# newest, make sure to update maximum standard step to match
|
2024-11-25 14:59:52 -06:00
|
|
|
- 'clang-18'
|
2024-11-25 15:18:09 -06:00
|
|
|
- 'gcc-13'
|
2024-02-14 15:00:58 -06:00
|
|
|
include:
|
2024-04-29 18:11:46 -05:00
|
|
|
# macOS
|
2024-02-14 15:00:58 -06:00
|
|
|
- os: macos-13
|
|
|
|
compiler: 'clang'
|
2024-04-29 18:11:46 -05:00
|
|
|
# oldest clang not available on ubuntu-latest
|
2024-08-14 16:34:23 -05:00
|
|
|
- os: ubuntu-20.04
|
|
|
|
compiler: 'clang-10'
|
2024-02-14 15:00:58 -06:00
|
|
|
fail-fast: false
|
|
|
|
steps:
|
2024-03-03 18:12:45 -06:00
|
|
|
- name: Checkout Yosys
|
|
|
|
uses: actions/checkout@v4
|
2024-05-09 17:15:03 -05:00
|
|
|
with:
|
|
|
|
submodules: true
|
2024-03-03 18:12:45 -06:00
|
|
|
|
2024-03-03 18:10:50 -06:00
|
|
|
- name: Setup environment
|
|
|
|
uses: ./.github/actions/setup-build-env
|
2024-02-14 15:00:58 -06:00
|
|
|
|
2024-03-03 16:37:25 -06:00
|
|
|
- name: Setup Cpp
|
|
|
|
uses: aminya/setup-cpp@v1
|
|
|
|
with:
|
|
|
|
compiler: ${{ matrix.compiler }}
|
2024-02-14 15:00:58 -06:00
|
|
|
|
|
|
|
- name: Tool versions
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
$CC --version
|
|
|
|
$CXX --version
|
|
|
|
|
2024-04-29 18:11:46 -05:00
|
|
|
# minimum standard
|
2024-06-17 09:55:36 -05:00
|
|
|
- name: Build C++17
|
2024-02-14 15:00:58 -06:00
|
|
|
shell: bash
|
|
|
|
run: |
|
2024-03-03 17:00:51 -06:00
|
|
|
make config-$CC_SHORT
|
2024-06-17 09:55:36 -05:00
|
|
|
make -j$procs CXXSTD=c++17 compile-only
|
2024-02-14 15:00:58 -06:00
|
|
|
|
2024-04-29 18:11:46 -05:00
|
|
|
# maximum standard, only on newest compilers
|
|
|
|
- name: Build C++20
|
2024-11-25 15:18:09 -06:00
|
|
|
if: ${{ matrix.compiler == 'clang-18' || matrix.compiler == 'gcc-13' }}
|
2024-04-29 18:11:46 -05:00
|
|
|
shell: bash
|
2024-02-14 15:00:58 -06:00
|
|
|
run: |
|
2024-04-29 18:11:46 -05:00
|
|
|
make config-$CC_SHORT
|
|
|
|
make -j$procs CXXSTD=c++20 compile-only
|