-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (125 loc) · 3.9 KB
/
Copy pathbuild.yml
File metadata and controls
150 lines (125 loc) · 3.9 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
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
name: Build
on:
push:
branches:
- master
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
build-desktop:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-15, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: xmake-io/github-action-setup-xmake@v1
with:
xmake-version: latest
- uses: actions/cache@v4
with:
path: ~/.xmake/packages
key: ${{ runner.os }}-xmake-${{ hashFiles('xmake.lua') }}
restore-keys: ${{ runner.os }}-xmake-
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
pkg-config \
libgtk-3-dev \
libgl1-mesa-dev \
libglew-dev \
libx11-dev \
libxrandr-dev \
libxcursor-dev \
libxi-dev \
libdbus-1-dev \
libfontconfig-dev \
libssl-dev \
libcurl4-openssl-dev \
libpulse-dev \
googletest \
libgtest-dev
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: brew install pkg-config googletest
- name: Install dependencies (Windows)
if: runner.os == 'Windows'
run: choco install innosetup
- name: Setup Clang 22 (Linux)
if: runner.os == 'Linux'
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 22 all
- name: Configure (Linux)
if: runner.os == 'Linux'
run: xmake f -m releasedbg --cc=clang-22 --cxx=clang++-22 -y
- name: Configure (macOS)
if: runner.os == 'macOS'
run: xmake f -m releasedbg -y
- name: Configure (Windows)
if: runner.os == 'Windows'
run: xmake f -p windows -m releasedbg --toolchain=clang-cl -y
- name: Build
run: xmake -b example_app
- name: Build Tests
run: xmake -b Tests
- name: Run Tests
run: xmake run Tests
- name: Package
shell: bash
run: |
mkdir -p artifacts
xmake install -o install
if [ "${{ runner.os }}" = "Windows" ]; then
7z a artifacts/${{ runner.os }}.zip ./install/*
elif [ "${{ runner.os }}" = "macOS" ]; then
zip -r artifacts/${{ runner.os }}.zip ./install/
else
tar -czf artifacts/${{ runner.os }}.tar.gz ./install/
fi
- uses: actions/upload-artifact@v4
with:
path: artifacts/*
name: ${{ runner.os }}
release-draft:
runs-on: ubuntu-latest
permissions: write-all
if: github.event_name != 'pull_request'
needs: [build-desktop]
name: "Release draft"
steps:
- uses: actions/checkout@v4
- name: Extract version
run: |
VERSION=$(grep -Po '(?<=set_version\(")[0-9.]+' xmake.lua)
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "VERSION = $VERSION"
- name: Remove old release drafts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api repos/{owner}/{repo}/releases \
--jq '.[] | select(.draft == true) | .id' \
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: 'true'
- name: Create release draft
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "v${{ env.VERSION }}" \
--draft \
--title "v${{ env.VERSION }}" \
--target $GITHUB_SHA \
artifacts/*.*