-
-
Notifications
You must be signed in to change notification settings - Fork 15
203 lines (178 loc) · 5.93 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
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
name: build
on:
push:
branches:
- master
pull_request:
env:
BUILD_TYPE: release
jobs:
compilation:
name: Compilation and Unit Tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-latest
artifact: macos
name: MacOSX
inklecate_url: https://github.com/inkle/ink/releases/download/v1.1.1/inklecate_mac.zip
proof: false
- os: windows-latest
artifact: win64
name: Windows x64
inklecate_url: https://github.com/inkle/ink/releases/download/v1.1.1/inklecate_windows.zip
proof: false
- os: "ubuntu-20.04"
artifact: linux
name: Linux x64
inklecate_url: https://github.com/inkle/ink/releases/download/v1.1.1/inklecate_linux.zip
proof: true
steps:
# Checkout project
- uses: actions/checkout@v2
with:
submodules: true
# Download inklecate
- uses: suisei-cn/actions-download-file@v1
name: Download Inklecate
id: download_inklecate
with:
url: ${{ matrix.inklecate_url }}
target: "inklecate/"
# Install Inklecate
- name: Deploy Inkelcate
shell: bash
run: |
cd inklecate
unzip *.zip
echo "INKLECATE=${{ matrix.inklecate_pre }}$GITHUB_WORKSPACE/inklecate/inklecate${{ matrix.inklecate_post }}" >> $GITHUB_ENV
# Setup python
- uses: actions/setup-python@v2
if: ${{ matrix.proof }}
with:
python-version: '3.7'
# Setup CMake
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1.9
with:
cmake-version: '3.21.x'
# Create a build directory to store all the CMake generated files
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
# Run CMake configuration to create build files
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
# Build using CMake and OS toolkit
- name: Build
working-directory: ${{github.workspace}}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE
# Run CMake tests (unit tests, etc.)
- name: CTests
working-directory: ${{github.workspace}}/build
shell: bash
run: ctest . -C $BUILD_TYPE -V
# Copy all build artifacts to the bin directory
- name: Install
working-directory: ${{github.workspace}}/build
shell: bash
run: cmake --install . --config $BUILD_TYPE --prefix bin --component cl
# Upload bin directory as artifact
- name: Upload Binary Artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact }}
path: build/bin/
# Make sure Inkproof has everything it needs to run our executable
- name: Setup Ink Proof
if: ${{ matrix.proof }}
shell: bash
working-directory: proofing/ink-proof
run: |
python3 install_deps.py
cp ../inkcpp_runtime_driver drivers/
chmod +x drivers/inkcpp_runtime_driver
mkdir deps/inkcpp
cp ../../build/bin/* deps/inkcpp/
chmod +x deps/inkcpp/inkcpp_cl
# Run it
- name: Run Ink Proof
if: ${{ matrix.proof }}
shell: bash
working-directory: proofing/ink-proof
run: |
python3 proof.py --examples 'I...' inkcpp inklecate_v0.9.0 > run.out
echo -e "| ${{ matrix.name }} | $(cat run.out) |" > ${{ matrix.artifact }}.txt
# Creates a "disabled" artifact if ink proofing is disabled
- name: Create Disabled InkProof Results File
if: ${{ !matrix.proof }}
shell: bash
run: |
mkdir -p proofing/ink-proof
echo "| ${{ matrix.name }} | DISABLED |" > proofing/ink-proof/${{ matrix.artifact }}.txt
# Upload results artifact
- name: Upload Results Artifact
uses: actions/upload-artifact@v2
with:
name: results
path: proofing/ink-proof/${{ matrix.artifact }}.txt
# Upload website artifact
- name: Upload Ink-Proof Website Artifact
if: ${{ matrix.proof }}
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact }}-www
path: proofing/ink-proof/out
reporting:
name: "Pull Request Report"
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
needs: compilation
steps:
# Download Ink Proof Results
- uses: actions/download-artifact@v2
with:
name: results
path: "results"
# Create comment text
- name: Create Comment Text File
shell: bash
run: |
echo "### Ink Proof Results" >> comment.txt
echo "" >> comment.txt
echo "These results are obtained by running the [Ink-Proof Testing Suite](https://github.com/chromy/ink-proof) on the compiled binaries in this pull request." >> comment.txt
echo "" >> comment.txt
echo "| System | Results |" >> comment.txt
echo "| --- | --- |" >> comment.txt
FILES="results/*.txt"
for f in $FILES
do
echo "Reading results from $f"
cat "$f" >> comment.txt
done
# Post Comment
- uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
path: comment.txt
pages:
name: "Upload Ink-Proof to Github Pages"
needs: compilation
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
# Download Ink Proof page for Linux
- uses: actions/download-artifact@v2
with:
name: linux-www
path: www
# Deploy to Github Pages
- name: Deploy Page
uses: JamesIves/github-pages-deploy-action@4.1.4
with:
branch: inkproof-page
folder: www