-
Notifications
You must be signed in to change notification settings - Fork 11
90 lines (79 loc) · 2.64 KB
/
sniffcraft_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
name: Sniffcraft Build
on:
workflow_call:
inputs:
os:
description: OS we want to build for
required: true
type: string
version:
description: Minecraft Version
required: false
default: latest
type: string
issue:
description: URL of the issue requesting this build
required: false
default: ""
type: string
env:
BUILD_TYPE: Release
CMAKE_GENERATOR: ${{ inputs.os == 'windows-latest' && 'Visual Studio 17 2022' || 'Unix Makefiles' }}
VERSION: ${{ inputs.version }}
ISSUE_URL: ${{ inputs.issue }}
jobs:
build:
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Linux deps
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -y xorg-dev
- name: Create build folder
run: cmake -E make_directory ${{ runner.workspace }}/build
- name: Configure cmake
shell: bash
working-directory: ${{ runner.workspace }}/build
run: >
cmake -G "$CMAKE_GENERATOR"
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
-DGAME_VERSION="$VERSION"
-DSNIFFCRAFT_WITH_ENCRYPTION=ON
-DSNIFFCRAFT_FORCE_LOCAL_ZLIB=ON
-DSNIFFCRAFT_FORCE_LOCAL_OPENSSL=ON
-DSNIFFCRAFT_WITH_GUI=ON
-S $GITHUB_WORKSPACE
-B .
- name: Upload version artifact
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: MC-version
path: ${{ runner.workspace }}/build/version.txt
retention-days: 1
- name: Build all
shell: bash
id: build
working-directory: ${{ runner.workspace }}/build
run: cmake --build . --config $BUILD_TYPE --parallel 2
- name: Notify issue if build failed
if: failure() && steps.build.conclusion == 'failure' && inputs.issue
shell: bash
run: |
echo "${{ runner.os }} build failed. Logs can be found [here](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})." > body.txt
echo -en '\n' >> body.txt
echo -en '\n' >> body.txt
echo @${{ github.repository_owner }} you might want to take a look. >> body.txt
gh issue comment $ISSUE_URL --repo ${{ github.repository }} --body-file body.txt
env:
GH_TOKEN: ${{ github.token }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: sniffcraft-${{ runner.os }}
path: ${{ github.workspace }}/bin/sniffcraft*
retention-days: 1