-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: build and test the compiler with GCC 14 (#1400)
## Summary Add a CI workflow for making sure the most recent version of common C compilers work. Only GCC 14 is tested at the moment. ## Details * the in-beta 24.04 Ubuntu runner image is used, since it comes with GCC 14 installed * the compatibility job builds the compiler, tools, and tests with GCC 14 * two test cases that currently fail to compile (due to `-Werror=incompatible-pointer-types`) are split into standalone test files and marked as known issues * the workflow is configured to run for push and PR events (except for in-draft PRs) --------- Co-authored-by: alaviss <leorize+oss@disroot.org>
- Loading branch information
Showing
5 changed files
with
143 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
name: Test C compiler compatibility | ||
on: | ||
push: | ||
branches-ignore: | ||
- devel | ||
# Github Merge Queue temporary branches | ||
- gh-readonly-queue/** | ||
|
||
pull_request: | ||
# Only consider PRs to devel | ||
branches: | ||
- devel | ||
|
||
# Type of events to run CI on | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
- ready_for_review | ||
|
||
merge_group: | ||
# Test all additions to the merge queue | ||
|
||
# Run every script action in bash | ||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
binaries: | ||
name: Build binaries with most recent GCC version | ||
runs-on: ubuntu-24.04 | ||
# Don't run for draft PRs | ||
if: ${{ !github.event.pull_request.draft }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
filter: tree:0 | ||
|
||
- name: Enable annotations | ||
run: echo "::add-matcher::.github/nim-problem-matcher.json" | ||
|
||
- name: Make GCC 14 the default | ||
run: | | ||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 10 | ||
sudo update-alternatives --set gcc /usr/bin/gcc-14 | ||
- name: Build compiler and tools | ||
run: ./koch.py all-strict | ||
|
||
- name: Upload workspace to artifacts | ||
uses: ./.github/actions/upload-compiler | ||
|
||
test: | ||
needs: [binaries] | ||
|
||
strategy: | ||
fail-fast: false | ||
|
||
# Parallelize testing. Refer to ``ci.yml`` for how and why this works. | ||
matrix: | ||
batch: [0, 1] | ||
total_batch: [2] | ||
|
||
name: "Test the compiler and standard library (Batch ${{ matrix.batch }})" | ||
runs-on: ubuntu-24.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
filter: tree:0 | ||
|
||
- uses: ./.github/actions/download-compiler | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libc6-dbg valgrind libpcre3 | ||
- name: Make GCC 14 the default | ||
run: | | ||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 10 | ||
sudo update-alternatives --set gcc /usr/bin/gcc-14 | ||
- name: Run tester | ||
run: ./koch.py test --batch:"$TEST_BATCH" --tryFailing --targets:c all | ||
env: | ||
TEST_BATCH: ${{ matrix.batch }}_${{ matrix.total_batch }} | ||
|
||
- name: Print all test errors | ||
if: failure() | ||
run: bin/nim r tools/ci_testresults | ||
|
||
passed: | ||
name: All C compatibility tests passed | ||
needs: [test] | ||
if: failure() || cancelled() | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- run: exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
tests/lang/s02_core/s02_procedures/t02_argument_passing_bug.nim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
discard """ | ||
description: "A separate test for a bug with varargs handling" | ||
knownIssue: "https://github.com/nim-works/nimskull/issues/1375" | ||
""" | ||
|
||
# XXX: merge back into ``t02_argument_passing`` once the below succeeds | ||
|
||
# right now results in `(@[1, 2, 0], @[true, false, false])` | ||
doAssert impl(1, 2, false) == (@[1, 2], @[false]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
tests/lang_experimental/views/tprocedural_views_in_tuple.nim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
discard """ | ||
description: ''' | ||
Ensure views of procedural values can be stored in and called from tuples | ||
via the bracket syntax | ||
''' | ||
targets: "c js vm" | ||
knownIssue.c vm: ''' | ||
Semantic analysis produces incorrect AST for tuple initialization | ||
''' | ||
""" | ||
|
||
# tracked by https://github.com/nim-works/nimskull/issues/1376 | ||
|
||
# note: the JavaScript target is affected too, but the bug doesn't lead to any | ||
# compile or run-time errors | ||
|
||
{.experimental: "views".} | ||
|
||
type Proc = proc(x: int): int {.nimcall.} | ||
|
||
proc test() = | ||
# wrap the test in a procedure to make sure that local variables are used | ||
let | ||
p = proc (x: int): int = x | ||
tup: (lent Proc,) = (p,) | ||
|
||
doAssert tup[0](2) == 2 | ||
|
||
test() |