Skip to content

Commit 6868489

Browse files
authored
chore: try GitHub Action (#2166)
* chore: try GitHub Action * fix branch name * migrate 33 tasks * add RUSTFLAGS and RUSTDOCFLAGS to env * respond to review
1 parent 582e773 commit 6868489

File tree

3 files changed

+433
-0
lines changed

3 files changed

+433
-0
lines changed

.github/actions/build/action.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: 'Build'
2+
description: 'Build nix'
3+
inputs:
4+
# This is required
5+
TARGET:
6+
required: true
7+
8+
BUILD:
9+
required: false
10+
default: build
11+
12+
CLIPPYFLAGS:
13+
required: false
14+
default: -D warnings -A unknown-lints
15+
16+
RUSTFLAGS:
17+
required: false
18+
default: -D warnings -A unknown-lints
19+
20+
RUSTDOCFLAGS:
21+
required: false
22+
default: -D warnings
23+
24+
TOOL:
25+
description: 'Tool used to involve the BUILD command, can be cargo or cross'
26+
required: false
27+
default: cargo
28+
29+
ZFLAGS:
30+
required: false
31+
default:
32+
33+
NOHACK:
34+
description: "whether to run cargo hack"
35+
required: false
36+
default: false
37+
38+
runs:
39+
using: "composite"
40+
steps:
41+
- name: set up Rust env
42+
shell: bash
43+
run: |
44+
echo "RUSTFLAGS=${{ inputs.RUSTFLAGS }}" >> $GITHUB_ENV
45+
echo "RUSTDOCFLAGS=${{ inputs.RUSTDOCFLAGS }}" >> $GITHUB_ENV
46+
47+
- name: debug info
48+
shell: bash
49+
run: |
50+
${{ inputs.TOOL }} -Vv
51+
rustc -Vv
52+
53+
- name: build
54+
shell: bash
55+
run: ${{ inputs.TOOL }} ${{ inputs.BUILD }} ${{ inputs.ZFLAGS }} --target ${{ inputs.TARGET }} --all-targets --all-features
56+
57+
- name: doc
58+
shell: bash
59+
run: ${{ inputs.TOOL }} doc ${{ inputs.ZFLAGS }} --no-deps --target ${{ inputs.TARGET }} --all-features
60+
61+
- name: clippy
62+
shell: bash
63+
run: ${{ inputs.TOOL}} clippy ${{ inputs.ZFLAGS }} --target ${{ inputs.TARGET }} --all-targets --all-features -- ${{ inputs.CLIPPYFLAGS }}
64+
65+
- name: Set up cargo-hack
66+
if: inputs.NOHACK == 'false'
67+
uses: taiki-e/install-action@cargo-hack
68+
69+
- name: run cargo hack
70+
shell: bash
71+
if: inputs.NOHACK == 'false'
72+
run: ${{ inputs.TOOL }} hack ${{ inputs.ZFLAGS }} check --target ${{ inputs.TARGET }} --each-feature

.github/actions/test/action.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: 'Test'
2+
description: 'Test nix'
3+
inputs:
4+
# This is required
5+
TARGET:
6+
required: true
7+
8+
TOOL:
9+
description: 'Tool used to involve the test command, can be cargo or cross'
10+
required: false
11+
default: cargo
12+
13+
RUSTFLAGS:
14+
required: false
15+
default: -D warnings -A unknown-lints
16+
17+
runs:
18+
using: "composite"
19+
steps:
20+
- name: set up Rust env
21+
shell: bash
22+
run: |
23+
echo "RUSTFLAGS=${{ inputs.RUSTFLAGS }}" >> $GITHUB_ENV
24+
25+
- name: test
26+
shell: bash
27+
run: ${{ inputs.TOOL }} test --target ${{ inputs.TARGET }} --all-features

0 commit comments

Comments
 (0)