-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (106 loc) · 4.14 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
name: Cross-Platform and Cross-Architecture Release Build
on:
push:
tags:
- 'v*'
jobs:
build-and-release:
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
# Define combinations of operating systems and architectures
- {os: ubuntu-latest, arch: x64, server-artifact: serial_server_linux_x64, client-artifact: serial_client_linux_x64}
- {os: ubuntu-latest, arch: arm64, server-artifact: serial_server_linux_arm64, client-artifact: serial_client_linux_arm64}
- {os: windows-latest, arch: x64, server-artifact: serial_server_windows_x64.exe, client-artifact: serial_client_windows_x64.exe}
- {os: windows-latest, arch: arm64, server-artifact: serial_server_windows_arm64.exe, client-artifact: serial_client_windows_arm64.exe}
- {os: macos-latest, arch: x64, server-artifact: serial_server_mac_x64, client-artifact: serial_client_mac_x64}
- {os: macos-latest, arch: arm64, server-artifact: serial_server_mac_arm64, client-artifact: serial_client_mac_arm64}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies (Ubuntu)
if: startsWith(matrix.config.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y libboost-all-dev
- name: Install dependencies (macOS)
if: startsWith(matrix.config.os, 'macos')
run: |
brew install boost
- name: Install dependencies (Windows)
if: startsWith(matrix.config.os, 'windows')
run: |
choco install boost-msvc-14.2
- name: Set up CMake (All platforms)
uses: lukka/get-cmake@latest
- name: Configure CMake
run: |
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_ARCHITECTURE_ID=${{ matrix.config.arch }}
- name: Build
run: |
cmake --build build --config Release
- name: Archive Server Production Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.config.server-artifact }}
path: build/${{ matrix.config.server-artifact }}
- name: Archive Client Production Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.config.client-artifact }}
path: build/${{ matrix.config.client-artifact }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Server Release Asset
uses: actions/upload-release-asset@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/${{ matrix.config.server-artifact }}
asset_name: ${{ matrix.config.server-artifact }}
asset_content_type: application/octet-stream
- name: Upload Client Release Asset
uses: actions/upload-release-asset@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/${{ matrix.config.client-artifact }}
asset_name: ${{ matrix.config.client-artifact }}
asset_content_type: application/octet-stream
container-image:
runs-on: ubuntu-latest
strategy:
matrix:
component: [server, client]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build container image
run: make build-${{ matrix.component }}-image
- name: Tag containner image
run: make tag-${{ matrix.component }}-image
- name: Push containner images
run: make push-${{ matrix.component }}-images