Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ on:
pull_request:
workflow_dispatch:

env:
COMMON_CFLAGS: >-
-Wall
-Werror
-Wno-format-security
-Wno-unused-but-set-variable
-Wno-unused-const-variable
-Wno-type-limits
-Wno-uninitialized

jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -28,6 +38,17 @@ jobs:
- name: Run tests
run: zig build test --summary all

# Skip installing package docs to avoid wasting time when installing valgrind
# See: https://github.com/actions/runner-images/issues/10977#issuecomment-2810713336
- name: Skip installing package docs
if: runner.os == 'Linux'
run: |
sudo tee /etc/dpkg/dpkg.cfg.d/01_nodoc > /dev/null << 'EOF'
path-exclude /usr/share/doc/*
path-exclude /usr/share/man/*
path-exclude /usr/share/info/*
EOF

- name: Run valgrind tests
if: runner.os == 'Linux'
run: |
Expand Down Expand Up @@ -150,6 +171,98 @@ jobs:
run: |
bazel run //:example

test-gcc-versions:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: [15, 14, 13, 12, 11, 10, 9]
container:
image: gcc:${{ matrix.version }}
steps:
- uses: actions/checkout@v4

- name: Build example with GCC ${{ matrix.version }}
run: |
gcc -std=c11 -O3 example/main.c dist/core.c \
-I includes/ \
${{ env.COMMON_CFLAGS }} \
-o test-example

- name: Run example
run: ./test-example

test-clang-versions:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: [19, 18, 17, 16, 15, 14, 13]
container:
image: silkeh/clang:${{ matrix.version }}
steps:
- uses: actions/checkout@v4

- name: Build example with Clang ${{ matrix.version }}
run: |
clang -std=c11 -O3 example/main.c dist/core.c \
-I includes/ \
${{ env.COMMON_CFLAGS }} \
-o test-example

- name: Run example
run: ./test-example

cross-compile:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
# Linux targets - x86/x64
- { arch: x86_64-linux-gnu, name: "Linux x86_64 (glibc)" }
- { arch: x86_64-linux-musl, name: "Linux x86_64 (musl)" }
- { arch: x86-linux-gnu, name: "Linux x86 (32-bit)" }

# Linux targets - ARM
- { arch: aarch64-linux-gnu, name: "Linux ARM64 (glibc)" }
- { arch: aarch64-linux-musl, name: "Linux ARM64 (musl)" }
- { arch: arm-linux-gnueabihf, name: "Linux ARM (hard-float)" }
- { arch: arm-linux-gnueabi, name: "Linux ARM (soft-float)" }

# Linux targets - RISC-V
- { arch: riscv64-linux-gnu, name: "Linux RISC-V 64 (glibc)" }
- { arch: riscv64-linux-musl, name: "Linux RISC-V 64 (musl)" }

# Linux targets - Other architectures
- { arch: powerpc64le-linux-gnu, name: "Linux PowerPC64 LE" }
- { arch: s390x-linux-gnu, name: "Linux s390x (IBM Z)" }
- { arch: mips64el-linux-gnuabi64, name: "Linux MIPS64 LE" }
- { arch: loongarch64-linux-gnu, name: "Linux LoongArch64" }

# macOS targets
- { arch: x86_64-macos, name: "macOS x86_64 (Intel)" }
- { arch: aarch64-macos, name: "macOS ARM64 (Apple Silicon)" }

# Windows targets
- { arch: x86_64-windows-gnu, name: "Windows x86_64" }
- { arch: x86-windows-gnu, name: "Windows x86 (32-bit)" }

steps:
- uses: actions/checkout@v4
- uses: mlugg/setup-zig@v2

- name: Compile the example
run: |
zig cc example/main.c dist/core.c \
-I includes/ \
-target ${{ matrix.target.arch }} \
${{ env.COMMON_CFLAGS }} \
-Wno-constant-conversion \
-Wno-incompatible-pointer-types \
-Wno-unused-function \
-o example.out

check:
runs-on: ubuntu-latest
if: always()
Expand All @@ -159,6 +272,9 @@ jobs:
- build
- test-build-cmake
- test-build-bazel
- test-gcc-versions
- test-clang-versions
- cross-compile
steps:
- uses: re-actors/alls-green@release/v1
with:
Expand Down
Loading
Loading