-
Notifications
You must be signed in to change notification settings - Fork 1
116 lines (98 loc) · 3.22 KB
/
Copy pathCI.yml
File metadata and controls
116 lines (98 loc) · 3.22 KB
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
name: CI
env:
VERSION_BASE: '2.0.0'
on:
push:
paths-ignore:
- .gitignore
- README.md
- LICENSE
pull_request:
paths-ignore:
- .gitignore
- README.md
- LICENSE
workflow_dispatch:
jobs:
build-windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- arch: win64
platform: x64
- arch: win32
platform: Win32
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: microsoft/setup-msbuild@v1.1
- name: Resolve version
run: |
$sha = "${{ github.sha }}"
$shortSha = $sha.Substring(0,7)
$branch = "${{ github.head_ref || github.ref_name }}" -replace '/','-'
Add-Content -Path $env:GITHUB_ENV -Value "SHORT_SHA=$shortSha"
Add-Content -Path $env:GITHUB_ENV -Value "BRANCH_NAME=$branch"
- name: Configure
run: cmake -S . -B build -A ${{ matrix.platform }}
- name: Build the plugin
run: cmake --build build --config Release
- name: Prepare artifact
run: |
New-Item -ItemType Directory -Force -Path dist | Out-Null
Copy-Item -Path "build/Release/*" -Destination dist -Recurse -Force
Get-ChildItem -Path dist -Include *.lib,*.exp -Recurse | Remove-Item -Force
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ github.event_name == 'workflow_dispatch' && format('vpDiscordRPC-{0}-{1}-{2}', matrix.arch, env.VERSION_BASE, env.BRANCH_NAME) || format('vpDiscordRPC-win-{0}-{1}-{2}-nightly-{3}', matrix.arch, env.VERSION_BASE, env.BRANCH_NAME, env.SHORT_SHA) }}
path: dist/
build-linux:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
- arch: x64
cflags: ''
- arch: x86
cflags: '-m32'
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Resolve version
run: |
sha="${{ github.sha }}"
shortSha="${sha:0:7}"
branch="${{ github.head_ref || github.ref_name }}"
branch="${branch//\//-}"
echo "SHORT_SHA=$shortSha" >> $GITHUB_ENV
echo "BRANCH_NAME=$branch" >> $GITHUB_ENV
- name: Install toolchain
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake
if [ "${{ matrix.arch }}" = "x86" ]; then
sudo apt-get install -y gcc-multilib g++-multilib
fi
- name: Configure
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS="${{ matrix.cflags }}" \
-DCMAKE_CXX_FLAGS="${{ matrix.cflags }}"
- name: Build the plugin
run: cmake --build build -j$(nproc)
- name: Prepare artifact
run: |
mkdir -p dist
cp -av build/Release/. dist/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ github.event_name == 'workflow_dispatch' && format('vpDiscordRPC-linux-{0}-{1}-{2}', matrix.arch, env.VERSION_BASE, env.BRANCH_NAME) || format('vpDiscordRPC-linux-{0}-{1}-{2}-nightly-{3}', matrix.arch, env.VERSION_BASE, env.BRANCH_NAME, env.SHORT_SHA) }}
path: dist/