-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (107 loc) · 4.82 KB
/
build.yaml
File metadata and controls
107 lines (107 loc) · 4.82 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
name: build
on:
push:
branches:
- master
- v[0-9]+.[0-9]+.x
tags:
- v*
workflow_dispatch:
jobs:
build:
name: ${{ matrix.target }}
strategy:
matrix:
include:
- target: x86_64-apple-darwin
runner: macos-13
- target: aarch64-apple-darwin
runner: macos-latest
- target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
- target: x86_64-unknown-linux-musl
runner: ubuntu-latest
- target: aarch64-unknown-linux-gnu
runner: ubuntu-latest
- target: aarch64-unknown-linux-musl
runner: ubuntu-latest
- target: x86_64-pc-windows-msvc
runner: windows-latest
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
!./target/*/*/*.zip
!./target/*/*/*.tar.gz
key: ${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Update Rust Toolchain
run: |
rustup update stable
rustup component add rustfmt rust-src clippy
rustup target add ${{ matrix.target }}
rustup target add wasm32-unknown-unknown
- name: Run Tests (univ)
run: cargo test --features univ
- name: Run Tests (wasm)
run: |
cargo install wasm-pack --force
wasm-pack test --node ./lib --features wasm
- name: Clippy Check
run: cargo clippy --all-targets
- name: Format Check
run: cargo fmt --check
- name: Build Release (linux)
if: contains(matrix.target, 'linux')
run: |
cargo install cross --force
cross build --release --target ${{ matrix.target }}
- name: Build Release (darwin or windows)
if: ${{ !contains(matrix.target, 'linux') }}
run: cargo build --release --target ${{ matrix.target }}
# - name: Code Sign (darwin)
# if: contains(matrix.target, 'darwin')
# env:
# APPLE_CODESIGN_KEY: '${{ secrets.APPLE_CODESIGN_KEY }}'
# APPLE_CODESIGN_PASSWORD: '${{ secrets.APPLE_CODESIGN_PASSWORD }}'
# echo Key is $(echo $APPLE_CODESIGN_KEY | base64 -d | wc -c) bytes
# rcodesign sign target/release/basjoofan --code-signature-flags=runtime --p12-password=$APPLE_CODESIGN_PASSWORD --p12-file=<(echo $APPLE_CODESIGN_KEY | base64 -d) --entitlements-xml-file=cli/entitlements.plist
# - name: Compress Archive (darwin or linux)
# if: contains(matrix.target, 'darwin') || contains(matrix.target, 'linux')
# run: zip -rj target/${{ matrix.target }}/release/basjoofan-${{ matrix.target }}.zip target/${{ matrix.target }}/release/basjoofan
# - name: Compress Archive (windows)
# if: contains(matrix.target, 'windows')
# run: Compress-Archive -CompressionLevel Optimal -Force -Path target/${{ matrix.target }}/release/basjoofan.exe -DestinationPath target/${{ matrix.target }}/release/basjoofan-${{ matrix.target }}.zip
- name: Echo Version (darwin or linux)
if: contains(matrix.target, 'darwin') || contains(matrix.target, 'linux')
run: echo version=$(grep '^version' ./cmd/Cargo.toml | head -1 | cut -d '"' -f2) >> $GITHUB_ENV
- name: Naming (darwin or linux)
if: contains(matrix.target, 'darwin') || contains(matrix.target, 'linux')
run: mv target/${{ matrix.target }}/release/basjoofan target/${{ matrix.target }}/release/basjoofan-${{ env.version }}-${{ matrix.target }}
- name: Echo Version (windows)
if: contains(matrix.target, 'windows')
run: echo version=$((Get-Content ./cmd/Cargo.toml | Select-String '^version').ToString().Split('"')[1]) >> $GITHUB_ENV
- name: Naming (windows)
if: contains(matrix.target, 'windows')
run: Rename-Item -Path target/${{ matrix.target }}/release/basjoofan.exe -NewName target/${{ matrix.target }}/release/basjoofan-${{ env.version }}-${{ matrix.target }}.exe
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: basjoofan-${{ matrix.target }}
path: target/${{ matrix.target }}/release/basjoofan-${{ env.version }}-${{ matrix.target }}${{ contains(matrix.target, 'windows') && '.exe' || '' }}
if-no-files-found: error
- name: Release Version
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: target/${{ matrix.target }}/release/basjoofan-${{ env.version }}-${{ matrix.target }}${{ contains(matrix.target, 'windows') && '.exe' || '' }}
draft: true