-
-
Notifications
You must be signed in to change notification settings - Fork 68
137 lines (117 loc) · 4.63 KB
/
main.yml
File metadata and controls
137 lines (117 loc) · 4.63 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
134
135
136
137
name: Build modules
on:
push:
branches: [ master, ver/* ]
pull_request:
workflow_dispatch:
env:
VERSION: '26.1'
COMMIT_MSG: ${{ github.event.head_commit.message }}
jobs:
build:
runs-on: ubuntu-24.04
concurrency:
group: ${{ github.event_name != 'pull_request' && 'release' || format('pr-{0}', github.event.number) }}
steps:
- uses: actions/checkout@v4
- name: Checkout release branch
if: github.event_name != 'pull_request'
uses: actions/checkout@v4
with:
ref: release
path: release
- name: Fetch pull request base
if: github.event_name == 'pull_request'
run: git fetch origin ${{ github.base_ref }}
- name: Set up uv
uses: astral-sh/setup-uv@v7
- name: Build and publish all modules
if: github.event_name != 'pull_request'
run: uv run beet -p beet-release.yaml -l ${{ env.LOG_LEVEL }} build
env:
BEET_MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
BEET_SMITHED_TOKEN: ${{ secrets.SMITHED_TOKEN }}
LOG_LEVEL: ${{ runner.debug == 1 && 'DEBUG' || 'INFO'}}
MASTER_BUILD: true
- name: Build all modules for pull request
if: github.event_name == 'pull_request'
run: uv run beet -p beet-release.yaml -l ${{ env.LOG_LEVEL }} build
env:
LOG_LEVEL: ${{ runner.debug == 1 && 'DEBUG' || 'INFO'}}
- name: Remove non-modules for artifact
if: github.event_name == 'pull_request'
run: |
rm -r release/$VERSION/generated
rm release/$VERSION/lib_*
rm release/$VERSION/meta.json
- name: Upload artifact
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: 'Modules for pull request #${{ github.event.number }}'
path: ${{ github.workspace }}/release/${{ env.VERSION }}/
- name: Commit release
if: github.event_name != 'pull_request'
run: |
git config --global user.email "${{ github.event.head_commit.author.email }}"
git config --global user.name "${{ github.event.head_commit.author.username }}"
cd release
git add .
git commit -m "🚀 ${{ github.event.after }} $COMMIT_MSG"
- name: Push release
if: github.event_name != 'pull_request'
uses: ad-m/github-push-action@v0.8.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
directory: release
branch: release
test:
strategy:
fail-fast: false
matrix:
include:
# https://fabricmc.net/use/server/
# https://modrinth.com/mod/fabric-api/versions
# https://modrinth.com/mod/packtest/versions
- version: '26.1'
fabric_server_url: https://meta.fabricmc.net/v2/versions/loader/26.1-snapshot-6/0.18.4/1.1.1/server/jar
fabric_api_url: https://cdn.modrinth.com/data/P7dR8mSH/versions/WAZ95Yd8/fabric-api-0.143.2%2B26.1.jar
packtest_url: https://cdn.modrinth.com/data/XsKUhp45/versions/eupLiv70/packtest-2.5.0-beta1.jar
command_limit_tracer_url: https://cdn.modrinth.com/data/Ao12dSbt/versions/DxBN5h3K/commandlimittracer-0.2.0.jar
name: 'test-${{ matrix.version }}'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v7
- name: Build all modules for tests
run: uv run beet -p beet-test.yaml -l ${{ env.LOG_LEVEL }} build
env:
LOG_LEVEL: ${{ runner.debug == 1 && 'DEBUG' || 'INFO'}}
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '25'
- name: Download server files
run: |
curl -o server.jar ${{ matrix.fabric_server_url }}
mkdir mods
curl -o mods/fabric-api.jar ${{ matrix.fabric_api_url }}
curl -o mods/packtest.jar ${{ matrix.packtest_url }}
curl -o mods/command_limit_tracer.jar ${{ matrix.command_limit_tracer_url }}
- name: Copy packs to world
run: |
mkdir -p world/datapacks
rm out/gm4_zauber_liquids.zip
cp out/gm4_*.zip world/datapacks
- name: Run test server
id: run-tests
run: |
java -Xmx2G -Dpacktest.auto -Dpacktest.auto.annotations -jar server.jar nogui
- name: Upload test world
if: ${{ failure() && steps.run-tests.conclusion == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: 'Test world in ${{ matrix.version }} for ${{ github.sha }}'
path: ${{ github.workspace }}/world/