Skip to content

Commit ca4bc64

Browse files
committed
ci: add builds and artifact cleanup
1 parent 40cbbed commit ca4bc64

File tree

4 files changed

+117
-19
lines changed

4 files changed

+117
-19
lines changed

.github/workflows/clean-artifacts.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Remove old artifacts
2+
3+
on:
4+
schedule:
5+
# Every day at 1:23am
6+
- cron: '23 1 * * *'
7+
workflow_dispatch:
8+
9+
jobs:
10+
remove-old-artifacts:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 10
13+
14+
steps:
15+
- name: Remove old artifacts
16+
uses: c-hive/gha-remove-artifacts@v1
17+
with:
18+
age: 90 days
19+
skip-recent: 50

.github/workflows/lint.yml

-19
This file was deleted.

.github/workflows/rust.yml

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Rust
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
name: Check
14+
steps:
15+
- uses: dtolnay/rust-toolchain@stable
16+
- uses: Swatinem/rust-cache@v2
17+
- uses: actions/checkout@v3
18+
- run: |
19+
rustup component add rustfmt clippy
20+
cargo check
21+
cargo fmt --all -- --check
22+
cargo clippy -- -Dwarnings
23+
build-windows:
24+
runs-on: windows-latest
25+
name: Release build for Windows
26+
steps:
27+
- uses: dtolnay/rust-toolchain@stable
28+
- uses: Swatinem/rust-cache@v2
29+
- uses: actions/checkout@v3
30+
- name: Build release binary
31+
run: cargo build --release
32+
env:
33+
RUSTFLAGS: '-C target-feature=+crt-static'
34+
- uses: actions/upload-artifact@v3
35+
with:
36+
name: awsbck-windows
37+
path: target/release/awsbck.exe
38+
39+
build-macos:
40+
runs-on: macos-latest
41+
name: Release build for macOS
42+
steps:
43+
- uses: dtolnay/rust-toolchain@stable
44+
- uses: Swatinem/rust-cache@v2
45+
- uses: actions/checkout@v3
46+
- name: Build release binary
47+
run: cargo build --release
48+
env:
49+
LZMA_API_STATIC: 'true'
50+
- uses: actions/upload-artifact@v3
51+
with:
52+
name: awsbck-macos
53+
path: target/release/awsbck
54+
55+
build-linux:
56+
runs-on: ubuntu-latest
57+
name: Release build for linux x86_64
58+
steps:
59+
- uses: dtolnay/rust-toolchain@stable
60+
with:
61+
targets: x86_64-unknown-linux-musl
62+
- uses: Swatinem/rust-cache@v2
63+
- name: Install musl tools
64+
run: |
65+
sudo apt-get update
66+
sudo apt-get install -y --no-install-recommends musl-tools
67+
- uses: actions/checkout@v3
68+
- name: Build release binary
69+
run: cargo build --release --target x86_64-unknown-linux-musl
70+
- uses: actions/upload-artifact@v3
71+
with:
72+
name: awsbck-linux
73+
path: target/x86_64-unknown-linux-musl/release/awsbck
74+
75+
build-arm:
76+
name: Release builds for linux ARM
77+
strategy:
78+
matrix:
79+
include:
80+
- target: aarch64-unknown-linux-musl
81+
arch: aarch64
82+
- target: armv7-unknown-linux-gnueabihf
83+
arch: armv7
84+
target: ['aarch64-unknown-linux-musl', 'armv7-unknown-linux-gnueabihf']
85+
runs-on: ubuntu-latest
86+
steps:
87+
- uses: dtolnay/rust-toolchain@stable
88+
with:
89+
targets: ${{ matrix.target }}
90+
- uses: Swatinem/rust-cache@v2
91+
- run: cargo install cross --git https://github.com/cross-rs/cross
92+
- uses: actions/checkout@v3
93+
- run: cross build --release --target ${{ matrix.target }}
94+
- uses: actions/upload-artifact@v3
95+
with:
96+
name: awsbck-${{ matrix.arch }}
97+
path: target/${{ matrix.target }}/release/awsbck

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ uuid = { version = "1", features = ["v4", "fast-rng"] }
2727

2828
[profile.release]
2929
lto = "thin"
30+
strip = true

0 commit comments

Comments
 (0)