1
- name : Release
1
+ name : Cross-Platform and Cross-Architecture Release Build
2
2
3
3
on :
4
4
push :
7
7
8
8
jobs :
9
9
build-and-release :
10
- runs-on : ubuntu-latest
10
+ runs-on : ${{ matrix.config.os }}
11
+ strategy :
12
+ fail-fast : false
13
+ matrix :
14
+ config :
15
+ # Define combinations of operating systems and architectures
16
+ - {os: ubuntu-latest, arch: x64, server-artifact: serial_server_linux_x64, client-artifact: serial_client_linux_x64}
17
+ - {os: ubuntu-latest, arch: arm64, server-artifact: serial_server_linux_arm64, client-artifact: serial_client_linux_arm64}
18
+ - {os: windows-latest, arch: x64, server-artifact: serial_server_windows_x64.exe, client-artifact: serial_client_windows_x64.exe}
19
+ - {os: windows-latest, arch: arm64, server-artifact: serial_server_windows_arm64.exe, client-artifact: serial_client_windows_arm64.exe}
20
+ - {os: macos-latest, arch: x64, server-artifact: serial_server_mac_x64, client-artifact: serial_client_mac_x64}
21
+ - {os: macos-latest, arch: arm64, server-artifact: serial_server_mac_arm64, client-artifact: serial_client_mac_arm64}
11
22
12
23
steps :
13
24
- uses : actions/checkout@v3
25
+
14
26
- name : Set up Python
15
27
uses : actions/setup-python@v4
16
28
with :
17
29
python-version : ' 3.x'
18
- - name : Install dependencies
30
+
31
+ - name : Install dependencies (Ubuntu)
32
+ if : startsWith(matrix.config.os, 'ubuntu')
19
33
run : |
20
34
sudo apt-get update
21
35
sudo apt-get install -y libboost-all-dev
36
+
37
+ - name : Install dependencies (macOS)
38
+ if : startsWith(matrix.config.os, 'macos')
39
+ run : |
40
+ brew install boost
41
+
42
+ - name : Install dependencies (Windows)
43
+ if : startsWith(matrix.config.os, 'windows')
44
+ run : |
45
+ choco install boost-msvc-14.2
46
+
47
+ - name : Set up CMake (All platforms)
48
+ uses : lukka/get-cmake@latest
49
+
50
+ - name : Configure CMake
51
+ run : |
52
+ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_ARCHITECTURE_ID=${{ matrix.config.arch }}
53
+
22
54
- name : Build
23
55
run : |
24
- cmake -S . -B build
25
- cmake --build build
26
- - name : Archive Production Artifacts
56
+ cmake --build build --config Release
57
+
58
+ - name : Archive Server Production Artifacts
27
59
uses : actions/upload-artifact@v3
28
60
with :
29
- name : binaries
30
- path : build/
61
+ name : ${{ matrix.config.server-artifact }}
62
+ path : build/${{ matrix.config.server-artifact }}
63
+
64
+ - name : Archive Client Production Artifacts
65
+ uses : actions/upload-artifact@v3
66
+ with :
67
+ name : ${{ matrix.config.client-artifact }}
68
+ path : build/${{ matrix.config.client-artifact }}
69
+
31
70
- name : Create Release
32
71
id : create_release
33
72
uses : actions/create-release@v1
@@ -38,12 +77,54 @@ jobs:
38
77
release_name : Release ${{ github.ref }}
39
78
draft : false
40
79
prerelease : false
41
- - name : Upload Release Asset
80
+
81
+ - name : Upload Server Release Asset
82
+ uses : actions/upload-release-asset@v2
83
+ env :
84
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
85
+ with :
86
+ upload_url : ${{ steps.create_release.outputs.upload_url }}
87
+ asset_path : ./build/${{ matrix.config.server-artifact }}
88
+ asset_name : ${{ matrix.config.server-artifact }}
89
+ asset_content_type : application/octet-stream
90
+
91
+ - name : Upload Client Release Asset
42
92
uses : actions/upload-release-asset@v2
43
93
env :
44
94
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
45
95
with :
46
96
upload_url : ${{ steps.create_release.outputs.upload_url }}
47
- asset_path : ./build/serial_server
48
- asset_name : serial_server
97
+ asset_path : ./build/${{ matrix.config.client-artifact }}
98
+ asset_name : ${{ matrix.config.client-artifact }}
49
99
asset_content_type : application/octet-stream
100
+
101
+ container-image :
102
+ runs-on : ubuntu-latest
103
+ strategy :
104
+ matrix :
105
+ component : [server, client]
106
+
107
+ steps :
108
+ - name : Checkout code
109
+ uses : actions/checkout@v2
110
+
111
+ - name : Set up Docker Buildx
112
+ uses : docker/setup-buildx-action@v1
113
+
114
+ - name : Login to GitHub Container Registry
115
+ uses : docker/login-action@v3
116
+ with :
117
+ registry : ghcr.io
118
+ username : ${{ github.actor }}
119
+ password : ${{ secrets.GITHUB_TOKEN }}
120
+
121
+ - name : Build container image
122
+ run : make build-${{ matrix.component }}-image
123
+
124
+ - name : Tag containner image
125
+ run : make tag-${{ matrix.component }}-image
126
+
127
+ - name : Push containner images
128
+ run : make push-${{ matrix.component }}-images
129
+
130
+
0 commit comments