-
Notifications
You must be signed in to change notification settings - Fork 1
90 lines (79 loc) · 2.72 KB
/
build.yaml
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
name: Build
on:
push:
branches:
- master
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
name: anni-x86_64-unknown-linux-gnu.tar.gz
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
name: anni-x86_64-unknown-linux-musl.tar.gz
- target: x86_64-pc-windows-msvc
os: windows-latest
name: anni-x86_64-pc-windows-msvc.zip
- target: x86_64-apple-darwin
os: macos-latest
name: anni-x86_64-apple-darwin.tar.gz
runs-on: ${{ matrix.os }}
steps:
- name: Setup | Checkout
uses: actions/checkout@v3
- name: Setup | MUSL Dependencies
if: matrix.target == 'x86_64-unknown-linux-musl'
run: |
sudo apt install musl-tools
rustup target add x86_64-unknown-linux-musl
- name: Setup | Linux Dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt install libasound2-dev
- name: Setup | Cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}-anni-cache
- name: Build | Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --locked --target ${{ matrix.target }}" --workspace --exclude anni-playback
- name: PostBuild | Prepare artifacts [Windows]
if: matrix.os == 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
strip anni.exe
7z a ../../../${{ matrix.name }} anni.exe annil.exe
cd -
- name: PostBuild | Prepare artifacts [-nix]
if: matrix.os != 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
strip anni || true
tar czvf ../../../${{ matrix.name }} anni annil
cd -
- name: Docker | Prepare Context
if: matrix.target == 'x86_64-unknown-linux-musl' && github.ref == 'refs/heads/master'
run: |
cp target/${{ matrix.target }}/release/annil ./docker/
cp target/${{ matrix.target }}/release/anni ./docker/
- name: Docker | Build and Publish
if: matrix.target == 'x86_64-unknown-linux-musl' && github.ref == 'refs/heads/master'
uses: macbre/push-to-ghcr@master
with:
image_name: projectanni/annil
dockerfile: ./docker/Dockerfile
context: ./docker
github_token: ${{ secrets.GITHUB_TOKEN }}
env:
DOCKER_BUILDKIT: 1
- name: Deploy | Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.name }}
path: ${{ matrix.name }}