-
Notifications
You must be signed in to change notification settings - Fork 239
170 lines (144 loc) · 5.69 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
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