This repository has been archived by the owner on Jul 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
145 lines (126 loc) Β· 4.18 KB
/
ci.yml
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
name: ci
on:
push:
branches:
- '*'
pull_request:
workflow_dispatch:
jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- arch: x86_64
toolchain: x86_64-unknown-linux-musl
- arch: aarch64
toolchain: aarch64-unknown-linux-musl
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cargo cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.toolchain }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Install cross
run: cargo install --force cross
- name: Build
run: cross build --release --no-default-features --features openssl-tls-static --target ${{ matrix.toolchain }}
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: crunchy-cli-linux-${{ matrix.arch }}
path: ./target/${{ matrix.toolchain }}/release/crunchy-cli
if-no-files-found: error
- name: Upload manpages artifact
if: ${{ matrix.arch == 'x86_64' }} # only upload the manpages once
uses: actions/upload-artifact@v4
with:
name: manpages
path: ./target/${{ matrix.toolchain }}/release/manpages
if-no-files-found: error
- name: Upload completions artifact
if: ${{ matrix.arch == 'x86_64' }} # only upload the completions once
uses: actions/upload-artifact@v4
with:
name: completions
path: ./target/${{ matrix.toolchain }}/release/completions
if-no-files-found: error
build-mac:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macos-13 uses x86_64, macos-14 aarch64
# see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
include:
- os: macos-13
arch: x86_64
toolchain: x86_64-apple-darwin
- os: macos-14
arch: aarch64
toolchain: aarch64-apple-darwin
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cargo cache
if: ${{ matrix.os != 'macos-13' }} # when using cache, the 'Setup Rust' step fails for macos 13
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: x86_64-apple-darwin-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Build
run: cargo build --release --target ${{ matrix.toolchain }}
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: crunchy-cli-darwin-${{ matrix.arch }}
path: ./target/${{ matrix.toolchain }}/release/crunchy-cli
if-no-files-found: error
build-windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cargo cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: x86_64-pc-windows-gnu-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install system dependencies
uses: msys2/setup-msys2@v2
with:
update: true
install: mingw-w64-x86_64-rust base-devel
- name: Build
shell: msys2 {0}
run: cargo build --release --target x86_64-pc-windows-gnu
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: crunchy-cli-windows-x86_64
path: ./target/x86_64-pc-windows-gnu/release/crunchy-cli.exe
if-no-files-found: error