forked from CompactMods/CompactMachines
-
Notifications
You must be signed in to change notification settings - Fork 3
155 lines (133 loc) · 4.26 KB
/
ci-tests-nightly.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
name: Gradle Tests and Nightly (CI)
on:
workflow_dispatch:
push:
branches:
- '**'
tags-ignore:
- v*
paths-ignore:
- "README.md"
- "LICENSE"
- ".github/**/*"
jobs:
vars:
name: Get Variables
runs-on: ubuntu-20.04
outputs:
release_type: ${{steps.cf_release_type.outputs.value }}
version: ${{steps.version.outputs.version }}
build: ${{steps.build.outputs.buildver}}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Unshallow
run: git fetch --prune --unshallow
- name: Find Current Tag
id: current
uses: jimschubert/query-tag-action@v1
with:
include: 'v*'
exclude: '*-rc*'
commit-ish: '@'
skip-unshallow: 'true'
- name: Release Type
id: cf_release_type
uses: christian-draeger/[email protected]
with:
path: './gradle.properties'
property: 'cf_release_type'
- name: Semver Version
id: version
run: |
version=$(echo "${{steps.current.outputs.tag}}" | cut -dv -f2)
echo "::set-output name=version::$version"
- name: Build Version
id: build
run: |
buildver=$(git describe --tags --match v* | cut -d- -f2)
echo "build = $buildver"
echo "::set-output name=buildver::$buildver"
tests:
name: Gradle Tests
runs-on: ubuntu-20.04
needs: [ vars ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Unshallow and Get Tags
run: git fetch --prune --unshallow --tags
- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: "17"
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Create datagen assets
continue-on-error: true
run: ./gradlew runDatagen
env:
CM_RELEASE: false
CM_SEMVER_VERSION: ${{ needs.vars.outputs.version }}
CM_BUILD_NUM: ${{ needs.vars.outputs.build }}
- name: Test JAR with GameTest Server
run: ./gradlew runGametest
env:
CM_RELEASE: false
CM_SEMVER_VERSION: ${{ needs.vars.outputs.version }}
CM_BUILD_NUM: ${{ needs.vars.outputs.build }}
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload build failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: test-data
path: run/gametest
nightly:
name: Publish Nightly
runs-on: ubuntu-20.04
needs: [ vars, tests ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Unshallow and Get Tags
run: git fetch --prune --unshallow --tags
- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: "17"
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Generate Resources
run: ./gradlew runDatagen
env:
CM_RELEASE: false
CM_SEMVER_VERSION: ${{ needs.vars.outputs.version }}
CM_BUILD_NUM: ${{ needs.vars.outputs.build }}
- name: Publish gradle nightly jar
run: ./gradlew publishAllForgePublicationToGitHubPackagesRepository
env:
CM_RELEASE: false
CM_SEMVER_VERSION: ${{ needs.vars.outputs.version }}
CM_BUILD_NUM: ${{ needs.vars.outputs.build }}
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}