Skip to content

Commit 28e1b5b

Browse files
author
bee
committed
renamed testing and added CI for packaging
1 parent 9ce001f commit 28e1b5b

File tree

2 files changed

+233
-25
lines changed

2 files changed

+233
-25
lines changed

.github/workflows/build.yml

Lines changed: 199 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,208 @@
1-
name: Build
2-
on:
3-
pull_request:
4-
branches: [master]
5-
push:
6-
branches:
7-
- master
1+
name: CD Pipeline
2+
3+
on: [push]
4+
85
jobs:
9-
test:
10-
name: Test Suite
6+
build-nix:
7+
env:
8+
IN_PIPELINE: true
9+
runs-on: ${{ matrix.os }}
10+
if: github.ref == 'refs/heads/main'
1111
strategy:
1212
matrix:
13-
os: [ubuntu-latest, macos-latest, windows-latest]
14-
rust: [stable]
15-
runs-on: ${{ matrix.os }}
13+
type: [ubuntu-x64, ubuntu-x86, armv7, aarch64]
14+
include:
15+
- type: ubuntu-x64
16+
os: ubuntu-latest
17+
target: x86_64-unknown-linux-musl
18+
name: x86_64-linux-rustscan
19+
path: target/x86_64-unknown-linux-musl/release/rustscan
20+
pkg_config_path: /usr/lib/x86_64-linux-gnu/pkgconfig
21+
- type: ubuntu-x86
22+
os: ubuntu-latest
23+
target: i686-unknown-linux-musl
24+
name: x86-linux-rustscan
25+
path: target/i686-unknown-linux-musl/release/rustscan
26+
pkg_config_path: /usr/lib/i686-linux-gnu/pkgconfig
27+
- type: armv7
28+
os: ubuntu-latest
29+
target: armv7-unknown-linux-gnueabihf
30+
name: armv7-linux-rustscan
31+
path: target/armv7-unknown-linux-gnueabihf/release/rustscan
32+
pkg_config_path: /usr/lib/x86_64-linux-gnu/pkgconfig
33+
- type: aarch64
34+
os: ubuntu-latest
35+
target: aarch64-unknown-linux-gnu
36+
name: aarch64-linux-rustscan
37+
path: target/aarch64-unknown-linux-gnu/release/rustscan
38+
pkg_config_path: /usr/lib/x86_64-linux-gnu/pkgconfig
39+
steps:
40+
- uses: actions/checkout@v4
41+
- name: Cache cargo & target directories
42+
uses: Swatinem/rust-cache@v2
43+
- name: Build binary
44+
uses: houseabsolute/actions-rust-cross@v0
45+
with:
46+
command: build
47+
target: ${{ matrix.target }}
48+
args: "--locked --release"
49+
strip: true
50+
toolchain: stable
51+
- name: Build tar.gz for homebrew installs
52+
if: matrix.type == 'ubuntu-x64'
53+
run: |
54+
tar czf ${{ matrix.name }}.tar.gz -C target/x86_64-unknown-linux-musl/release rustscan
55+
- uses: actions/upload-artifact@v4
56+
with:
57+
name: ${{ matrix.name }}
58+
path: ${{ matrix.path }}
59+
- uses: actions/upload-artifact@v4
60+
if: matrix.type == 'ubuntu-x64'
61+
with:
62+
name: ${{ matrix.name }}.tar.gz
63+
path: ${{ matrix.name }}.tar.gz
64+
65+
build-debug:
66+
env:
67+
IN_PIPELINE: true
68+
runs-on: ubuntu-latest
1669
steps:
17-
- name: Checkout sources
18-
uses: actions/checkout@v4
70+
- uses: actions/checkout@v4
71+
72+
- name: Install System Dependencies
73+
run: |
74+
env
75+
sudo apt-get update
76+
sudo apt-get install -y --no-install-recommends libssl-dev pkg-config musl-tools
77+
- name: Set up Rust toolchain
78+
uses: dtolnay/rust-toolchain@master
79+
with:
80+
toolchain: stable
81+
target: x86_64-unknown-linux-musl
1982

20-
- name: Install stable toolchain
21-
uses: actions-rs/toolchain@v1
83+
- name: Build the project
84+
env:
85+
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig
86+
OPENSSL_DIR: /usr/lib/ssl
87+
run: cargo build --target=x86_64-unknown-linux-musl
88+
- uses: actions/upload-artifact@v4
2289
with:
23-
profile: minimal
24-
toolchain: ${{ matrix.rust }}
25-
override: true
90+
name: x86_64-linux-debug-rustscan
91+
path: target/x86_64-unknown-linux-musl/debug/rustscan
2692

