mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
* netbsd fail on error
- Group each BSD test in its own subshell. Without this, if an error
occurs, it exits, but we don't know "where" it failed
- added *usesh: true* to BSD for faster copying into the virtualbox VM
- Some test_suite_runners wheren't correctly printing. added
--no-terminal
- For testing I've changed *build-msvc* from Debug to RelWithDebInfo
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* separate runs
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* fix typo
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* Split msvc-debug into separate workflow
Run msvc-debug only on maintainer pushes, keep CI fast and still catches
errors.
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* Fix build and test errors on NetBSD
* Set proper sizes for various types used for threads
* Add num_cpu function
* Add sysctl constants
* Allow testproject to build on NetBSD
* Tweaks to the linker code so that it adds correct flags and finds dynamic linker on NetBSD
* bsd: force system linker test
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* system linker on openbsd
remove lld from netbsd
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* use cc linker in openbsd, and re-add lld for netbsd
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* openbsd: fixes
- implement num_cpu() for OPENBSD
- testproject: add openbsd
- linker.c: fix for openbsd
- bsd refactor main.yml and more fixes
* openbsd: fix for unit tests and test_suite_runner
openbsd now passes all tests except the 'dynlib-test' which yields
'relocation error' when running `cc test.c -L. -ladd -Wl,-rpath=.`
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* openbsd: guard/disable unit test test_ct_intlog2()
* build-msys2-clang: add all tests that build-msvc has
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* Fix Windows import library generation by adding /IMPLIB support and properly declaring static_lib_name()
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* build-msys2-mingw: add all tests that build-msvc has and enable it
configure CMake to link LLVM and LLD statically
* Revert "Revert windows"
This reverts commit 197f82d829.
* win-llvm 21.1.8
uses the RelWithDebInfo+Assertions
* refactor(CI): Centralize test logic and fix Docker execution
This commit refactors the GitHub Actions workflow to improve
maintainability and correct a flaw in the Docker build.
- Ensures Docker based tests run *inside* the generated container, not
on the host. This also fixes environment isolation and user permission
errors.
- Centralizes all common test steps (examples, libs, unit tests, etc)
into a single, auto-detecting Bash script: `scripts/tools/ci_tests.sh`.
- Centralize all release artifact packaging into a single
`scripts/tools/package_build.sh`
- fixes using correct paths for test_suite_runner when running on
windows under bash.
- This significantly reduces YAML duplication, making `main.yml` more
readable and easier to maintain.
This one supersedes pull/2677, and includes the fixes for:
- fix openbsd and netbsd
- added win-llvm 21.1.8 and fixed CMakeLists.txt
- added full unit-tests and suite for build-msys2-mingw and
build-msys2-clang
* macos: add/fix build for llvm (19,20,21)
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* ci: run tests in temp dir to avoid workspace pollution
Executes ci_tests.sh in a disposable temporary directory by copying
resources/ and test/ folders, preventing build artifacts from cluttering
the source tree.
This makes it easy to run `scripts/tools/ci_tests.sh` locally on any
platform.
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* add ilammy/msvc-dev-cmd@ and Ninja
we can simplify the windows runner and run everything in bash
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* windows: drain subprocess stderr before join to avoid test_suite_runner hang
* move last test to `ci_tests.sh`
thus completing the centralization of tests in `ci_tests.sh`
* Fix Windows CI cache
Updates the cache key to include hashes of CMakeLists.txt and the
workflow file.
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* `package_build.sh` runs in temp dir to avoid workspace pollution
- add cleanup
* nix: use `ci_tests.sh`
* remove annoying build-mac warnings
This now checks if package already installed trying to prevent
annoying warnings in the github ci:
Fixes:
```
build-mac (Release, 19)curl 8.17.0 is already installed and up-to-date.
To reinstall 8.17.0, run: brew reinstall curl
```
* refactor test_suite_runner
- less allocations, cleaner code, more maintainable.
- now can be killed and the temp dirs are correctly cleaned up, and the
output is correct.
* main.yml: bsd: change to using rsync, is twice as fast.
* default to `--wincrt=dynamic` when `--sanitize=address` on windows
Default to dynamic, as static ASan is removed in LLVM 21+ for Windows
https://github.com/llvm/llvm-project/pull/107899
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
* Formatting (indent with tab, align with space). Fix K&R braces. Style: keep all cases multiline if one is.
---------
Signed-off-by: Manuel Barrio Linares <mbarriolinares@gmail.com>
Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
Co-authored-by: Alex Garrett <limit.ordinal17@gmail.com>
469 lines
18 KiB
YAML
469 lines
18 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ master, dev, ci_testing, experiments ]
|
|
pull_request:
|
|
branches: [ master, dev ]
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
LLVM_RELEASE_VERSION_WINDOWS: 21.1.8
|
|
LLVM_RELEASE_VERSION_MAC: 21
|
|
LLVM_RELEASE_VERSION_LINUX: 21
|
|
LLVM_RELEASE_VERSION_LINUX_MUSL: 20
|
|
LLVM_RELEASE_VERSION_OPENBSD: 20
|
|
LLVM_RELEASE_VERSION_NETBSD: 19
|
|
LLVM_DEV_VERSION: 22
|
|
|
|
jobs:
|
|
|
|
build-msvc:
|
|
runs-on: windows-latest
|
|
timeout-minutes: 30
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
build_type: [ Release, Debug ]
|
|
defaults:
|
|
run:
|
|
shell: cmd
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/cache@v5
|
|
with:
|
|
path: build/_deps
|
|
key: ${{ runner.os }}-llvm-${{ env.LLVM_RELEASE_VERSION_WINDOWS }}-${{ matrix.build_type }}-${{ hashFiles('CMakeLists.txt', '.github/workflows/main.yml') }}
|
|
|
|
# set up the environment for Ninja
|
|
- uses: ilammy/msvc-dev-cmd@v1
|
|
with:
|
|
arch: x64
|
|
|
|
- name: CMake Build
|
|
run: |
|
|
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
|
|
cmake --build build --config ${{ matrix.build_type }}
|
|
|
|
# We remove the GNU link tool so C3C picks up the MSVC link.exe
|
|
- name: Remove GNU Link
|
|
shell: bash
|
|
run: rm -f /usr/bin/link
|
|
|
|
- name: Run Unified Tests
|
|
shell: bash
|
|
run: ./scripts/tools/ci_tests.sh "./build/c3c.exe"
|
|
|
|
- name: Cache MSVC SDK
|
|
id: cache-msvc-sdk
|
|
uses: actions/cache@v5
|
|
with:
|
|
path: msvc_sdk
|
|
key: msvc-sdk-${{ runner.os }}-${{ hashFiles('msvc_build_libraries.py') }}
|
|
|
|
- if: steps.cache-msvc-sdk.outputs.cache-hit != 'true'
|
|
run: py msvc_build_libraries.py --accept-license
|
|
|
|
- name: Bundle (Windows)
|
|
shell: bash
|
|
run: ./scripts/tools/package_build.sh "./build/c3c.exe" "c3-windows-${{ matrix.build_type }}" "zip"
|
|
|
|
- uses: actions/upload-artifact@v6
|
|
with:
|
|
name: c3-windows-${{ matrix.build_type }}
|
|
path: c3-windows-${{ matrix.build_type }}.zip
|
|
|
|
build-msys2-mingw:
|
|
runs-on: windows-latest
|
|
timeout-minutes: 30
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
build_type: [Release, Debug]
|
|
defaults:
|
|
run:
|
|
shell: msys2 {0}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: msys2/setup-msys2@v2
|
|
with:
|
|
msystem: MINGW64
|
|
update: false
|
|
install: git binutils mingw-w64-x86_64-clang mingw-w64-x86_64-ninja mingw-w64-x86_64-cmake mingw-w64-x86_64-toolchain mingw-w64-x86_64-python mingw-w64-x86_64-llvm mingw-w64-x86_64-llvm-libs
|
|
|
|
- name: Install LLD
|
|
run: |
|
|
echo "Server = https://mirror.msys2.org/mingw/mingw64" > /etc/pacman.d/mirrorlist.mingw64
|
|
pacman -Sy --noconfirm --needed \
|
|
mingw-w64-x86_64-llvm \
|
|
mingw-w64-x86_64-llvm-libs \
|
|
mingw-w64-x86_64-lld \
|
|
mingw-w64-x86_64-clang
|
|
|
|
- name: CMake Build
|
|
run: |
|
|
cmake -B build -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_LINKER=lld -DC3_LINK_DYNAMIC=OFF -DLLVM_DIR=/mingw64/lib/cmake/llvm -DC3_LLD_DIR=/mingw64/lib/
|
|
cmake --build build
|
|
- name: Run Unified Tests
|
|
run: ./scripts/tools/ci_tests.sh "./build/c3c"
|
|
|
|
build-msys2-clang:
|
|
runs-on: windows-latest
|
|
timeout-minutes: 30
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
build_type: [Release, Debug]
|
|
defaults:
|
|
run:
|
|
shell: msys2 {0}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: msys2/setup-msys2@v2
|
|
with:
|
|
msystem: CLANG64
|
|
update: false
|
|
install: git binutils mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-toolchain mingw-w64-clang-x86_64-python
|
|
- name: CMake Build
|
|
run: |
|
|
cmake -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
|
|
cmake --build build
|
|
- name: Run Unified Tests
|
|
run: ./scripts/tools/ci_tests.sh "./build/c3c"
|
|
|
|
build-linux:
|
|
runs-on: ubuntu-22.04
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
build_type: [Release, Debug]
|
|
llvm_version: [17, 18, 19, 20, 21, 22]
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- run: sudo apt-get update && sudo apt-get install -y zlib1g zlib1g-dev python3 ninja-build curl libcurl4-openssl-dev
|
|
- name: Install Clang ${{matrix.llvm_version}}
|
|
run: |
|
|
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
|
REPO_URL="http://apt.llvm.org/focal/ llvm-toolchain-focal"
|
|
if [[ "${{matrix.llvm_version}}" != "${{env.LLVM_DEV_VERSION}}" ]]; then REPO_URL="$REPO_URL-${{matrix.llvm_version}}"; fi
|
|
sudo add-apt-repository "deb $REPO_URL main"
|
|
sudo apt-get update
|
|
PKGS="clang-${{matrix.llvm_version}} llvm-${{matrix.llvm_version}} llvm-${{matrix.llvm_version}}-dev lld-${{matrix.llvm_version}} liblld-${{matrix.llvm_version}}-dev libpolly-${{matrix.llvm_version}}-dev"
|
|
if [[ "${{matrix.llvm_version}}" < 18 ]]; then PKGS="$PKGS libmlir-${{matrix.llvm_version}} libmlir-${{matrix.llvm_version}}-dev mlir-${{matrix.llvm_version}}-tools"; fi
|
|
sudo apt-get install -y $PKGS
|
|
- name: CMake Build
|
|
run: |
|
|
C3_LLVM_VER=${{matrix.llvm_version}}
|
|
if [[ "${{matrix.llvm_version}}" -ge 18 && "${{matrix.llvm_version}}" != "${{env.LLVM_DEV_VERSION}}" ]]; then C3_LLVM_VER="${{matrix.llvm_version}}.1"; fi
|
|
|
|
cmake -B build -G Ninja \
|
|
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
|
|
-DCMAKE_C_COMPILER=clang-${{matrix.llvm_version}} \
|
|
-DCMAKE_CXX_COMPILER=clang++-${{matrix.llvm_version}} \
|
|
-DCMAKE_LINKER=lld-link-${{matrix.llvm_version}} \
|
|
-DCMAKE_OBJCOPY=llvm-objcopy-${{matrix.llvm_version}} \
|
|
-DCMAKE_STRIP=llvm-strip-${{matrix.llvm_version}} \
|
|
-DCMAKE_DLLTOOL=llvm-dlltool-${{matrix.llvm_version}} \
|
|
-DLLVM_ENABLE_LIBXML2=OFF \
|
|
-DC3_LLVM_VERSION=$C3_LLVM_VER
|
|
cmake --build build
|
|
- name: Run Unified Tests
|
|
run: ./scripts/tools/ci_tests.sh "./build/c3c"
|
|
|
|
- name: Embedded/QEMU Tests
|
|
run: |
|
|
sudo apt-get install -y opensbi qemu-system-misc u-boot-qemu gcc-riscv64-unknown-elf
|
|
cd resources/examples/embedded/riscv-qemu
|
|
make C3C_PATH=../../../../build/ run
|
|
|
|
- name: Bundle & Upload (Linux)
|
|
if: matrix.llvm_version == env.LLVM_RELEASE_VERSION_LINUX
|
|
run: |
|
|
bash ./scripts/tools/package_build.sh "./build/c3c" "c3-linux-${{matrix.build_type}}" "tar"
|
|
- uses: actions/upload-artifact@v6
|
|
if: matrix.llvm_version == env.LLVM_RELEASE_VERSION_LINUX
|
|
with:
|
|
name: c3-linux-${{matrix.build_type}}
|
|
path: c3-linux-${{matrix.build_type}}.tar.gz
|
|
|
|
build-linux-alpine:
|
|
runs-on: ubuntu-22.04
|
|
container:
|
|
image: alpine:3.22
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
build_type: [Release, Debug]
|
|
llvm_version: [18, 19, 20]
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- run: apk update && apk add zlib-dev zlib-static python3 samurai cmake curl-dev curl-static openssl-dev bash
|
|
- name: Install Clang
|
|
run: apk add "llvm${{matrix.llvm_version}}-dev" "llvm${{matrix.llvm_version}}-static" "llvm${{matrix.llvm_version}}-gtest" "llvm${{matrix.llvm_version}}-linker-tools" "lld${{matrix.llvm_version}}-dev" "clang${{matrix.llvm_version}}-dev" "clang${{matrix.llvm_version}}-static"
|
|
- name: CMake Build
|
|
run: |
|
|
C3_LLVM_VER=${{matrix.llvm_version}}
|
|
if [[ "${{matrix.llvm_version}}" -ge 18 && "${{matrix.llvm_version}}" != "${{env.LLVM_DEV_VERSION}}" ]]; then C3_LLVM_VER="${{matrix.llvm_version}}.1"; fi
|
|
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_C_COMPILER=clang-${{matrix.llvm_version}} -DCMAKE_CXX_COMPILER=clang++-${{matrix.llvm_version}} -DCMAKE_LINKER=lld-link-${{matrix.llvm_version}} -DCMAKE_OBJCOPY=llvm-objcopy-${{matrix.llvm_version}} -DCMAKE_STRIP=llvm-strip-${{matrix.llvm_version}} -DCMAKE_DLLTOOL=llvm-dlltool-${{matrix.llvm_version}} -DLLVM_ENABLE_LIBXML2=OFF -DC3_LINK_DYNAMIC=ON -DC3_LLVM_VERSION=$C3_LLVM_VER
|
|
cmake --build build
|
|
- name: Run Unified Tests
|
|
run: ./scripts/tools/ci_tests.sh "./build/c3c"
|
|
|
|
- name: Bundle & Upload (Alpine)
|
|
if: matrix.llvm_version == env.LLVM_RELEASE_VERSION_LINUX_MUSL
|
|
run: bash ./scripts/tools/package_build.sh "./build/c3c" "c3-linux-musl-${{matrix.build_type}}" "tar"
|
|
- uses: actions/upload-artifact@v6
|
|
if: matrix.llvm_version == env.LLVM_RELEASE_VERSION_LINUX_MUSL
|
|
with:
|
|
name: c3-linux-musl-${{matrix.build_type}}
|
|
path: c3-linux-musl-${{matrix.build_type}}.tar.gz
|
|
|
|
build-mac:
|
|
runs-on: macos-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
build_type: [Release, Debug]
|
|
llvm_version: [17, 18, 19, 20, 21]
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- name: Download LLVM
|
|
run: |
|
|
brew_install() {
|
|
for pkg in "$@"; do
|
|
brew list "$pkg" &>/dev/null || brew install "$pkg"
|
|
done
|
|
}
|
|
if [[ "${{ matrix.llvm_version }}" == "21" ]]; then
|
|
brew_install llvm lld ninja curl
|
|
echo "/opt/homebrew/opt/llvm/bin" >> $GITHUB_PATH
|
|
echo "/opt/homebrew/opt/lld/bin" >> $GITHUB_PATH
|
|
else
|
|
brew_install llvm@${{ matrix.llvm_version }} ninja curl
|
|
echo "/opt/homebrew/opt/llvm@${{ matrix.llvm_version }}/bin" >> $GITHUB_PATH
|
|
if [[ "${{ matrix.llvm_version }}" -ge 19 ]]; then
|
|
brew_install lld@${{ matrix.llvm_version }}
|
|
echo "/opt/homebrew/opt/lld@${{ matrix.llvm_version }}/bin" >> $GITHUB_PATH
|
|
fi
|
|
fi
|
|
echo "CPATH=$(xcrun --show-sdk-path)/user/include" >> $GITHUB_ENV
|
|
- name: CMake Build
|
|
run: |
|
|
C3_LLVM_VER=${{matrix.llvm_version}}
|
|
if [[ "${{matrix.llvm_version}}" -ge 18 ]]; then C3_LLVM_VER="${{matrix.llvm_version}}.1"; fi
|
|
if [[ "${{ matrix.llvm_version }}" == "21" ]]; then
|
|
C3_LLD_DIR="/opt/homebrew/opt/lld/lib"
|
|
C3_LLD_INCLUDE_DIR="/opt/homebrew/opt/lld/include"
|
|
elif [[ "${{ matrix.llvm_version }}" -ge 19 ]]; then
|
|
C3_LLD_DIR="/opt/homebrew/opt/lld@${{ matrix.llvm_version }}/lib"
|
|
C3_LLD_INCLUDE_DIR="/opt/homebrew/opt/lld@${{ matrix.llvm_version }}/include"
|
|
else
|
|
C3_LLD_DIR=""
|
|
C3_LLD_INCLUDE_DIR=""
|
|
fi
|
|
cmake -B build -G Ninja -DC3_LLVM_VERSION=$C3_LLVM_VER -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DC3_LLD_DIR=$C3_LLD_DIR -DC3_LLD_INCLUDE_DIR=$C3_LLD_INCLUDE_DIR
|
|
cmake --build build
|
|
- name: Run Unified Tests
|
|
run: ./scripts/tools/ci_tests.sh "./build/c3c"
|
|
|
|
- name: Build Lib (Mac)
|
|
run: |
|
|
cd resources/testproject
|
|
../../build/c3c build hello_world_lib -vv --trust=full
|
|
|
|
- name: Bundle & Upload (Mac)
|
|
if: matrix.llvm_version == env.LLVM_RELEASE_VERSION_MAC
|
|
run: bash ./scripts/tools/package_build.sh "./build/c3c" "c3-macos-${{matrix.build_type}}" "zip"
|
|
- uses: actions/upload-artifact@v6
|
|
if: matrix.llvm_version == env.LLVM_RELEASE_VERSION_MAC
|
|
with:
|
|
name: c3-macos-${{matrix.build_type}}
|
|
path: c3-macos-${{matrix.build_type}}.zip
|
|
|
|
build-openbsd:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
build_type: [Release, Debug]
|
|
version: ['7.8']
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Build, Test and Package in OpenBSD
|
|
uses: vmactions/openbsd-vm@v1
|
|
with:
|
|
sync: rsync
|
|
usesh: true
|
|
release: ${{ matrix.version }}
|
|
prepare: pkg_add ninja cmake llvm%${{ env.LLVM_RELEASE_VERSION_OPENBSD }} bash
|
|
# Combine all logic here so rsync copyback triggers at the end
|
|
run: |
|
|
export MALLOC_OPTIONS=j # Disable junk filling (it's faster)
|
|
cd "$GITHUB_WORKSPACE"
|
|
|
|
# Build
|
|
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{matrix.build_type}}
|
|
cmake --build build
|
|
|
|
# Run Unified Tests
|
|
chmod +x scripts/tools/ci_tests.sh
|
|
ulimit -d unlimited
|
|
./scripts/tools/ci_tests.sh "./build/c3c"
|
|
|
|
# Package
|
|
chmod +x scripts/tools/package_build.sh
|
|
./scripts/tools/package_build.sh "./build/c3c" "c3-openbsd-${{matrix.build_type}}" "tar"
|
|
|
|
- uses: actions/upload-artifact@v6
|
|
with:
|
|
name: c3-openbsd-${{matrix.build_type}}
|
|
path: c3-openbsd-${{matrix.build_type}}.tar.gz
|
|
|
|
build-netbsd:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
build_type: [Release, Debug]
|
|
version: ['10.1']
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Build, Test and Package in NetBSD
|
|
uses: vmactions/netbsd-vm@v1
|
|
with:
|
|
sync: rsync
|
|
usesh: true
|
|
release: ${{ matrix.version }}
|
|
prepare: |
|
|
export PATH="/usr/pkg/sbin:/usr/pkg/bin:$PATH"
|
|
export PKG_PATH="https://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/$(uname -m)/$(uname -r)/All/"
|
|
/usr/sbin/pkg_add pkgin
|
|
pkgin -y update
|
|
pkgin -y install cmake gcc14 ninja-build bash \
|
|
'llvm>=${{ env.LLVM_RELEASE_VERSION_NETBSD }}' \
|
|
'clang>=${{ env.LLVM_RELEASE_VERSION_NETBSD }}' \
|
|
'lld>=${{ env.LLVM_RELEASE_VERSION_NETBSD }}'
|
|
run: |
|
|
export PATH="/usr/pkg/sbin:/usr/pkg/bin:$PATH"
|
|
export CC=clang
|
|
export CXX=clang++
|
|
cd "$GITHUB_WORKSPACE"
|
|
|
|
# Build
|
|
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{matrix.build_type}}
|
|
cmake --build build
|
|
|
|
# Run Unified Tests
|
|
chmod +x scripts/tools/ci_tests.sh
|
|
./scripts/tools/ci_tests.sh "./build/c3c"
|
|
|
|
# Package
|
|
chmod +x scripts/tools/package_build.sh
|
|
./scripts/tools/package_build.sh "./build/c3c" "c3-netbsd-${{matrix.build_type}}" "tar"
|
|
|
|
- uses: actions/upload-artifact@v6
|
|
with:
|
|
name: c3-netbsd-${{matrix.build_type}}
|
|
path: c3-netbsd-${{matrix.build_type}}.tar.gz
|
|
|
|
build-with-docker:
|
|
runs-on: ubuntu-22.04
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
ubuntu_version: [20.04, 22.04]
|
|
build_type: [Release, Debug]
|
|
llvm_version: [17, 18, 19]
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: docker/setup-buildx-action@v3
|
|
- name: Build
|
|
run: |
|
|
chmod +x ./build-with-docker.sh
|
|
LLVM_VERSION=${{ matrix.llvm_version }} UBUNTU_VERSION=${{ matrix.ubuntu_version }} CMAKE_BUILD_TYPE=${{ matrix.build_type }} ./build-with-docker.sh
|
|
- name: Run Unified Tests in Docker
|
|
run: |
|
|
chmod +x ./scripts/tools/ci_tests.sh
|
|
docker run --rm \
|
|
-u 0 \
|
|
-v "$(pwd):/home/c3c/source" \
|
|
-w /home/c3c/source \
|
|
c3c-builder \
|
|
bash -c "./scripts/tools/ci_tests.sh ./bin/c3c"
|
|
|
|
build-nix:
|
|
runs-on: ubuntu-22.04
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
build_type: [ Release, Debug ]
|
|
nixpkgs: [ Lock, Latest ]
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: cachix/install-nix-action@v31
|
|
with:
|
|
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Update flake
|
|
if: matrix.nixpkgs == 'Latest'
|
|
run: nix flake update
|
|
- name: CMake build and run Unified Tests
|
|
run: |
|
|
CHECK_NAME=".#c3c-checks"
|
|
if [[ ${{ matrix.build_type }} = "Debug" ]]; then CHECK_NAME=".#c3c-debug-checks"; fi
|
|
nix build -L "$CHECK_NAME"
|
|
|
|
release:
|
|
runs-on: ubuntu-22.04
|
|
needs: [build-msvc, build-linux, build-mac, build-linux-alpine, build-openbsd, build-netbsd]
|
|
if: github.ref == 'refs/heads/master'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/download-artifact@v4
|
|
|
|
- name: Prepare Assets
|
|
run: |
|
|
# --- Release Assets ---
|
|
mv c3-windows-Release/c3-windows-Release.zip c3-windows.zip
|
|
mv c3-macos-Release/c3-macos-Release.zip c3-macos.zip
|
|
|
|
mv c3-linux-Release/c3-linux-Release.tar.gz c3-linux.tar.gz
|
|
mv c3-linux-musl-Release/c3-linux-musl-Release.tar.gz c3-linux-musl.tar.gz
|
|
mv c3-openbsd-Release/c3-openbsd-Release.tar.gz c3-openbsd.tar.gz || true
|
|
mv c3-netbsd-Release/c3-netbsd-Release.tar.gz c3-netbsd.tar.gz || true
|
|
|
|
# --- Debug Assets ---
|
|
mv c3-windows-Debug/c3-windows-Debug.zip c3-windows-debug.zip
|
|
mv c3-macos-Debug/c3-macos-Debug.zip c3-macos-debug.zip
|
|
|
|
mv c3-linux-Debug/c3-linux-Debug.tar.gz c3-linux-debug.tar.gz
|
|
mv c3-linux-musl-Debug/c3-linux-musl-Debug.tar.gz c3-linux-musl-debug.tar.gz
|
|
mv c3-openbsd-Debug/c3-openbsd-Debug.tar.gz c3-openbsd-debug.tar.gz || true
|
|
mv c3-netbsd-Debug/c3-netbsd-Debug.tar.gz c3-netbsd-debug.tar.gz || true
|
|
|
|
- run: gh release delete latest-prerelease-tag --cleanup-tag -y || true
|
|
- run: echo "RELEASE_NAME=latest-prerelease-$(date +'%Y%m%d-%H%M')" >> $GITHUB_ENV
|
|
|
|
- uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: latest-prerelease-tag
|
|
name: ${{ env.RELEASE_NAME }}
|
|
prerelease: true
|
|
files: |
|
|
c3-windows.zip
|
|
c3-macos.zip
|
|
c3-linux.tar.gz
|
|
c3-linux-musl.tar.gz
|
|
c3-openbsd.tar.gz
|
|
c3-netbsd.tar.gz
|
|
# --- Debug Artifacts (Uncomment to include) ---
|
|
# c3-windows-debug.zip
|
|
# c3-macos-debug.zip
|
|
# c3-linux-debug.tar.gz
|
|
# c3-linux-musl-debug.tar.gz
|
|
# c3-openbsd-debug.tar.gz
|
|
# c3-netbsd-debug.tar.gz
|