-
Notifications
You must be signed in to change notification settings - Fork 4
93 lines (89 loc) · 3.43 KB
/
windows.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
on:
push:
branches:
- main
pull_request:
jobs:
# Creates jou.exe and downloads the DLL files it needs.
# Even though the resulting executable runs on windows, it is compiled on linux.
# This is by far the easiest way to compile for Windows that I know of.
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download LLVM installer
run: wget --no-verbose https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.1/LLVM-13.0.1-win64.exe
- name: Verify LLVM installer
run: |
ls -lh LLVM-13.0.1-win64.exe
if [ "$(sha256sum LLVM-13.0.1-win64.exe)" == "9d15be034d52ec57cfc97615634099604d88a54761649498daa7405983a7e12f LLVM-13.0.1-win64.exe" ]; then
echo ok
else
echo "sha sum mismatch! something has changed!"
exit 1
fi
# Apparently the exe file is created with nsis installer and 7z can extract from it.
# Figured out by looking at source code of https://github.com/KyleMayes/install-llvm-action
- name: Extract files from LLVM installer
run: |
files="lib/LLVM-C.lib"
for file in $(7z l LLVM-13.0.1-win64.exe | grep -o 'bin/.*\.dll'); do
case $file in
# To figure out which dll files I need, I deleted them one by one and ran
# the compiler again.
#
# Unfortunately you need to do this locally instead of relying on github
# actions, because github actions comes with lots of software and hence lots
# of DLL files preinstalled. I used a Windows VM with nothing installed.
bin/LLVM-C.dll | \
bin/msvcp140.dll | \
bin/ucrtbase.dll | \
bin/vcruntime140.dll | \
bin/vcruntime140_1.dll | \
bin/api-ms-win-*.dll) # Not sure which of these we need and what each one does.
files="$files $file"
;;
*)
echo "*** skip dll: $file ***"
;;
esac
done
echo "Extracting $files"
7z x LLVM-13.0.1-win64.exe $files
# llvm-13-dev needed for the header files. They seem to be missing from LLVM windows installer.
# Using gcc instead of clang, because gcc "just works".
- run: sudo apt install -y llvm-13-dev gcc-mingw-w64-x86-64-win32
- run: CC=x86_64-w64-mingw32-gcc LDFLAGS=lib/LLVM-C.lib make
- run: mkdir -v exe-and-dlls && cp -v jou.exe bin/*.dll exe-and-dlls/
- uses: actions/upload-artifact@v3
with:
name: exe-and-dlls
path: exe-and-dlls
codeblocks-project:
# Ensure that the codeblocks project contains all source files.
# It gets outdated easily when I create a new file on linux.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
diff -u --color=always <(ls src/* | sort) <(grep filename= jou.cbp | cut -d'"' -f2)
test:
needs: build
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: exe-and-dlls
- shell: bash
run: ./runtests.sh
fuzzer:
needs: build
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: exe-and-dlls
- shell: bash
run: ./fuzzer.sh