Skip to content

Commit 7287989

Browse files
committed
Add GitHub Actions Workflow
1 parent c107474 commit 7287989

File tree

2 files changed

+114
-0
lines changed

2 files changed

+114
-0
lines changed

.github/workflows/build.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: Build and Package
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
name: Build
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout Repository
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
- name: Set up JDK
19+
uses: actions/setup-java@v3
20+
with:
21+
java-version: '11'
22+
distribution: 'temurin'
23+
cache: maven
24+
- name: Build
25+
run: mvn -B install --file pom.xml
26+
- name: Generate Code Coverage Report
27+
run: mvn -B jacoco:report -Dcode-coverage-format=xml --file pom.xml
28+
- name: Upload Build
29+
uses: actions/upload-artifact@v3
30+
with:
31+
name: build
32+
path: target/Digital.zip
33+
- name: Upload Docs
34+
uses: actions/upload-artifact@v3
35+
with:
36+
name: docs
37+
path: target/docuDist/Doc_*.pdf
38+
macos-dmg:
39+
name: Create macOS DMG
40+
needs: build
41+
runs-on: macos-latest
42+
steps:
43+
- name: Set up JDK
44+
uses: actions/setup-java@v3
45+
with:
46+
java-version: '11'
47+
distribution: 'temurin'
48+
- name: Install svg2png
49+
run: brew install --formula svg2png
50+
- name: Download Build Artifacts
51+
uses: actions/download-artifact@v3
52+
with:
53+
name: build
54+
- name: Unzip Build Artifacts
55+
run: unzip Digital.zip
56+
# Derived from https://github.com/magnusviri/svg2icns/blob/main/svg2icns
57+
- name: Create ICNS File
58+
run: |
59+
ICONSET="icon.iconset"
60+
61+
SMALL_SIZES="
62+
16,16x16
63+
32,16x16@2x
64+
32,32x32
65+
64,32x32@2x
66+
"
67+
68+
SIZES="
69+
128,128x128
70+
256,128x128@2x
71+
256,256x256
72+
512,256x256@2x
73+
512,512x512
74+
1024,512x512@2x
75+
"
76+
77+
mkdir -p "$ICONSET"
78+
79+
for PARAMS in $SMALL_SIZES; do
80+
SIZE=$(echo $PARAMS | cut -d, -f1)
81+
LABEL=$(echo $PARAMS | cut -d, -f2)
82+
svg2png -w "$SIZE" -h "$SIZE" Digital/iconSmall.svg "$ICONSET/icon_$LABEL.png"
83+
done
84+
85+
for PARAMS in $SIZES; do
86+
SIZE=$(echo $PARAMS | cut -d, -f1)
87+
LABEL=$(echo $PARAMS | cut -d, -f2)
88+
svg2png -w "$SIZE" -h "$SIZE" Digital/icon.svg "$ICONSET/icon_$LABEL.png"
89+
done
90+
91+
iconutil -c icns "$ICONSET"
92+
- name: Build DMG
93+
run: |
94+
jpackage \
95+
--type dmg \
96+
--input Digital \
97+
--main-jar Digital.jar \
98+
--name Digital \
99+
--description 'A digital logic designer and circuit simulator.' \
100+
--vendor 'Helmut Neemann' \
101+
--app-version "$(sed -n -E 's/^Build Git Version: *v([.0-9]*)-.*$/\1/p' Digital/Version.txt)" \
102+
--copyright 'TODO' \
103+
--icon icon.icns \
104+
--mac-package-identifier 'de.neemann.digital' \
105+
--mac-package-name Digital
106+
- name: Upload DMG
107+
uses: actions/upload-artifact@v3
108+
with:
109+
name: dmg
110+
path: Digital-*.dmg

distribution/Assembly.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
<source>${basedir}/src/main/svg/icon.svg</source>
3939
<outputDirectory>/</outputDirectory>
4040
</file>
41+
<file>
42+
<source>${basedir}/src/main/svg/iconSmall.svg</source>
43+
<outputDirectory>/</outputDirectory>
44+
</file>
4145
<file>
4246
<source>${basedir}/distribution/ReleaseNotes.txt</source>
4347
<outputDirectory>/</outputDirectory>

0 commit comments

Comments
 (0)