-
Notifications
You must be signed in to change notification settings - Fork 12
78 lines (76 loc) · 2.34 KB
/
java-ci.yaml
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
on:
workflow_dispatch:
push:
paths:
- '**.java'
pull_request:
paths:
- '**.java'
# Continuous integration
name: build
jobs:
build:
name: Build and test on Linux
runs-on: ubuntu-latest
env:
PZ_VERSION: "41.50"
steps:
# Checkout repository
- uses: actions/checkout@v2
# Setup Java environment
- name: Setup JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
# Cache gradle temporary files
- name: Cache gradle files
uses: actions/cache@v2
with:
path: ./.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
# Cache Project Zomboid classes
- name: Read Zomboid classes cache
id: pz-cache
uses: actions/cache@v2
with:
path: ./lib/
key: PZ-${{ env.PZ_VERSION }}-${{ secrets.CACHE_VERSION }}
# Install Project Zomboid classes
- name: Install Zomboid classes
if: steps.pz-cache.outputs.cache-hit != 'true'
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: "pzstorm/zomboid"
version: "tags/v${{ env.PZ_VERSION }}"
file: "zomboid-${{ env.PZ_VERSION }}.jar"
target: "lib/zomboid-${{ env.PZ_VERSION }}.jar"
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
# Cache Project Zomboid classes
- name: Cache Zomboid classes
if: steps.pz-cache.outputs.cache-hit != 'true'
uses: actions/cache@v2
with:
path: ./lib/
key: PZ-${{ env.PZ_VERSION }}-${{ secrets.CACHE_VERSION }}
# Apply correct permissions for lib directory
- name: Apply directory permissions
run: sudo chmod a+rwx ./lib
# Assemble main classes with gradle
- name: Assemble classes
uses: burrunan/gradle-cache-action@v1
with:
arguments: classes -s
# Run unit tests with gradle
- name: Run Unit Tests
uses: burrunan/gradle-cache-action@v1
with:
arguments: test -s
# Upload test reports as run artifact
- name: Upload test reports
if: always()
uses: actions/upload-artifact@v2
with:
name: test-report-${{ runner.os }}
path: ./build/reports/tests/