Skip to content

Commit 30c63d0

Browse files
committed
chore: try GitHub Action
1 parent b28132b commit 30c63d0

File tree

3 files changed

+128
-0
lines changed

3 files changed

+128
-0
lines changed

.github/actions/build/action.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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: debug info
42+
shell: bash
43+
run: |
44+
${{ inputs.TOOL }} -Vv
45+
rustc -Vv
46+
47+
- name: build
48+
shell: bash
49+
run: ${{ inputs.TOOL }} ${{ inputs.BUILD }} ${{ inputs.ZFLAGS }} --target ${{ inputs.TARGET }} --all-targets --all-features
50+
51+
- name: doc
52+
shell: bash
53+
run: ${{ inputs.TOOL }} doc ${{ inputs.ZFLAGS }} --no-deps --target ${{ inputs.TARGET }} --all-features
54+
55+
- name: clippy
56+
shell: bash
57+
run: ${{ inputs.TOOL}} clippy ${{ inputs.ZFLAGS }} --target ${{ inputs.TARGET }} --all-targets --all-features -- ${{ inputs.CLIPPYFLAGS }}
58+
59+
- name: Set up cargo-hack
60+
if: inputs.NOHACK == 'false'
61+
uses: taiki-e/install-action@cargo-hack
62+
63+
- name: run cargo hack
64+
shell: bash
65+
if: inputs.NOHACK == 'false'
66+
run: ${{ inputs.TOOL }} hack ${{ inputs.ZFLAGS }} check --target ${{ inputs.TARGET }} --each-feature

.github/actions/test/action.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
runs:
14+
using: "composite"
15+
steps:
16+
- name: test
17+
shell: bash
18+
run: ${{ inputs.TOOL }} test --target ${{ inputs.TARGET }} --all-features

.github/workflows/ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
push:
7+
branches:
8+
- main
9+
10+
permissions:
11+
contents: read
12+
13+
env:
14+
MSRV: 1.69.0
15+
16+
jobs:
17+
18+
macos:
19+
runs-on: macos-13
20+
env:
21+
TARGET: x86_64-apple-darwin
22+
steps:
23+
- name: checkout
24+
uses: actions/checkout@v4
25+
26+
- name: setup Rust
27+
uses: dtolnay/rust-toolchain@master
28+
with:
29+
toolchain: '${{ env.MSRV }}'
30+
components: clippy
31+
32+
- name: build
33+
uses: ./.github/actions/build
34+
with:
35+
TARGET: '${{ env.TARGET }}'
36+
37+
- name: test
38+
uses: ./.github/actions/test
39+
with:
40+
TARGET: '${{ env.TARGET }}'
41+
42+
- name: before_cache_script
43+
run: rm -rf $CARGO_HOME/registry/index
44+

0 commit comments

Comments
 (0)