selfhost: Gotta go fast(er) #4620
Workflow file for this run
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
on: | |
pull_request: | |
push: # Run CI on the main branch after every merge. This is important to fill the GitHub Actions cache in a way that pull requests can see it | |
branches: | |
- main | |
name: continuous-integration | |
jobs: | |
lint-samples: | |
strategy: | |
fail-fast: true | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: '3.x' | |
- name: Lint samples | |
run: python ./meta/lint_samples.py | |
selfhost-unix: | |
strategy: | |
fail-fast: true | |
matrix: | |
platform: [ubuntu-22.04] | |
cxx_compiler: [clang++-18] | |
include: | |
- platform: macos-latest | |
cxx_compiler: "$(brew --prefix llvm@18)/bin/clang++" | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Ninja | |
uses: ashutoshvarma/setup-ninja@master | |
with: | |
# ninja version to download. Default: 1.10.0 | |
version: 1.10.0 | |
dest: ${{ github.workspace }}/ninja_bin | |
- name: Install Linux dependencies | |
if: ${{ matrix.platform == 'ubuntu-22.04' }} | |
run: | | |
. /etc/lsb-release | |
wget -O /usr/share/keyrings/llvm-snapshot.gpg.key https://apt.llvm.org/llvm-snapshot.gpg.key | |
sudo echo "deb [signed-by=/usr/share/keyrings/llvm-snapshot.gpg.key] http://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME} main" | sudo tee -a /etc/apt/sources.list.d/llvm.list | |
sudo echo "deb [signed-by=/usr/share/keyrings/llvm-snapshot.gpg.key] http://apt.llvm.org/${DISTRIB_CODENAME}/ llvm-toolchain-${DISTRIB_CODENAME}-18 main" | sudo tee -a /etc/apt/sources.list.d/llvm.list | |
sudo apt-get update | |
sudo apt-get install -y clang-18 libclang-18-dev | |
- name: Install macOS dependencies | |
if: ${{ matrix.platform == 'macos-latest' }} | |
run: brew install coreutils llvm@18 | |
- name: Build Jakt Stage 1 | |
run: | | |
export "CMAKE_PREFIX_PATH=$(brew --prefix llvm@18)" | |
cmake -GNinja -B build -DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} -DCMAKE_BUILD_TYPE=Release -DFINAL_STAGE=1 -DCMAKE_INSTALL_PREFIX=jakt-install | |
cmake --build build | |
- name: Test Jakt Stage 1 | |
run: ./build/bin/jakttest -C ${{ matrix.cxx_compiler }} | |
- name: Build Jakt Stage 2 | |
run: | | |
# Modify CMake cache to set final stage to stage 2 | |
cmake -B build -DFINAL_STAGE=2 | |
cmake --build build | |
- name: Test Jakt Stage 2 | |
run: ./build/bin/jakttest -C ${{ matrix.cxx_compiler }} | |
- name: Install jakt | |
run: cmake --install build | |
- name: Create project and build with jakt | |
working-directory: ${{ github.workspace }} | |
run: | | |
./jakt-install/bin/jakt --create TestProjectJakt | |
cd TestProjectJakt | |
../jakt-install/bin/jakt -C ${{ matrix.cxx_compiler }} -O src/main.jakt -o TestProjectJakt | |
if ! ./build/TestProjectJakt | grep -q "Hello, World!"; | |
then | |
echo "::error :^( failed, failing job" | |
exit 1 | |
fi | |
- name: Create project and build with cmake | |
working-directory: ${{ github.workspace }} | |
run: | | |
./jakt-install/bin/jakt --create TestProjectCMake | |
cd TestProjectCMake | |
cmake -GNinja -B build \ | |
-DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }} \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/jakt-install | |
cmake --build build | |
if ! ./build/TestProjectCMake | grep -q "Hello, World!"; | |
then | |
echo "::error :^( failed, failing job" | |
exit 1 | |
fi | |
selfhost-windows: | |
env: | |
LLVM_VER: 18.1.6 | |
strategy: | |
fail-fast: true | |
runs-on: windows-latest | |
steps: | |
- run: git config --global core.autocrlf false | |
- uses: actions/checkout@v3 | |
- name: Setup Ninja | |
uses: ashutoshvarma/setup-ninja@master | |
with: | |
# ninja version to download. Default: 1.10.0 | |
version: 1.10.0 | |
dest: ${{ github.workspace }}/ninja_bin | |
- name: Configure CMake | |
env: | |
CMAKE_PREFIX_PATH: ${{ github.workspace }}/llvm-install-${{ env.LLVM_VER }} | |
run: cmake -B build -G Ninja -DFINAL_STAGE=1 -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=jakt-install | |
- name: Build Jakt Stage 1 Selfhost | |
run: cmake --build build | |
- name: Test Jakt Stage 1 | |
run: .\build\bin\jakttest.exe --cpp-compiler "clang++.exe" | |
# FIXME: Share this better with unix job? | |
- name: Install jakt | |
run: cmake --install build | |
- name: Create project and build with jakt | |
working-directory: ${{ github.workspace }} | |
shell: bash | |
run: | | |
./jakt-install/bin/jakt.exe --create TestProjectJakt | |
cd TestProjectJakt | |
../jakt-install/bin/jakt.exe -O src/main.jakt -o TestProjectJakt -C "clang-cl" | |
if ! ./build/TestProjectJakt.exe | grep -q "Hello, World!"; | |
then | |
echo "::error :^( failed, failing job" | |
exit 1 | |
fi | |
- name: Create project and build with cmake | |
working-directory: ${{ github.workspace }} | |
shell: bash | |
run: | | |
./jakt-install/bin/jakt.exe --create TestProjectCMake | |
cd TestProjectCMake | |
cmake -GNinja -B build \ | |
-DCMAKE_CXX_COMPILER=clang.exe \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_PREFIX_PATH="${{ github.workspace }}/jakt-install" | |
cmake --build build | |
if ! ./build/TestProjectCMake.exe | grep -q "Hello, World!"; | |
then | |
echo "::error :^( failed, failing job" | |
exit 1 | |
fi |