-
Notifications
You must be signed in to change notification settings - Fork 5
139 lines (118 loc) · 4.45 KB
/
build.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
name: Build C++ utility
on:
push:
paths:
- 'src/**/*.cpp'
- '.github/workflows/*.yml'
pull_request:
paths:
- 'src/**/*.cpp'
workflow_dispatch:
jobs:
checkout:
runs-on: windows-latest
outputs:
checkout-path: ${{ steps.upload-artifact.outputs.artifact-path }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Upload checkout files as artifact
uses: actions/upload-artifact@v4
with:
name: source
path: src
build-msvc:
runs-on: windows-latest
needs: checkout
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Enable Developer Command Prompt
uses: ilammy/[email protected]
- name: Compile and build source files
shell: cmd
run: |
cl
cl /std:c++20 /O2 /W4 /LD /EHsc /DLL /MT /Fe:src\dlls\api.dll src/api.cpp src/settings.cpp src/asteroids.cpp /link user32.lib shell32.lib gdi32.lib wininet.lib
cl /std:c++20 /O2 /W4 /LD /EHsc /DLL /MT /Fe:src\dlls\gui.dll src/gui.cpp src/settings.cpp src/asteroids.cpp src/system.cpp src/api.cpp /link advapi32.lib user32.lib shell32.lib gdi32.lib wininet.lib comctl32.lib
build-gcc:
runs-on: windows-latest
needs: checkout
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Compile and build source files
shell: cmd
run: |
rm -rf src/dlls/*
g++ --version
g++ -O2 -march=alderlake -mtune=alderlake -msse4.2 -mavx -funroll-loops -flto -Wextra -shared -std=c++20 -Wmissing-field-initializers -static -o src/dlls/api.dll src/api.cpp src/settings.cpp src/asteroids.cpp -lgdi32 -lwininet
g++ -O2 -march=alderlake -mtune=alderlake -msse4.2 -mavx -funroll-loops -flto -Wextra -Wcast-function-type -Wmissing-field-initializers -shared -std=c++20 -static -o src/dlls/gui.dll src/gui.cpp src/settings.cpp src/asteroids.cpp src/system.cpp src/api.cpp -lgdi32 -lwininet -lcomctl32
- name: Commit and push .dll files
run: |
git config --global user.name "Ethan Chan"
git config --global user.email "[email protected]"
git add . -f
git commit -m "Auto-build DLL files using g++" || echo "No changes to commit"
git push https://[email protected]/eschan145/DieKnow.git main
env:
# A GitHub PAT must be set up as an Actions secret in the repository
GH_PAT: ${{ secrets.GH_PAT }}
build-clang:
runs-on: windows-latest
needs: checkout
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Compile and build source files
shell: cmd
run: |
clang++ --version
clang++ -O2 -Wextra -shared -std=c++20 -Wmissing-field-initializers -static -o src/dlls/api.dll src/api.cpp src/settings.cpp src/asteroids.cpp -luser32 -lshell32 -lgdi32 -lwininet
clang++ -O2 -Wextra -Wcast-function-type -Wmissing-field-initializers -shared -std=c++20 -static -o src/dlls/gui.dll src/gui.cpp src/settings.cpp src/asteroids.cpp src/system.cpp src/api.cpp -luser32 -lshell32 -ladvapi32 -lgdi32 -lwininet -lcomctl32
build-documentation:
needs: [build-msvc, build-gcc, build-clang]
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Build docs
shell: cmd
run: |
git pull --force
py src/dieknow.py -docs
echo "Generated documentation"
- name: Commit and push generated documentation files
run: |
git config --global user.name "Ethan Chan"
git config --global user.email "[email protected]"
git add . -f
git rm --cached *.pyc
git commit -m "Automated documentation update" || echo "No changes to commit"
git push https://[email protected]/eschan145/DieKnow.git main
env:
# A GitHub PAT must be set up as an Actions secret in the repository
GH_PAT: ${{ secrets.GH_PAT }}
verify-libraries:
needs: [build-msvc, build-gcc, build-clang]
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Use ls to check DLLs
shell: cmd
run: |
ls -l src/dlls/api.dll
ls -l src/dlls/gui.dll