-
-
Notifications
You must be signed in to change notification settings - Fork 2
179 lines (152 loc) · 6.02 KB
/
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
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: Build
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
tags:
description: 'Manual'
push:
branches: [ "master", "dev" ]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
build_type: Release
jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:
- name: Clone prodatum repository
uses: actions/checkout@v3
- name: Clone fltk repository
uses: actions/checkout@v3
with:
repository: haxorhax/fltk
path: lib/fltk
- name: Clone portmidi repository
uses: actions/checkout@v3
with:
repository: haxorhax/portmidi
path: lib/portmidi
- name: Install needed OS packages
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
echo "$RUNNER_OS supported"
elif [ "$RUNNER_OS" == "Linux" ]; then
sudo apt install libasound2-dev
sudo apt install zlib1g-dev
sudo apt install libpng-dev
sudo apt install libgl1-mesa-dev
sudo apt install libglu1-mesa-dev
sudo apt install libx11-dev
sudo apt install libxinerama-dev
sudo apt install libxft-dev
sudo apt install libfontconfig-dev
elif [ "$RUNNER_OS" == "macOS" ]; then
echo "$RUNNER_OS not supported yet"
else
echo "$RUNNER_OS not supported"
exit 1
fi
shell: bash
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.build_type}}
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.build_type}}
- name: Rename windows artifact
if: ${{ matrix.os == 'windows-latest' }}
run: mv ./build/${{env.build_type}}/prodatum.exe ./build/${{env.build_type}}/prodatum-win-x64.exe
- name: Upload a windows build artifact
if: ${{ matrix.os == 'windows-latest' }}
uses: actions/[email protected]
with:
name: prodatum-${{ matrix.os }}
path: ./build/${{env.build_type}}/prodatum-win-x64.exe
- name: Rename linux artifact
if: ${{ matrix.os == 'ubuntu-latest' }}
run: mv ./build/prodatum ./build/prodatum-linux-x86_64
- name: Upload a linux build artifact
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/[email protected]
with:
name: prodatum-${{ matrix.os }}
path: ./build/prodatum-linux-x86_64
- name: Rename macos artifact
if: ${{ matrix.os == 'macos-latest' }}
run: mv ./build/prodatum ./build/prodatum-macos-x64
- name: Upload a macos build artifact
if: ${{ matrix.os == 'macos-latest' }}
uses: actions/[email protected]
with:
name: prodatum-${{ matrix.os }}
path: ./build/prodatum-macos-x64
release:
name: Prepare release draft
# Make sure (and wait until) the builds have succeeded
needs: build
runs-on: ubuntu-latest
steps:
- name: Check if tag exists
if: ${{ !(github.event_name == 'workflow_dispatch') }}
# Note the ! - it will return 0 if the command fails, and 1 otherwise
run: '! git rev-parse "v${{steps.ref.outputs.version}}"'
- name: Make release directory
run: mkdir ./release
# First, download all resulting assets from the previous steps.
- name: Retrieve windows installers
uses: actions/download-artifact@v2
with:
name: prodatum-windows-latest
path: ./release
- name: Retrieve macOS images
uses: actions/download-artifact@v2
with:
name: prodatum-macos-latest
path: ./release
- name: Retrieve Linux installers
uses: actions/download-artifact@v2
with:
name: prodatum-ubuntu-latest
path: ./release
# Now we are set, we have all five release assets on the VM. It's time to
# create the SHA-checksums file and then upload everything!
- name: Generate SHA256 checksums
run: |
cd ./release
ls -al
sha256sum "prodatum-win-x64.exe" > "SHA256SUMS.txt"
sha256sum "prodatum-linux-x86_64" >> "SHA256SUMS.txt"
sha256sum "prodatum-macos-x64" >> "SHA256SUMS.txt"
cd ..
- name: Verify checksums
run: |
cd ./release
sha256sum -c SHA256SUMS.txt
cd ..
# OTHERWISE: Create a new release draft
- name: Create release draft
if: github.ref == 'refs/heads/master'
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Populate the inputs of the release we already know
tag_name: v${{steps.ref.outputs.version}}
name: Release v${{steps.ref.outputs.version}}
body: Changelog
draft: true # Always create as draft, so that we can populate the remaining values easily
files: |
./release/prodatum-win-x64.exe
./release/prodatum-linux-x86_64
./release/prodatum-macos-x64
./release/SHA256SUMS.txt