-
Notifications
You must be signed in to change notification settings - Fork 37
120 lines (103 loc) · 3.61 KB
/
server.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
name: Build Globed server
on:
workflow_dispatch:
push:
jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: Linux
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
bin-suffix: "-x64"
- name: Linux ARM64
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
bin-suffix: "-arm64"
- name: Windows
os: windows-latest
target: x86_64-pc-windows-msvc
bin-suffix: ".exe"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
target: ${{ matrix.target }}
- name: Add Rust target
if: matrix.target != 'aarch64-unknown-linux-gnu'
run: rustup target add ${{ matrix.target }}
shell: bash
- name: Install cross
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
rustup target add x86_64-unknown-linux-gnu
cargo install cross
shell: bash
- name: Build game server (native)
if: matrix.target != 'aarch64-unknown-linux-gnu'
run: |
cd server
cargo build --release --target ${{ matrix.target }} -p globed-game-server
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true
shell: bash
- name: Build game server (cross)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
cd server
cross build --release --target ${{ matrix.target }} -p globed-game-server
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true
shell: bash
- name: Build central server (native)
if: matrix.target != 'aarch64-unknown-linux-gnu'
run: |
cd server/central
SQLX_OFFLINE=true cargo build --release --target ${{ matrix.target }}
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true
shell: bash
- name: Build central server (cross)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
cd server
cross build --release --target ${{ matrix.target }} -p globed-central-server
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true
shell: bash
- name: Create artifacts folder
run: mkdir -p server/artifacts
shell: bash
- name: Copy artifacts (Windows)
if: matrix.os == 'windows-latest'
run: |
cp server/target/${{ matrix.target }}/release/globed-game-server.exe server/artifacts/globed-game-server${{ matrix.bin-suffix }} || :
cp server/target/${{ matrix.target }}/release/globed-central-server.exe server/artifacts/globed-central-server${{ matrix.bin-suffix }} || :
shell: bash
- name: Copy artifacts (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
cp server/target/${{ matrix.target }}/release/globed-game-server server/artifacts/globed-game-server${{ matrix.bin-suffix }} || :
cp server/target/${{ matrix.target }}/release/globed-central-server server/artifacts/globed-central-server${{ matrix.bin-suffix }} || :
shell: bash
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}-build
path: server/artifacts/*
merge:
name: Merge artifacts
runs-on: ubuntu-latest
needs: build
steps:
- name: Merge artifacts
uses: actions/upload-artifact/merge@v4
with:
name: globed-server-build
delete-merged: true