-
Notifications
You must be signed in to change notification settings - Fork 8
162 lines (155 loc) · 4.96 KB
/
ci.yaml
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
name: CI
on:
pull_request:
paths-ignore:
- '**/README.md'
- '**/CONTRIBUTING.md'
- '**/LICENSE-MIT'
- '**/LICENSE-APACHE-2.0'
- '**/.vscode/**'
- '**/docs/**'
- '**/.gitignore'
- '**/.gitattributes'
- '**/.editorconfig'
permissions:
contents: write
jobs:
run-linters:
name: Run linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install nightly
run: |
rustup update --no-self-update nightly
rustup component add --toolchain nightly rustfmt
- name: Format check
run: cargo +nightly fmt --check
gen-build-version:
needs: run-linters
name: Generate Build Version
runs-on: ubuntu-latest
outputs:
build: ${{ steps.build_name.outputs.build }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get the cargo package version
run: |
VERSION=$(awk -F '"' '/^version =/ { print $2 }' Cargo.toml)
echo "The package version is $VERSION"
echo "NEXT_VERSION=$VERSION" >> $GITHUB_ENV
- name: Set short git commit SHA
shell: bash
run: |
CALCULATED_SHA=$(git rev-parse --short ${{ github.sha }})
echo "SHA_SHORT=$CALCULATED_SHA" >> $GITHUB_ENV
- name: Confirm git commit SHA output
run: echo $SHA_SHORT
- name: Extract branch name
shell: bash
run: |
BRANCH_NAME=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
echo "BRANCH=${BRANCH_NAME/\//\\\/}" >> $GITHUB_ENV
- name: Confirm nightly build name
id: build_name
run: |
echo ${NEXT_VERSION}-${BRANCH}-${SHA_SHORT}
echo build="${NEXT_VERSION}-${BRANCH}-${SHA_SHORT}" >> $GITHUB_OUTPUT
build-windows:
needs: gen-build-version
name: Build Windows
runs-on: windows-2019
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
shared-key: "windows"
- name: Update build number
run: |
sed -i 's/Config.gameVersion = \".*\"/Config.gameVersion = \"${{ needs.gen-build-version.outputs.build }}\"/' "${env:GITHUB_WORKSPACE}/script/Config/Version.lua"
- name: Build
shell: bash
run: |
export PHX_VERSION="${{ needs.gen-build-version.outputs.build }}"
./build.sh --run-tests
- name: Upload development binaries
uses: actions/upload-artifact@v4
with:
name: dev-binaries-windows
path: ${{github.workspace}}/bin/*
- name: Upload distributable
uses: actions/upload-artifact@v4
with:
name: ltheory-windows
path: |
${{github.workspace}}/bin/*
!${{github.workspace}}/bin/*.pdb
${{github.workspace}}/docs/*
${{github.workspace}}/engine/lib/phx/script/*
${{github.workspace}}/res/*
${{github.workspace}}/script/*
${{github.workspace}}/LICENSE
${{github.workspace}}/README.md
build-macos:
needs: gen-build-version
name: Build macOS
runs-on: macos-12
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
shared-key: "macos"
- name: Build
run: |
export PHX_VERSION="${{ needs.gen-build-version.outputs.build }}"
./build.sh --run-tests --bundle
- name: Upload development binaries
uses: actions/upload-artifact@v4
with:
name: dev-binaries-macos
path: |
${{github.workspace}}/bin/*
!${{github.workspace}}/bin/*.app
- name: Upload distributable
uses: actions/upload-artifact@v4
with:
name: ltheory-macos
path: ${{github.workspace}}/bin/*.app
build-linux:
needs: gen-build-version
name: Build Linux (Ubuntu 20.04)
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Update packages
run: sudo apt-get update
- name: Install packages
run: sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev libasound2-dev libudev-dev
- uses: Swatinem/rust-cache@v2
with:
shared-key: "linux"
- name: Build
run: |
export PHX_VERSION="${{ needs.gen-build-version.outputs.build }}"
./build.sh --run-tests
- name: Upload development binaries
uses: actions/upload-artifact@v4
with:
name: dev-binaries-linux
path: ${{github.workspace}}/bin/*
- name: Upload distributable
uses: actions/upload-artifact@v4
with:
name: ltheory-linux
path: |
${{github.workspace}}/bin/*
${{github.workspace}}/docs/*
${{github.workspace}}/engine/lib/phx/script/*
${{github.workspace}}/res/*
${{github.workspace}}/script/*
${{github.workspace}}/LICENSE
${{github.workspace}}/README.md