Skip to content

Commit 4317974

Browse files
committed
ci: add github action
1 parent 6b270ac commit 4317974

File tree

2 files changed

+130
-0
lines changed

2 files changed

+130
-0
lines changed

.github/workflows/build.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
on: [push, pull_request]
2+
3+
name: Build
4+
5+
jobs:
6+
build:
7+
name: Build
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
os:
12+
- ubuntu-latest
13+
- macOS-latest
14+
- windows-latest
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
- uses: actions-rs/toolchain@v1
20+
with:
21+
toolchain: stable
22+
target: ${{ matrix.target }}
23+
override: true
24+
25+
- uses: actions-rs/cargo@v1
26+
with:
27+
use-cross: true
28+
command: test
29+
30+
- uses: actions-rs/cargo@v1
31+
with:
32+
use-cross: true
33+
command: build
34+
args: --release
35+
36+
cross_compile:
37+
name: Cross compile
38+
runs-on: ubuntu-latest
39+
strategy:
40+
matrix:
41+
target:
42+
- armv7-unknown-linux-gnueabihf
43+
steps:
44+
- uses: actions/checkout@v2
45+
- uses: actions-rs/toolchain@v1
46+
with:
47+
toolchain: stable
48+
target: ${{ matrix.target }}
49+
override: true
50+
- uses: actions-rs/cargo@v1
51+
with:
52+
use-cross: true
53+
command: build
54+
args: --release --target=${{ matrix.target }}

.github/workflows/release.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# https://github.com/svenstaro/proxyboi/blob/fd1b493d2c2a341205d669cbf6bd549c5731df63/.github/workflows/publish.yml
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
name: Publish
9+
10+
jobs:
11+
publish:
12+
name: Publish
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest, windows-latest, macos-latest]
17+
include:
18+
- os: ubuntu-latest
19+
artifact_name: slp-server-rust
20+
release_name: slp-server-rust-linux-amd64
21+
- os: windows-latest
22+
artifact_name: slp-server-rust.exe
23+
release_name: slp-server-rust-windows-amd64.exe
24+
- os: macos-latest
25+
artifact_name: slp-server-rust
26+
release_name: slp-server-rust-macos-amd64
27+
28+
steps:
29+
- uses: actions/checkout@v2
30+
31+
- uses: actions-rs/toolchain@v1
32+
with:
33+
toolchain: stable
34+
target: ${{ matrix.target }}
35+
override: true
36+
37+
- uses: actions-rs/cargo@v1
38+
with:
39+
use-cross: true
40+
command: build
41+
args: --release
42+
43+
- name: Upload binaries to release
44+
uses: svenstaro/upload-release-action@v1-release
45+
with:
46+
repo_token: ${{ secrets.GITHUB_TOKEN }}
47+
file: target/release/${{ matrix.artifact_name }}
48+
asset_name: ${{ matrix.release_name }}
49+
tag: ${{ github.ref }}
50+
51+
cross_compile_publish:
52+
name: Cross compile publish
53+
runs-on: ubuntu-latest
54+
strategy:
55+
matrix:
56+
target:
57+
- armv7-unknown-linux-gnueabihf
58+
steps:
59+
- uses: actions/checkout@v2
60+
- uses: actions-rs/toolchain@v1
61+
with:
62+
toolchain: stable
63+
target: ${{ matrix.target }}
64+
override: true
65+
- uses: actions-rs/cargo@v1
66+
with:
67+
use-cross: true
68+
command: build
69+
args: --release --target=${{ matrix.target }}
70+
- name: Upload binaries to release
71+
uses: svenstaro/upload-release-action@v1-release
72+
with:
73+
repo_token: ${{ secrets.GITHUB_TOKEN }}
74+
file: target/${{ matrix.target }}/release/slp-server-rust
75+
asset_name: slp-server-rust-${{ matrix.target }}
76+
tag: ${{ github.ref }}

0 commit comments

Comments
 (0)