-
Notifications
You must be signed in to change notification settings - Fork 130
170 lines (162 loc) · 8.34 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
name: Build and Package Drifty
on:
push:
branches: [ "master" ]
paths-ignore:
- "Website/**"
- "*.md"
- "*.txt"
- "qodana.yaml"
pull_request:
branches: [ "master" ]
paths-ignore:
- "Website/**"
- "*.md"
- "*.txt"
- "qodana.yaml"
workflow_dispatch:
inputs:
create_release:
description: 'True to create release, else false'
required: true
type: boolean
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
build-Drifty:
strategy:
matrix:
os: ["windows-latest", "macos-latest", "ubuntu-latest"]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install required build dependencies for Linux
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get install libasound2-dev libavcodec-dev libavformat-dev libavutil-dev libfreetype6-dev
sudo apt-get install libgl-dev libglib2.0-dev libgtk-3-dev libpango1.0-dev libx11-dev libxtst-dev zlib1g-dev
- name: Set up GraalVM JDK 20.0.1
uses: graalvm/setup-graalvm@v1
with:
java-version: '20.0.1'
distribution: 'graalvm-community'
github-token: ${{ secrets.GITHUB_TOKEN }}
set-java-home: true
native-image-job-reports: 'true'
cache: 'maven'
native-image-pr-reports: true
components: 'native-image'
- name: Package Drifty CLI for ${{ matrix.os }} with GraalVM
run: mvn -Pbuild-drifty-cli-for-${{ matrix.os }} package
- name: Set Up Maven version 3.8.8 # For GUI build issues, maven version 3.8.8 needs to be used
uses: stCarolas/setup-maven@v4.5
with:
maven-version: 3.8.8
- name: Build platform-specific C object for missing jdk libraries
run: gcc -c config/missing_symbols.c -o config/missing_symbols-${{ matrix.os }}.o
- name: Package Drifty GUI for ${{ matrix.os }} with GluonFX maven plugin
run: mvn -Pbuild-drifty-gui-for-${{ matrix.os }} gluonfx:build gluonfx:package
- name: Create Application Type specific folders
run: |
mkdir CLI
mkdir GUI
- name: Categorise build artifacts for linux
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
mv "target/CLI/linux/Drifty CLI" "target/CLI/linux/Drifty-CLI_linux"
mv "target/CLI/linux/Drifty-CLI_linux" -t CLI
mv target/gluonfx/x86_64-linux/Drifty "target/gluonfx/x86_64-linux/Drifty-GUI_linux"
mv "target/gluonfx/x86_64-linux/Drifty-GUI_linux" -t GUI
- name: Categorise build artifacts for windows
if: ${{ matrix.os == 'windows-latest' }}
run: |
Rename-Item "target/CLI/windows/Drifty CLI.exe" Drifty-CLI.exe
move "target/CLI/windows/Drifty-CLI.exe" CLI
Rename-Item target/gluonfx/x86_64-windows/Drifty-1.0.msi "Drifty-GUI.msi"
Rename-Item target/gluonfx/x86_64-windows/Drifty.exe "Drifty-GUI.exe"
move "target/gluonfx/x86_64-windows/Drifty-GUI.msi" GUI
move "target/gluonfx/x86_64-windows/Drifty-GUI.exe" GUI
- name: Categorise build artifacts for macOS
if: ${{ matrix.os == 'macos-latest' }}
run: |
mv "target/CLI/macos/Drifty CLI" "target/CLI/macos/Drifty-CLI_macos"
mv "target/CLI/macos/Drifty-CLI_macos" CLI
mv target/gluonfx/x86_64-darwin/Drifty-1.0.0.pkg "target/gluonfx/x86_64-darwin/Drifty-GUI.pkg"
mv target/gluonfx/x86_64-darwin/Drifty.app "target/gluonfx/x86_64-darwin/Drifty-GUI.app"
mv "target/gluonfx/x86_64-darwin/Drifty-GUI.pkg" GUI
mv "target/gluonfx/x86_64-darwin/Drifty-GUI.app" GUI
- name: Tar build files # To prevent file permission loss
run: tar -cvf ${{ matrix.os }}.tar CLI GUI
- name: Push generated artifacts for ${{ matrix.os }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-Build-Files
path: ${{ matrix.os }}.tar
generate-metadata-and-create-release:
runs-on: ubuntu-latest
needs: build-Drifty
steps:
- uses: actions/checkout@v4
- name: Get Drifty version from .version file
run: echo "VERSION=$(jq .version version.json | sed -r 's/"//g')" >> $GITHUB_ENV
- name: Set Drifty version in pom.xml
run: mvn versions:set -DnewVersion=$VERSION
- name: Download Build artifacts
uses: actions/download-artifact@v3
- name: Make OS specific build directories
run: |
mkdir linux
mkdir macos
mkdir windows
- name: Extract build files from tar
run: |
tar -xvf ubuntu-latest-Build-Files/ubuntu-latest.tar -C linux
tar -xvf macos-latest-Build-Files/macos-latest.tar -C macos
tar -xvf windows-latest-Build-Files/windows-latest.tar -C windows
- name: Get Size of Build Artifacts
run: |
echo "CLI_LINUX_SIZE=$(echo `du -h 'linux/CLI/Drifty-CLI_linux'` | sed 's/ .*//')" >> "$GITHUB_ENV"
echo "GUI_LINUX_SIZE=$(echo `du -h 'linux/GUI/Drifty-GUI_linux'` | sed 's/ .*//')" >> "$GITHUB_ENV"
echo "CLI_MACOS_SIZE=$(echo `du -h 'macos/CLI/Drifty-CLI_macos'` | sed 's/ .*//')" >> "$GITHUB_ENV"
echo "GUI_MACOS_PKG_SIZE=$(echo `du -h 'macos/GUI/Drifty-GUI.pkg'` | sed 's/ .*//')" >> "$GITHUB_ENV"
echo "GUI_MACOS_APP_SIZE=$(echo `du -h 'macos/GUI/Drifty-GUI.app'` | sed 's/ .*//')" >> "$GITHUB_ENV"
echo "CLI_WINDOWS_SIZE=$(echo `du -h 'windows/CLI/Drifty-CLI.exe'` | sed 's/ .*//')" >> "$GITHUB_ENV"
echo "GUI_WINDOWS_MSI_SIZE=$(echo `du -h 'windows/GUI/Drifty-GUI.msi'` | sed 's/ .*//')" >> "$GITHUB_ENV"
echo "GUI_WINDOWS_EXE_SIZE=$(echo `du -h 'windows/GUI/Drifty-GUI.exe'` | sed 's/ .*//')" >> "$GITHUB_ENV"
- name: Generate Artifact metadata summary
run: |
echo "# Drifty v$VERSION Built! :rocket:" >> $GITHUB_STEP_SUMMARY
echo "## Build Artifacts :package: Summary :memo:" >> $GITHUB_STEP_SUMMARY
echo "### Artifacts :package: Generated for Linux :penguin:" >> $GITHUB_STEP_SUMMARY
echo "| Application Type | Artifact Name | Size |" >> $GITHUB_STEP_SUMMARY
echo "|------------------|---------------|------|" >> $GITHUB_STEP_SUMMARY
echo "| CLI | Drifty-CLI_linux | $CLI_LINUX_SIZE |" >> $GITHUB_STEP_SUMMARY
echo "| GUI | Drifty-GUI_linux | $GUI_LINUX_SIZE |" >> $GITHUB_STEP_SUMMARY
echo "### Artifacts :package: Generated for macOS :apple:" >> $GITHUB_STEP_SUMMARY
echo "| Application Type | Artifact Name | Size |" >> $GITHUB_STEP_SUMMARY
echo "|------------------|---------------|------|" >> $GITHUB_STEP_SUMMARY
echo "| CLI | Drifty-CLI_macos | $CLI_MACOS_SIZE |" >> $GITHUB_STEP_SUMMARY
echo "| GUI | Drifty-GUI.pkg | $GUI_MACOS_PKG_SIZE |" >> $GITHUB_STEP_SUMMARY
echo "| GUI | Drifty-GUI.app | $GUI_MACOS_APP_SIZE |" >> $GITHUB_STEP_SUMMARY
echo "### Artifacts :package: Generated for Windows :window:" >> $GITHUB_STEP_SUMMARY
echo "| Application Type | Artifact Name | Size |" >> $GITHUB_STEP_SUMMARY
echo "|------------------|---------------|------|" >> $GITHUB_STEP_SUMMARY
echo "| CLI | Drifty-CLI.exe | $CLI_WINDOWS_SIZE |" >> $GITHUB_STEP_SUMMARY
echo "| GUI | Drifty-GUI.msi | $GUI_WINDOWS_MSI_SIZE |" >> $GITHUB_STEP_SUMMARY
echo "| GUI | Drifty-GUI.exe | $GUI_WINDOWS_EXE_SIZE |" >> $GITHUB_STEP_SUMMARY
if [ ${{ github.event_name != 'workflow_call' }} ]; then
echo "## Release :bookmark: Drifty v$VERSION" >> $GITHUB_STEP_SUMMARY
echo "Release Skipped :no_entry_sign:!" >> $GITHUB_STEP_SUMMARY
fi
- name: Create Release with automated release notes
if: ${{ inputs.create_release }}
run: |
echo "## Release :bookmark: Drifty v$VERSION" >> $GITHUB_STEP_SUMMARY
gh release create v$VERSION --generate-notes 'linux/CLI/Drifty-CLI_linux#Drifty-CLI_linux' 'linux/GUI/Drifty-GUI_linux#Drifty-GUI_linux' 'macos/CLI/Drifty-CLI_macos#Drifty-CLI_macos' 'macos/GUI/Drifty-GUI.pkg#Drifty-GUI.pkg' 'windows/CLI/Drifty-CLI.exe#Drifty-CLI.exe' 'windows/GUI/Drifty-GUI.msi#Drifty-GUI.msi' 'windows/GUI/Drifty-GUI.exe#Drifty-GUI.exe'
echo "[Released :white_check_mark: Drifty v$VERSION](https://github.com/SaptarshiSarkar12/Drifty/releases/tag/v$VERSION) successfully :rocket:!" >> $GITHUB_STEP_SUMMARY
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}