-
-
Notifications
You must be signed in to change notification settings - Fork 17
179 lines (154 loc) · 7.86 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
name: CI Build
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
PROJECT_NAME: "pwn++"
REPO: hugsy/pwn--
VERBOSE: "1"
on:
pull_request:
workflow_dispatch:
push:
branches:
- main
jobs:
build:
name: "${{ matrix.variants.os }}/${{ matrix.variants.arch }}/${{ matrix.variants.config }}"
env:
CMAKE_FLAGS: '-DPWN_BUILD_DOCS=OFF -DPWN_DISASSEMBLE_X86=ON -DPWN_DISASSEMBLE_ARM64=ON -DPWN_BUILD_TOOLKIT=ON -DPWN_BUILD_TESTING=ON'
NB_CPU: 1
strategy:
fail-fast: false
matrix:
variants:
# - {os: windows-latest, arch: x64, config: Debug, build: full}
# - {os: windows-latest, arch: win32, config: Debug, build: full}
# - {os: windows-latest, arch: arm64, config: Debug, build: full}
# - {os: windows-latest, arch: arm, config: Debug, build: full}
# - {os: ubuntu-latest, arch: x64, config: Debug, build: full}
- {os: windows-latest, arch: x64, config: RelWithDebInfo, build: full}
- {os: windows-latest, arch: win32, config: RelWithDebInfo, build: full}
- {os: windows-latest, arch: arm64, config: RelWithDebInfo, build: full}
- {os: windows-latest, arch: arm, config: RelWithDebInfo, build: full}
- {os: ubuntu-latest, arch: x64, config: RelWithDebInfo, build: full}
runs-on: ${{ matrix.variants.os }}
outputs:
windows-latest-x64-full: ${{ join(steps.*.outputs.windows-latest-x64-full,'') }}
windows-latest-win32-full: ${{ join(steps.*.outputs.windows-latest-win32-full,'') }}
windows-latest-arm-full: ${{ join(steps.*.outputs.windows-latest-arm-full,'') }}
windows-latest-arm64-full: ${{ join(steps.*.outputs.windows-latest-arm64-full,'') }}
ubuntu-latest-x64-full: ${{ join(steps.*.outputs.ubuntu-latest-x64-full,'') }}
ubuntu-latest-x86-full: ${{ join(steps.*.outputs.ubuntu-latest-x86-full,'') }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Setup environment variables (Windows)
if: matrix.variants.os == 'windows-latest'
shell: powershell
run: |
echo "NB_CPU=$env:NUMBER_OF_PROCESSORS" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
Import-Module .\.github\Invoke-VisualStudio.ps1
Invoke-VisualStudio2022${{ matrix.variants.arch }}
- name: Setup environment variables (Linux)
if: matrix.variants.os == 'ubuntu-latest'
run: |
sudo apt remove llvm-* clang-* python3-lldb-* libunwind-* libc++abi1-* libc++1-*
wget -O /tmp/llvm.sh https://apt.llvm.org/llvm.sh
chmod +x /tmp/llvm.sh
sudo /tmp/llvm.sh 17
sudo apt update && sudo apt install -y cmake doxygen clang-17 libc++abi-17-dev libc++-17-dev llvm-17-dev nasm
echo "NB_CPU=$(grep -c ^processor /proc/cpuinfo)" >> $GITHUB_ENV
echo "CC=clang-17" >> $GITHUB_ENV
echo "CXX=clang++-17" >> $GITHUB_ENV
- name: Prepare common environment
run: |
mkdir build
mkdir artifact
- name: Prepare Windows environment
if: matrix.variants.os == 'windows-latest'
shell: pwsh
run: |
New-Item -ItemType SymbolicLink -Target "..\pwn--" -Path "..\pwn++" -ErrorAction Continue
- name: Prepare Linux environment
if: matrix.variants.os == 'ubuntu-latest'
shell: bash
run: |
echo ln -s ../pwn++ ../pwn--
- name: Build environment information
run: env
- name: Initialize cmake
if: matrix.variants.os == 'windows-latest'
run: |
cmake -S . -B ./build -A ${{ matrix.variants.arch }} ${{ env.CMAKE_FLAGS }}
- name: Initialize cmake (Linux)
if: matrix.variants.os == 'ubuntu-latest'
run: |
cmake -S . -B ./build ${{ env.CMAKE_FLAGS }}
- name: Build pwn++ library
run: |
cmake --build ./build --verbose --parallel ${{ env.NB_CPU }} --config ${{ matrix.variants.config }}
- name: Run tests
if: matrix.variants.build == 'full' && matrix.variants.config == 'RelWithDebInfo' && ( matrix.variants.arch == 'x86' || matrix.variants.arch == 'x64' )
continue-on-error: true
run: |
ctest --parallel ${{ env.NB_CPU }} --progress --build-config ${{ matrix.variants.config }} -T test --test-dir ./build
- name: Populate the successful output (Windows)
id: output_success_win
if: ${{ matrix.variants.os == 'windows-latest' && success() }}
run: |
echo '${{ matrix.variants.os }}-${{ matrix.variants.arch }}-${{ matrix.variants.build }}=✅ ${{ matrix.variants.os }} ➤ ${{ matrix.variants.arch }} ➤ ${{ matrix.variants.build }}' | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Populate the failure output (Windows)
id: output_failure_win
if: ${{ matrix.variants.os == 'windows-latest' && failure() }}
run: |
echo '${{ matrix.variants.os }}-${{ matrix.variants.arch }}-${{ matrix.variants.build }}=❌ ${{ matrix.variants.os }} ➤ ${{ matrix.variants.arch }} ➤ ${{ matrix.variants.build }}' | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
return -1
- name: Populate the successful output (Linux)
id: output_success_lin
if: ${{ matrix.variants.os == 'ubuntu-latest' && success() }}
run: |
echo '${{ matrix.variants.os }}-${{ matrix.variants.arch }}-${{ matrix.variants.build }}=✅ ${{ matrix.variants.os }} ➤ ${{ matrix.variants.arch }} ➤ ${{ matrix.variants.build }}' >> ${GITHUB_OUTPUT}
- name: Populate the failure output (Linux)
id: output_failure_lin
if: ${{ matrix.variants.os == 'ubuntu-latest' && failure() }}
run: |
echo '${{ matrix.variants.os }}-${{ matrix.variants.arch }}-${{ matrix.variants.build }}=❌ ${{ matrix.variants.os }} ➤ ${{ matrix.variants.arch }} ➤ ${{ matrix.variants.build }}' >> ${GITHUB_OUTPUT}
exit 1
- name: Install library
if: matrix.variants.config == 'RelWithDebInfo'
run: |
cmake --install ./build --config ${{ matrix.variants.config }} --prefix ./artifact --verbose
- name: Publish artifact
if: matrix.variants.config == 'RelWithDebInfo'
uses: actions/upload-artifact@v3
with:
name: ${{ env.PROJECT_NAME }}_${{ matrix.variants.arch }}_${{ matrix.variants.os }}_${{ matrix.variants.config }}_${{ github.sha }}_${{ matrix.variants.build }}
path: artifact/
notify:
runs-on: 'ubuntu-latest'
needs: build
steps:
- name: Send Discord notification
env:
COMMIT_URL: "https://github.com/${{ env.REPO }}/commit/${{ github.sha }}"
RUN_URL: "https://github.com/${{ env.REPO }}/actions/runs/${{ github.run_id }}"
BRANCH_URL: "https://github.com/${{ env.REPO }}/tree/${{ github.ref_name }}"
AUTHOR_URL: "https://github.com/${{ github.actor }}"
uses: sarisia/[email protected]
with:
nodetail: true
title: 🚧 🚧 Summary of Build `${{ github.sha }}` for `${{ env.REPO }}` 🚧 🚧
description: |
[Job #${{ github.run_number }}](${{ env.RUN_URL }}): CI build `${{ github.sha }}` initiated by [${{ github.actor }}](${{ env.AUTHOR_URL }}):
● Commit [${{ github.sha }}](${{ env.COMMIT_URL }})
● Branch [`${{ github.ref_name }}`](${{ env.BRANCH_URL }})
● [Detail Page](${{ env.RUN_URL }})
${{ needs.build.outputs.windows-latest-x64-full }}
${{ needs.build.outputs.windows-latest-win32-full }}
${{ needs.build.outputs.windows-latest-arm-full }}
${{ needs.build.outputs.windows-latest-arm64-full }}
${{ needs.build.outputs.ubuntu-latest-x64-full }}
${{ needs.build.outputs.ubuntu-latest-x86-full }}
color: 0x0000ff
username: ${{ github.actor }} via GithubBot
avatar_url: ${{ github.actor.avatar_url }}