This repository was archived by the owner on Sep 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (101 loc) · 3.03 KB
/
ci.yml
File metadata and controls
122 lines (101 loc) · 3.03 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
name: Continuous Integration
on:
push
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout git repository
uses: actions/checkout@v3
- name: Setup rust cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run cargo check
run: cargo check --workspace
- name: Execute unit tests
run: cargo test --workspace --bins --lib
integration_test:
strategy:
matrix:
include:
- minecraft_version: 1.19.4
- minecraft_version: 1.18.2
- minecraft_version: 1.17.1
- minecraft_version: 1.16.5
- minecraft_version: 1.15.2
- minecraft_version: 1.14.4
additional_test_args: --skip minecraft_1_15_plus
name: Integration Test (Minecraft ${{ matrix.minecraft_version }})
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout git repository
uses: actions/checkout@v3
- name: Setup rust cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Setup Minecraft
uses: mcenv/setup-minecraft@v2
with:
version: ${{ matrix.minecraft_version }}
- name: Configure Minecraft
run: |
cd minecraft
echo "eula=true" > eula.txt
echo "\
enable-command-block=true
gamemode=creative
generate-structures=false
level-type=flat
online-mode=false
" > server.properties
mkdir -p world/datapacks
cp -r ../.github/workflows/setup-minecraft-for-ci world/datapacks
- name: Setup Screen
run: |
cd minecraft
mkdir screen
chmod 700 screen
- name: Start Minecraft
run: |
cd minecraft
SCREENDIR=screen screen -S minecraft -dm -- $JAVA_HOME_17_X64/bin/java -jar server.jar nogui
- name: Setup build.env
run: |
echo "\
TEST_WORLD_DIR=minecraft/world
TEST_LOG_FILE=minecraft/logs/latest.log
" > build.env
echo "\
TEST_WORLD_DIR=../minecraft/world
TEST_LOG_FILE=../minecraft/logs/latest.log
" > mcfunction-debug-adapter/build.env
- name: Execute Integration Tests
run: cargo test --workspace --test '*' -- --test-threads=1 ${{ matrix.additional_test_args }}
- name: Stop Minecraft
run: |
cd minecraft
SCREENDIR=screen screen -S minecraft -X stuff 'stop\n'
- name: Upload Minecraft Log if Failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: minecraft-${{ matrix.minecraft_version }}.log
path: minecraft/logs/latest.log