-
-
Notifications
You must be signed in to change notification settings - Fork 30
184 lines (156 loc) · 5.97 KB
/
Copy pathdeploy.yml
File metadata and controls
184 lines (156 loc) · 5.97 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
173
174
175
176
177
178
179
180
181
182
183
184
name: Deploy
on:
workflow_dispatch:
push:
tags:
- 'v**'
env:
CARGO_TERM_COLOR: always
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
jobs:
build:
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-gnu
- i686-unknown-linux-gnu
- x86_64-apple-darwin
- aarch64-apple-darwin
- x86_64-pc-windows-msvc
- i686-pc-windows-msvc
- aarch64-unknown-linux-gnu
- arm-unknown-linux-gnueabihf
include:
# ubuntu-24.04 (x86_64)
- target: x86_64-unknown-linux-gnu
image: ubuntu-24.04
- target: i686-unknown-linux-gnu
image: ubuntu-24.04
setup: >
sudo dpkg --add-architecture i386 &&
sudo apt update &&
sudo apt install libssl-dev:i386 gcc-multilib &&
echo 'OPENSSL_INCLUDE_DIR=/usr/include' >> $GITHUB_ENV &&
echo 'OPENSSL_LIB_DIR=/usr/lib/i386-linux-gnu' >> $GITHUB_ENV
# macos-13 (x86_64)
- target: x86_64-apple-darwin
image: macos-13
# macos-15 (aarch64)
- target: aarch64-apple-darwin
image: macos-15
# windows-2022 (x86_64)
- target: x86_64-pc-windows-msvc
image: windows-2022
- target: i686-pc-windows-msvc
image: windows-2022
# ubuntu-24.04-arm (aarch64)
- target: aarch64-unknown-linux-gnu
image: ubuntu-24.04-arm
- target: arm-unknown-linux-gnueabihf
image: ubuntu-24.04-arm
skip_test: true
setup: >
sudo dpkg --add-architecture armhf &&
sudo apt update &&
sudo apt install libssl-dev:armhf gcc-arm-linux-gnueabihf &&
echo 'OPENSSL_INCLUDE_DIR=/usr/include' >> $GITHUB_ENV &&
echo 'OPENSSL_LIB_DIR=/usr/lib/arm-linux-gnueabihf' >> $GITHUB_ENV &&
echo 'CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=/usr/bin/arm-linux-gnueabihf-gcc' >> $GITHUB_ENV
name: Build ${{ matrix.target }} on ${{ matrix.image }}
runs-on: ${{ matrix.image }}
steps:
- uses: actions/checkout@v4
- name: Setup
if: matrix.setup != null
run: ${{ matrix.setup }}
- name: Setup rust
run: rustup target add ${{ matrix.target }}
- name: Test (debug)
if: matrix.skip_test == null
run: cargo test --target ${{ matrix.target }} --workspace --exclude portablemc-py -- --include-ignored
- name: Build (release)
run: cargo build --target ${{ matrix.target }} --release --workspace --exclude portablemc-py
- name: Debug path
run: ls ./target/${{ matrix.target }}/release
- name: Collect artifacts (linux)
if: contains(matrix.target, 'linux')
run: |
mkdir -p ~/portablemc/dev
cp -r ./portablemc-ffi/include ~/portablemc/dev/
cd ./target/${{ matrix.target }}/release/
cp portablemc ~/portablemc/
cp libportablemc_ffi.a ~/portablemc/dev/libportablemc.a
cp libportablemc_ffi.so ~/portablemc/dev/libportablemc.so
- name: Collect artifacts (apple)
if: contains(matrix.target, 'apple')
run: |
mkdir -p ~/portablemc/dev
cp -r ./portablemc-ffi/include ~/portablemc/dev/
cd ./target/${{ matrix.target }}/release/
cp portablemc ~/portablemc/
cp libportablemc_ffi.a ~/portablemc/dev/libportablemc.a
cp libportablemc_ffi.dylib ~/portablemc/dev/libportablemc.so
- name: Collect artifacts (windows)
if: contains(matrix.target, 'windows')
run: |
mkdir ~/portablemc
mkdir ~/portablemc/dev
cp ./portablemc-ffi/include ~/portablemc/dev
cd ./target/${{ matrix.target }}/release/
cp portablemc.exe ~/portablemc/
cp portablemc.pdb ~/portablemc/
cp portablemc_ffi.lib ~/portablemc/dev/portablemc.lib
cp portablemc_ffi.dll ~/portablemc/dev/portablemc.dll
cp portablemc_ffi.dll.exp ~/portablemc/dev/portablemc.dll.exp
cp portablemc_ffi.dll.lib ~/portablemc/dev/portablemc.dll.lib
cp portablemc_ffi.pdb ~/portablemc/dev/portablemc.pdb
- name: Upload workflow artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: ~/portablemc/
check-version:
name: Check version
if: github.event_name == 'push' && startsWith('refs/tags/', github.ref)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get cargo version
id: get-cargo-version
shell: bash
run: echo "cargo-version=$(cargo pkgid -p portablemc | awk -F'[#@]' '{print $NF}')" >> $GITHUB_OUTPUT
- name: Match cargo version
shell: bash
run: test "v${{ steps.get-cargo-version.outputs.cargo-version }}" = "${{ github.ref_name }}"
release:
name: Release
needs:
- build
- check-version
if: github.event_name == 'push' && startsWith('refs/tags/', github.ref)
runs-on: ubuntu-latest
steps:
- name: Download workflow artifacts
id: download-workflow-artifacts
uses: actions/download-artifact@v4
with:
path: ~/
- name: Create release
shell: bash
run: |
gh release create ${{ github.ref_name }} --verify-tag --draft ${{ steps.download-workflow-artifacts.outputs.download-path }}
# publish:
# name: Publish
# needs: build
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Dry-run publish API
# run: cargo publish --dry-run -p portablemc
# - name: Dry-run publish CLI
# run: cargo publish --dry-run -p portablemc-cli
# - name: Publish API
# run: cargo publish -p portablemc
# - name: Publish CLI
# run: cargo publish -p portablemc-cli