Skip to content

Commit 6196691

Browse files
committed
Add rust workflows
info: patch template saved to `-`
1 parent 1daf3b4 commit 6196691

File tree

3 files changed

+158
-0
lines changed

3 files changed

+158
-0
lines changed

.github/workflows/binaries.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Build Binaries
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
binary_name:
7+
description: "Expected name of binary"
8+
required: false
9+
type: string
10+
default: "dls"
11+
output_binary_name:
12+
description: "Name of uploaded binary artifact"
13+
type: string
14+
default: "dls"
15+
log-dir:
16+
description: "Folder to put cargo logs in"
17+
required: false
18+
type: string
19+
os:
20+
description: "Machine to run on"
21+
required: true
22+
type: string
23+
env:
24+
CARGO_TERM_COLOR: always
25+
jobs:
26+
build:
27+
runs-on: ${{ inputs.os }}
28+
steps:
29+
- uses: actions/checkout@v4
30+
- name: versions
31+
run: |
32+
rustup --version
33+
cargo --version
34+
rustc --version
35+
- name: Build
36+
run: cargo build --release --verbose
37+
- name: Copy Build
38+
run: cp target/release/{{inputs.binary_name}} target/{{inputs.binary_name}}
39+
- name: Prepare log dir
40+
run: mkdir -p ${{ inputs.log-dir }}
41+
- name: Test
42+
run: |
43+
set -o pipefail
44+
cargo test --verbose 2>&1 | tee -a ${{ inputs.log-dir }}/test.log
45+
- name: Clippy
46+
if: ${{ success() || failure() }}
47+
run: |
48+
set -o pipefail
49+
rustup component add clippy
50+
cargo clippy --version
51+
cargo clippy --all-targets -- --deny warnings 2>&1 | tee -a ${{ inputs.log-dir }}/clippy.log
52+
- name: Upload test & clippy
53+
if: ${{ success() || failure() }}
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: cargo-logs
57+
overwrite: true
58+
path: ${{ inputs.log-dir }}
59+
- name: Upload binary
60+
if: ${{ success() || failure() }}
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: ${{ inputs.output_binary_name }}
64+
overwrite: true
65+
path: ${{ inputs.binary_name }}

.github/workflows/rust.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Archive Binary
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
schedule:
9+
- cron: "0 0 * * *"
10+
jobs:
11+
build-package:
12+
strategy:
13+
matrix:
14+
os:
15+
- ubuntu-latest
16+
- windows-latest
17+
include:
18+
- os: ubuntu-latest
19+
binary: dls
20+
- os: windows-latest
21+
binary: dls.exe
22+
uses: ./.github/workflows/binaries.yml
23+
with:
24+
binary_name: ${{ matrix.binary }}
25+
output_binary_name: dml-server-${{ matrix.os }}
26+
log-dir: ${{ matrix.binary }}-logs
27+
os: ${{ matrix.os }}
28+
check-package:
29+
uses: ./.github/workflows/scans.yml
30+
with:
31+
os: ubuntu-latest
32+
log-dir: checking-logs
33+
merge-package:
34+
runs-on:
35+
- ubuntu-latest
36+
needs: build-package
37+
steps:
38+
- name: Merge Artifacts
39+
uses: actions/upload-artifact/merge@v4
40+
with:
41+
name: dml-server
42+
pattern: dml-server-*

.github/workflows/scans.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Cargo Check
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
os:
7+
description: "Machine to run on"
8+
required: true
9+
type: string
10+
log-dir:
11+
description: "Folder to put cargo logs in"
12+
required: false
13+
type: string
14+
15+
env:
16+
CARGO_TERM_COLOR: always
17+
jobs:
18+
build:
19+
runs-on: ${{ inputs.os }}
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: versions
23+
run: |
24+
rustup --version
25+
cargo --version
26+
rustc --version
27+
- name: Prepare log dir
28+
run: mkdir -p ${{ inputs.log-dir }}
29+
- name: Audit Deny
30+
shell: bash
31+
if: ${{ success() || failure() }}
32+
run: |
33+
cargo install cargo-deny
34+
cargo deny --version
35+
set -o pipefail
36+
cargo deny check 2>&1 | tee -a ${{ inputs.log-dir }}/deny-log
37+
- name: Audit Outdated
38+
shell: bash
39+
if: ${{ success() || failure() }}
40+
run: |
41+
cargo install cargo-outdated
42+
cargo outdated --version
43+
set -o pipefail
44+
cargo outdated --exit-code 1 2>&1 | tee -a ${{ inputs.log-dir }}/outdated-log
45+
- name: Upload logs
46+
if: ${{ success() || failure() }}
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: cargo-scan-logs
50+
overwrite: true
51+
path: ${{ inputs.log-dir }}

0 commit comments

Comments
 (0)