Skip to content

Commit 0fc3264

Browse files
committed
added workflows
1 parent 2e79437 commit 0fc3264

File tree

2 files changed

+99
-16
lines changed

2 files changed

+99
-16
lines changed

.github/workflows/build.yaml

Lines changed: 98 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ jobs:
2121
binary_name: muuk.exe
2222
artifact_name: muuk-windows
2323
zip_name: muuk-windows.zip
24-
gh_asset: muuk-windows.zip
2524
muuk_exec: .\muuk.exe
2625
copy_cmd: copy build\release\bin\bin.exe muuk.exe
2726

@@ -30,7 +29,6 @@ jobs:
3029
binary_name: muuk
3130
artifact_name: muuk-macos
3231
zip_name: muuk-macos.zip
33-
gh_asset: muuk-macos.zip
3432
muuk_exec: ./muuk
3533
copy_cmd: cp build/release/bin/bin muuk
3634

@@ -39,7 +37,6 @@ jobs:
3937
binary_name: muuk
4038
artifact_name: muuk-linux
4139
zip_name: muuk-linux.zip
42-
gh_asset: muuk-linux.zip
4340
muuk_exec: ./muuk
4441
copy_cmd: cp build/release/bin/bin muuk
4542

@@ -72,7 +69,7 @@ jobs:
7269
- name: Download latest release
7370
shell: bash
7471
run: |
75-
url=$(gh release view --json assets -q ".assets[] | select(.name == \"${{ matrix.gh_asset }}\") | .url")
72+
url=$(gh release view --json assets -q ".assets[] | select(.name == \"${{ matrix.zip_name }}\") | .url")
7673
curl -L "$url" -o muuk.zip
7774
unzip -o muuk.zip
7875
if [[ "${{ runner.os }}" != "Windows" ]]; then
@@ -84,13 +81,11 @@ jobs:
8481
- name: Install dependencies with muuk
8582
run: ${{ matrix.muuk_exec }} install
8683

87-
- name: Create build/release directory
84+
- name: Create build directory
8885
shell: bash
89-
run: mkdir -p build/release
90-
91-
- name: Create build/debug directory
92-
shell: bash
93-
run: mkdir -p build/debug
86+
run: |
87+
mkdir -p build/release
88+
mkdir -p build/debug
9489
9590
- name: Build project (Release)
9691
run: ${{ matrix.muuk_exec }} build -c ${{ matrix.compiler }} -p release
@@ -102,15 +97,12 @@ jobs:
10297
if: runner.os != 'Windows'
10398
run: chmod +x ${{ matrix.binary_name }}
10499

105-
- name: Test whether it can build itself
106-
run: ./${{ matrix.binary_name }} build -c ${{ matrix.compiler }} -p debug
107-
108100
- name: Upload raw binary as artifact (for internal use)
109101
uses: actions/upload-artifact@v4
110102
with:
111103
name: ${{ matrix.artifact_name }}
112104
path: ${{ matrix.binary_name }}
113-
105+
114106
- name: Zip for GitHub Release
115107
if: startsWith(github.ref, 'refs/tags/')
116108
uses: vimtor/action-zip@v1.1
@@ -125,4 +117,95 @@ jobs:
125117
files: ${{ matrix.zip_name }}
126118
generate_release_notes: true
127119
env:
128-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
120+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
121+
122+
test:
123+
name: Test the built binary
124+
needs: build
125+
runs-on: ${{ matrix.os }}
126+
127+
strategy:
128+
matrix:
129+
include:
130+
- os: windows-latest
131+
artifact_name: muuk-windows
132+
binary_name: muuk.exe
133+
compiler: msvc
134+
muuk_exec: .\muuk.exe
135+
136+
- os: macos-latest
137+
artifact_name: muuk-macos
138+
binary_name: muuk
139+
compiler: clang
140+
muuk_exec: ./muuk
141+
142+
- os: ubuntu-latest
143+
artifact_name: muuk-linux
144+
binary_name: muuk
145+
compiler: gcc
146+
muuk_exec: ./muuk
147+
148+
steps:
149+
- name: Checkout code
150+
uses: actions/checkout@v3
151+
152+
- name: Download build artifact
153+
uses: actions/download-artifact@v4
154+
with:
155+
name: ${{ matrix.artifact_name }}
156+
path: .
157+
158+
- name: Install Ninja
159+
uses: seanmiddleditch/gha-setup-ninja@v6
160+
161+
- name: Set up MSVC (Windows only)
162+
if: matrix.compiler == 'msvc'
163+
uses: ilammy/msvc-dev-cmd@v1
164+
165+
- name: Install LLVM (macOS only)
166+
if: runner.os == 'macOS'
167+
run: |
168+
brew install llvm
169+
echo "LLVM installed at: $(brew --prefix llvm)"
170+
echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH
171+
172+
- name: Install LLVM (Linux only)
173+
if: runner.os == 'Linux'
174+
run: |
175+
sudo apt-get update
176+
sudo apt-get install -y build-essential llvm clang lld
177+
echo "LLVM installed at: $(llvm-config --prefix)"
178+
echo "$(llvm-config --bindir)" >> $GITHUB_PATH
179+
180+
- name: Make binary executable (Linux/macOS only)
181+
if: runner.os != 'Windows'
182+
run: chmod +x muuk
183+
184+
- name: Install dependencies with muuk
185+
run: ${{ matrix.muuk_exec }} install
186+
187+
- name: Create build directory
188+
shell: bash
189+
run: |
190+
mkdir -p build/release
191+
mkdir -p build/debug
192+
193+
- name: Build project
194+
run: ${{ matrix.muuk_exec }} build -c ${{ matrix.compiler }} -p debug
195+
196+
- name: Set up Python
197+
uses: actions/setup-python@v5
198+
with:
199+
python-version: '3.x'
200+
201+
- name: Install pytest
202+
run: pip install pytest
203+
204+
- name: Run test
205+
if: runner.os == 'Windows'
206+
run: pytest test/external/test.py
207+
208+
- name: Run C++ tests (Windows)
209+
if: runner.os == 'Windows'
210+
run: ./build/debug/test/test.exe
211+

muuk.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,5 @@ cflags = ['/Od', '/DDEBUG', '/Zi', '/RTC1', '/FC', '/GS']
8989
default = true
9090
include = ['include']
9191
inherits = ['base']
92-
lflags = ['/DEBUG', '/MACHINE:X86']
92+
lflags = ['/DEBUG']
9393
libs = []

0 commit comments

Comments
 (0)