-
Notifications
You must be signed in to change notification settings - Fork 103
144 lines (124 loc) · 4.95 KB
/
release.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
name: Release
on:
release:
types:
- created
jobs:
build-windows:
name: Windows x86 build
runs-on: windows-2019
strategy:
matrix:
arch: [Win32, x64]
steps:
- uses: actions/checkout@v3
with:
clean: true
ref: stable
submodules: recursive
token: ${{ secrets.CI_TOKEN }}
fetch-depth: 0
- name: Declare build output variables
id: vars
shell: bash
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
echo "build_version=$(git describe --always --tags "refs/remotes/origin/${HEAD_REF}")" >> $GITHUB_OUTPUT
echo "build_config=RelWithDebInfo" >> $GITHUB_OUTPUT
- name: Setup Python
uses: actions/setup-python@v2
- name: Install CMake
uses: lukka/[email protected]
- name: Install latest conan
run: |
python -m pip install --upgrade pip
pip install -v "conan==1.57.0"
- name: Generate build files
run: |
$env:OMP_BUILD_VERSION=$(git rev-list $(git rev-list --max-parents=0 HEAD) HEAD | Measure-Object -Line).Lines
$env:OMP_BUILD_COMMIT=$(git rev-parse HEAD)
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=${{ steps.vars.outputs.build_config }} .. -A ${{ matrix.arch }} -T "ClangCL"
- name: Build
run: |
cd build
cmake --build . --config ${{ steps.vars.outputs.build_config }}
- name: Create a build archive
id: build
shell: bash
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
version=${{ steps.vars.outputs.build_version }}
artifact_name="open.mp-win-${{ matrix.arch }}-${version}"
echo "artifact_name=${artifact_name}" >> $GITHUB_OUTPUT
cd build/Output/*
powershell -NoLogo -NoProfile -Command Compress-Archive -DestinationPath "${artifact_name}.zip" -Path "Server"
- name: Upload to release
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: build/Output/${{ steps.vars.outputs.build_config }}/${{ steps.build.outputs.artifact_name }}.zip
asset_name: ${{ steps.build.outputs.artifact_name }}.zip
asset_content_type: application/gzip
build-linux:
name: Linux build
runs-on: ubuntu-latest
strategy:
matrix:
arch: [x86, x86_64]
ssl: [dynamic, static]
steps:
- uses: actions/checkout@v3
with:
clean: true
ref: stable
submodules: recursive
token: ${{ secrets.CI_TOKEN }}
fetch-depth: 0
- name: Declare build output variables
id: vars
shell: bash
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
echo "build_version=$(git describe --always --tags "refs/remotes/origin/${HEAD_REF}")" >> $GITHUB_OUTPUT
echo "build_config=RelWithDebInfo" >> $GITHUB_OUTPUT
echo "build_ubuntu_version=18.04" >> $GITHUB_OUTPUT
echo "build_shared=${{ matrix.ssl == 'dynamic' }}" >> $GITHUB_OUTPUT
echo "build_server=1" >> $GITHUB_OUTPUT
echo "build_tools=0" >> $GITHUB_OUTPUT
echo "build_target_arch=${{ matrix.arch }}" >> $GITHUB_OUTPUT
- name: Set ownership
run: |
# this is to fix GIT not liking owner of the checkout dir
chown -R $(id -u):$(id -g) $PWD
- name: Build
run: |
cd docker
CONFIG=${{ steps.vars.outputs.build_config }} UBUNTU_VERSION=${{ steps.vars.outputs.build_ubuntu_version }} BUILD_SHARED=${{ steps.vars.outputs.build_shared }} BUILD_SERVER=${{ steps.vars.outputs.build_server }} BUILD_TOOLS=${{ steps.vars.outputs.build_tools }} TARGET_BUILD_ARCH=${{ steps.vars.outputs.build_target_arch }} ./build.sh
- name: Create a build archive
id: build
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
version=${{ steps.vars.outputs.build_version }}
artifact_name="open.mp-linux-${{ matrix.arch }}${{ matrix.ssl == 'dynamic' && '-dynssl' || '' }}-${version}"
echo "artifact_name=${artifact_name}" >> $GITHUB_OUTPUT
cd docker/build/Output/*
sudo tar -cJvf "${artifact_name}.tar.xz" "Server"
- name: Upload to release
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: docker/build/Output/${{ steps.vars.outputs.build_config }}/${{ steps.build.outputs.artifact_name }}.tar.xz
asset_name: ${{ steps.build.outputs.artifact_name }}.tar.xz
asset_content_type: application/gzip