-
Notifications
You must be signed in to change notification settings - Fork 5
147 lines (129 loc) · 5.4 KB
/
nightly-builds.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
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
name: nightly-builds
on: push
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
cmake_preset: ci-windows-x86
build_conf: Debug
devenv_arch: amd64_x86
env:
# Indicates the location of the vcpkg as a Git submodule of the project repository.
VCPKG_ROOT: ${{ github.workspace }}/external/vcpkg
# Tells vcpkg where binary packages are stored.
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/external/vcpkg/bincache
# Let's use GitHub Action cache as storage for the vcpkg Binary Caching feature.
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
steps:
# Set env vars needed for vcpkg to leverage the GitHub Action cache as a storage
# for Binary Caching.
- name: Set env vars needed for vcpkg to leverage the GitHub Action cache
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Create build environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{github.workspace}}/build
- uses: ilammy/[email protected]
if: runner.os == 'Windows'
with:
arch: ${{ matrix.devenv_arch }}
- name: Install ninja-build tool
uses: seanmiddleditch/gha-setup-ninja@v4
- name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'"
shell: bash
run: mkdir -p $VCPKG_DEFAULT_BINARY_CACHE
# Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg's binary caching
# when it is being run afterwards by CMake.
- name: Restore vcpkg
uses: actions/cache@v3
with:
# The first path is the location of vcpkg: it contains the vcpkg executable and data files, as long as the
# built package archives (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE env var.
# The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages.
path: |
${{ env.VCPKG_ROOT }}
!${{ env.VCPKG_ROOT }}/buildtrees
!${{ env.VCPKG_ROOT }}/packages
!${{ env.VCPKG_ROOT }}/downloads
!${{ env.VCPKG_ROOT }}/installed
# The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used.
key: |
${{ hashFiles( '.git/modules/external/vcpkg/HEAD' )}}
- name: Configure CMake
working-directory: ${{ github.workspace }}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake "${{ github.workspace }}" --preset ${{ matrix.cmake_preset }}
- name: Build
working-directory: ${{github.workspace}}/build
run: cmake --build . --parallel 4
- name: Prepare artifacts
shell: bash
run: |
ls -l build/
mkdir publish/
mkdir artifacts/
cp build/${{ matrix.build_conf }}/bin/gsm-library.dll publish/gsm-library.dll
cp build/${{ matrix.build_conf }}/bin/gsm-loader.exe publish/gsm-loader.exe
cp -r resources/program_dir/* publish
# we forced to do this split because Git on Windows can't use zip, bruh
- name: Pack artifact files to archive (Windows)
if: runner.os == 'Windows'
run: |
Compress-Archive -Path publish\* -Destination artifacts\goldsrc-monitor_${{ matrix.cmake_preset }}.zip
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: artifact-${{ matrix.cmake_preset }}
path: artifacts/*
release:
name: release-builds
runs-on: ubuntu-latest
needs: [build]
if: ${{ github.ref == 'refs/heads/master' }}
steps:
- name: Fetch artifacts
uses: actions/[email protected]
with:
path: artifacts/
- name: Remove old release
uses: dev-drprasad/[email protected]
with:
delete_release: true
tag_name: continuous
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Repackage binaries and allow GitHub to process removed release for few seconds
shell: bash
continue-on-error: true
run: |
cd artifacts/
for i in artifact-*; do
mv "$i"/* .
rm -rf "$i"
done
ls -R .
cd ../
sleep 20s
- name: Upload new release
uses: softprops/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: artifacts/*
tag_name: continuous
draft: false
prerelease: true
name: GoldSrc Monitor Continuous Build