forked from xpple/SeedMapper
-
Notifications
You must be signed in to change notification settings - Fork 0
172 lines (165 loc) · 5.64 KB
/
build.yml
File metadata and controls
172 lines (165 loc) · 5.64 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: build
on:
push:
branches:
- master
pull_request:
branches:
- master
create: # for Git tag creations
jobs:
compile-cubiomes:
name: Compile Cubiomes to shared library
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
submodules: 'true'
- name: Compile shared library (ubuntu-latest)
if: matrix.os == 'ubuntu-latest'
working-directory: src/main/c/cubiomes
run: |
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
cp build/libcubiomes.so ../../resources/libcubiomes.so
- name: Compile shared library (macos-latest)
if: matrix.os == 'macos-latest'
working-directory: src/main/c/cubiomes
run: |
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
cmake --build build --config Release
cp build/libcubiomes.dylib ../../resources/libcubiomes.dylib
- name: Set up MSYS2 (windows-latest)
if: matrix.os == 'windows-latest'
uses: msys2/setup-msys2@v2
with:
update: true
install: >
base-devel
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ninja
- name: Compile shared library (windows-latest)
if: matrix.os == 'windows-latest'
working-directory: src/main/c/cubiomes
shell: msys2 {0}
run: |
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
cp build/cubiomes.dll ../../resources/cubiomes.dll
- name: Compute SHA256 hash (ubuntu-latest)
if: matrix.os == 'ubuntu-latest'
run: sha256sum src/main/resources/libcubiomes.so
- name: Compute SHA256 hash (macos-latest)
if: matrix.os == 'macos-latest'
run: shasum -a 256 src/main/resources/libcubiomes.dylib
- name: Compute SHA256 hash (windows-latest)
if: matrix.os == 'windows-latest'
run: Get-FileHash -Algorithm SHA256 src/main/resources/cubiomes.dll
- name: Capture shared library (ubuntu-latest)
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v7
with:
name: libcubiomes.so
path: src/main/resources/libcubiomes.so
- name: Capture shared library (macos-latest)
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v7
with:
name: libcubiomes.dylib
path: src/main/resources/libcubiomes.dylib
- name: Capture shared library (windows-latest)
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v7
with:
name: cubiomes.dll
path: src/main/resources/cubiomes.dll
build:
name: Build SeedMapper
needs: compile-cubiomes
runs-on: ubuntu-latest
env:
LLVM_HOME: /usr/lib/llvm-13
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
submodules: 'true'
- name: Capture shared library
uses: actions/download-artifact@v8
with:
merge-multiple: true
path: src/main/resources/
- name: Validate gradle wrapper
uses: gradle/actions/wrapper-validation@v5
- name: Setup JDK 25
uses: actions/setup-java@v5
with:
java-version: 25
distribution: 'temurin'
- name: Make Gradle wrapper executable
run: |
chmod +x ./gradlew
chmod +x ./jextract/gradlew
- name: Install LLVM 13
run: |
wget --no-verbose https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz
tar -xf clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz
sudo mv clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-20.04 $LLVM_HOME
- name: Compile jextract
working-directory: jextract
run: ./gradlew --stacktrace -Pjdk_home=$JAVA_HOME -Pllvm_home=$LLVM_HOME clean verify
- name: Build
run: ./gradlew build
- name: Capture build artifacts
uses: actions/upload-artifact@v7
with:
name: SeedMapper
path: build/libs/
# if a Git tag was created, verify it is for a stable version to make a release
validate-tag:
name: Validate tag
needs: build
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
outputs:
valid: ${{ steps.check_tag.outputs.valid }}
steps:
- name: Check tag format
id: check_tag
run: |
TAG="${GITHUB_REF_NAME}"
if [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "valid=true" >> $GITHUB_OUTPUT
else
echo "valid=false" >> $GITHUB_OUTPUT
fi
release:
name: Release SeedMapper
needs: validate-tag
if: needs.validate-tag.outputs.valid == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Capture JAR
uses: actions/download-artifact@v8
with:
name: SeedMapper
path: build/libs/
- name: Setup JDK 25
uses: actions/setup-java@v5
with:
java-version: 25
distribution: 'temurin'
- name: Make Gradle wrapper executable
run: chmod +x ./gradlew
- name: Release artifact
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
run: ./gradlew publishMods --stacktrace