Skip to content

Commit

Permalink
chore: try GitHub Action (#2166)
Browse files Browse the repository at this point in the history
* chore: try GitHub Action

* fix branch name

* migrate 33 tasks

* add RUSTFLAGS and RUSTDOCFLAGS to env

* respond to review
  • Loading branch information
SteveLauC authored Nov 8, 2023
1 parent 582e773 commit 6868489
Show file tree
Hide file tree
Showing 3 changed files with 433 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: 'Build'
description: 'Build nix'
inputs:
# This is required
TARGET:
required: true

BUILD:
required: false
default: build

CLIPPYFLAGS:
required: false
default: -D warnings -A unknown-lints

RUSTFLAGS:
required: false
default: -D warnings -A unknown-lints

RUSTDOCFLAGS:
required: false
default: -D warnings

TOOL:
description: 'Tool used to involve the BUILD command, can be cargo or cross'
required: false
default: cargo

ZFLAGS:
required: false
default:

NOHACK:
description: "whether to run cargo hack"
required: false
default: false

runs:
using: "composite"
steps:
- name: set up Rust env
shell: bash
run: |
echo "RUSTFLAGS=${{ inputs.RUSTFLAGS }}" >> $GITHUB_ENV
echo "RUSTDOCFLAGS=${{ inputs.RUSTDOCFLAGS }}" >> $GITHUB_ENV
- name: debug info
shell: bash
run: |
${{ inputs.TOOL }} -Vv
rustc -Vv
- name: build
shell: bash
run: ${{ inputs.TOOL }} ${{ inputs.BUILD }} ${{ inputs.ZFLAGS }} --target ${{ inputs.TARGET }} --all-targets --all-features

- name: doc
shell: bash
run: ${{ inputs.TOOL }} doc ${{ inputs.ZFLAGS }} --no-deps --target ${{ inputs.TARGET }} --all-features

- name: clippy
shell: bash
run: ${{ inputs.TOOL}} clippy ${{ inputs.ZFLAGS }} --target ${{ inputs.TARGET }} --all-targets --all-features -- ${{ inputs.CLIPPYFLAGS }}

- name: Set up cargo-hack
if: inputs.NOHACK == 'false'
uses: taiki-e/install-action@cargo-hack

- name: run cargo hack
shell: bash
if: inputs.NOHACK == 'false'
run: ${{ inputs.TOOL }} hack ${{ inputs.ZFLAGS }} check --target ${{ inputs.TARGET }} --each-feature
27 changes: 27 additions & 0 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'Test'
description: 'Test nix'
inputs:
# This is required
TARGET:
required: true

TOOL:
description: 'Tool used to involve the test command, can be cargo or cross'
required: false
default: cargo

RUSTFLAGS:
required: false
default: -D warnings -A unknown-lints

runs:
using: "composite"
steps:
- name: set up Rust env
shell: bash
run: |
echo "RUSTFLAGS=${{ inputs.RUSTFLAGS }}" >> $GITHUB_ENV
- name: test
shell: bash
run: ${{ inputs.TOOL }} test --target ${{ inputs.TARGET }} --all-features
Loading

0 comments on commit 6868489

Please sign in to comment.