-
Notifications
You must be signed in to change notification settings - Fork 7
133 lines (128 loc) · 5.73 KB
/
build.yml
File metadata and controls
133 lines (128 loc) · 5.73 KB
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
name: Build and tests on every commit
# This workflow is triggered on pushes to the repository.
on: [ push ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v3
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v4
- name: Cache gradle
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu'
- name: build
run: ./gradlew ktlintCheck build -Pversion="${{github.ref_name}}"
- name: Release "${{github.ref_name}}"
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
tiny-cli/build/distributions/tiny-cli-${{github.ref_name}}.zip
tiny-cli/build/distributions/tiny-cli-${{github.ref_name}}.tar
- name: Install butler
if: startsWith(github.ref, 'refs/tags/')
uses: jdno/setup-butler@v1
- name: Publish to itch.io
if: startsWith(github.ref, 'refs/tags/')
env:
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
run: butler push tiny-cli/build/distributions/tiny-cli-${{github.ref_name}}.zip dwursteisen/tiny:tiny-cli --userversion ${{github.ref_name}}
- name: Update documentation sample
run: |
unzip tiny-cli/build/distributions/tiny-cli-${{github.ref_name}}.zip
tiny-cli-${{github.ref_name}}/bin/tiny-cli docs --output tiny-doc/src/docs/asciidoc/dependencies/tiny-cli-commands.adoc
tiny-cli-${{github.ref_name}}/bin/tiny-cli export tiny-samples/breakout
unzip -o -d tiny-doc/src/docs/asciidoc/sample/game-example tiny-samples/breakout/tiny-export.zip
tiny-cli-${{github.ref_name}}/bin/tiny-cli export tiny-samples/home
unzip -o -d tiny-doc/src/docs/asciidoc/sample/home tiny-samples/home/tiny-export.zip
tiny-cli-${{github.ref_name}}/bin/tiny-cli export tiny-cli/src/main/resources/sfx
unzip -o -d tiny-doc/src/docs/asciidoc/sample/sfx-editor tiny-cli/src/main/resources/sfx/tiny-export.zip
- name: Build examples and generate Asciidoctor HTML pages
run: ./gradlew asciidoctor -Pversion="${{github.ref_name}}"
- name: Copy generated content into gh-pages.
uses: peaceiris/actions-gh-pages@v3
if: startsWith(github.ref, 'refs/tags/')
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./tiny-doc/build/docs/asciidoc
- name: Upload CLI distribution
uses: actions/upload-artifact@v4
with:
name: tiny-cli-dist
path: tiny-cli/build/distributions/tiny-cli-${{github.ref_name}}.zip
retention-days: 1
test-export:
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout the repo
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu'
- name: Download CLI distribution
uses: actions/download-artifact@v4
with:
name: tiny-cli-dist
- name: Extract CLI distribution (Unix)
if: runner.os != 'Windows'
run: unzip tiny-cli-${{github.ref_name}}.zip
- name: Extract CLI distribution (Windows)
if: runner.os == 'Windows'
run: Expand-Archive -Path tiny-cli-${{github.ref_name}}.zip -DestinationPath .
- name: Test web export (Unix)
if: runner.os != 'Windows'
run: |
tiny-cli-${{github.ref_name}}/bin/tiny-cli export tiny-samples/breakout
test -f tiny-samples/breakout/tiny-export.zip
- name: Test web export (Windows)
if: runner.os == 'Windows'
run: |
tiny-cli-${{github.ref_name}}\bin\tiny-cli.bat export tiny-samples\breakout
if (-Not (Test-Path tiny-samples\breakout\tiny-export.zip)) { exit 1 }
- name: Test desktop export (Unix)
if: runner.os != 'Windows'
run: |
tiny-cli-${{github.ref_name}}/bin/tiny-cli export tiny-samples/breakout -p desktop --exclude-jdk
test -d exported-game
ls exported-game/*.jar
- name: Test desktop export (Windows)
if: runner.os == 'Windows'
run: |
tiny-cli-${{github.ref_name}}\bin\tiny-cli.bat export tiny-samples\breakout -p desktop --exclude-jdk
if (-Not (Test-Path exported-game)) { exit 1 }
if (-Not (Get-ChildItem exported-game\*.jar)) { exit 1 }
- name: Test desktop export with JDK (Unix)
if: runner.os != 'Windows'
run: |
tiny-cli-${{github.ref_name}}/bin/tiny-cli export tiny-samples/breakout -p desktop --include-jdk -o exported-game-jdk
test -d exported-game-jdk
if [ "$(uname -s)" = "Linux" ]; then
ls exported-game-jdk/*.deb
elif [ "$(uname -s)" = "Darwin" ]; then
ls exported-game-jdk/*.dmg
fi
- name: Test desktop export with JDK (Windows)
if: runner.os == 'Windows'
run: |
tiny-cli-${{github.ref_name}}\bin\tiny-cli.bat export tiny-samples\breakout -p desktop --include-jdk -o exported-game-jdk
if (-Not (Test-Path exported-game-jdk)) { exit 1 }
if (-Not (Get-ChildItem exported-game-jdk\*.exe)) { exit 1 }
env:
GRADLE_OPTS: -Dorg.gradle.configureondemand=true -Dorg.gradle.parallel=true -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"