27-
- uses: taiki-e/install-action@nextest
28-
- uses: Swatinem/rust-cache@v2
93+
build-deb:
94+
needs: [build-nix]
95+
runs-on: ubuntu-latest
96+
env:
97+
IN_PIPELINE: true
98+
steps:
99+
- uses: actions/checkout@v4
100+
- name: Install cargo-deb
101+
run: cargo install -f cargo-deb
102+
- uses: awalsh128/cache-apt-pkgs-action@v1
103+
with:
104+
packages: musl-tools # provides musl-gcc
105+
version: 1.0
106+
- name: Install musl toolchain
107+
run: rustup target add x86_64-unknown-linux-musl
108+
- name: Deb Build
109+
run: cargo deb --target=x86_64-unknown-linux-musl
110+
- name: Upload Deb Artifact
111+
uses: actions/upload-artifact@v4
112+
with:
113+
name: rustscan.deb
114+
path: ./target/x86_64-unknown-linux-musl/debian/*
29115

30-
- name: Install Just
31-
uses: extractions/setup-just@v2
116+
build-macos:
117+
env:
118+
IN_PIPELINE: true
119+
runs-on: macos-latest
120+
if: github.ref == 'refs/heads/main'
121+
steps:
122+
- uses: actions/checkout@v4
123+
- name: Cache cargo & target directories
124+
uses: Swatinem/rust-cache@v2
125+
- name: Build binary
126+
uses: houseabsolute/actions-rust-cross@v0
127+
with:
128+
command: build
129+
target: x86_64-apple-darwin
130+
args: "--locked --release"
131+
strip: true
132+
toolchain: stable
133+
- name: Build tar.gz for homebrew installs
134+
run: |
135+
tar czf x86_64-macos-rustscan.tar.gz -C target/x86_64-apple-darwin/release rustscan
136+
- uses: actions/upload-artifact@v4
137+
with:
138+
name: x86_64-macos-rustscan
139+
path: target/x86_64-apple-darwin/release/rustscan
140+
- uses: actions/upload-artifact@v4
141+
with:
142+
name: x86_64-macos-rustscan.tar.gz
143+
path: x86_64-macos-rustscan.tar.gz
144+
145+
build-macos-aarch64:
146+
env:
147+
IN_PIPELINE: true
148+
runs-on: macos-latest
149+
if: github.ref == 'refs/heads/main'
150+
steps:
151+
- uses: actions/checkout@v4
152+
- name: Cache cargo & target directories
153+
uses: Swatinem/rust-cache@v2
154+
- name: Build binary
155+
uses: houseabsolute/actions-rust-cross@v0
156+
with:
157+
command: build
158+
target: aarch64-apple-darwin
159+
args: "--locked --release"
160+
strip: true
161+
toolchain: stable
162+
- name: Build tar.gz for homebrew installs
163+
run: |
164+
tar czf aarch64-macos-rustscan.tar.gz -C target/aarch64-apple-darwin/release rustscan
165+
- uses: actions/upload-artifact@v4
166+
with:
167+
name: aarch64-macos-rustscan
168+
path: target/aarch64-apple-darwin/release/rustscan
169+
- uses: actions/upload-artifact@v4
170+
with:
171+
name: aarch64-macos-rustscan.tar.gz
172+
path: aarch64-macos-rustscan.tar.gz
32173

33-
- name: Run just
34-
run: just test
174+
build-windows:
175+
env:
176+
IN_PIPELINE: true
177+
runs-on: ${{ matrix.os }}
178+
if: github.ref == 'refs/heads/main'
179+
strategy:
180+
matrix:
181+
type: [windows-x64, windows-x86]
182+
include:
183+
- type: windows-x64
184+
os: windows-latest
185+
target: x86_64-pc-windows-msvc
186+
name: x86_64-windows-rustscan.exe
187+
path: target\x86_64-pc-windows-msvc\release\rustscan.exe
188+
- type: windows-x86
189+
os: windows-latest
190+
target: i686-pc-windows-msvc
191+
name: x86-windows-rustscan.exe
192+
path: target\i686-pc-windows-msvc\release\rustscan.exe
193+
steps:
194+
- uses: actions/checkout@v4
195+
- name: Cache cargo & target directories
196+
uses: Swatinem/rust-cache@v2
197+
- name: Build binary
198+
uses: houseabsolute/actions-rust-cross@v0
199+
with:
200+
command: build
201+
target: ${{ matrix.target }}
202+
args: "--locked --release"
203+
strip: true
204+
toolchain: stable
205+
- uses: actions/upload-artifact@v4
206+
with:
207+
name: ${{ matrix.name }}
208+
path: ${{ matrix.path }}

.github/workflows/test.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build
2+
on:
3+
pull_request:
4+
branches: [master]
5+
push:
6+
branches:
7+
- master
8+
jobs:
9+
test:
10+
name: Test Suite
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest, macos-latest, windows-latest]
14+
rust: [stable]
15+
runs-on: ${{ matrix.os }}
16+
steps:
17+
- name: Checkout sources
18+
uses: actions/checkout@v4
19+
20+
- name: Install stable toolchain
21+
uses: actions-rs/toolchain@v1
22+
with:
23+
profile: minimal
24+
toolchain: ${{ matrix.rust }}
25+
override: true
26+
27+
- uses: taiki-e/install-action@nextest
28+
- uses: Swatinem/rust-cache@v2
29+
30+
- name: Install Just
31+
uses: extractions/setup-just@v2
32+
33+
- name: Run just
34+
run: just test

0 commit comments

Comments
 (0)