Bump version to 0.2 #37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
- name: Format | |
run: cargo fmt --all -- --check | |
doc: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: nightly | |
components: rust-docs | |
- uses: Swatinem/rust-cache@v2 | |
- name: Documentation | |
env: | |
DOCS_RS: 1 | |
run: cargo doc --all --all-features | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: nightly | |
components: clippy | |
- uses: Swatinem/rust-cache@v2 | |
- name: Code check | |
run: cargo clippy --all --all-targets | |
# minver: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - uses: dtolnay/rust-toolchain@v1 | |
# with: | |
# toolchain: nightly | |
# - uses: Swatinem/rust-cache@v2 | |
# - run: clippy check --all --all-features --all-targets -Z minimal-versions | |
test: | |
needs: | |
- format | |
- doc | |
- check | |
strategy: | |
fail-fast: ${{ startsWith(github.ref, 'refs/tags/') }} | |
matrix: | |
include: | |
# Test features | |
- task: test | |
rust: stable | |
target: x86_64-unknown-linux-gnu | |
features: "''" | |
test_args: --lib | |
- task: test | |
rust: stable | |
target: x86_64-unknown-linux-gnu | |
features: either | |
test_args: --lib | |
- task: test | |
rust: stable | |
target: x86_64-unknown-linux-gnu | |
features: fromstr | |
test_args: --lib | |
- task: test | |
rust: stable | |
target: x86_64-unknown-linux-gnu | |
features: display | |
test_args: --lib | |
- task: test | |
rust: stable | |
target: x86_64-unknown-linux-gnu | |
features: serde | |
test_args: --lib | |
- task: test | |
rust: stable | |
target: x86_64-unknown-linux-gnu | |
features: phf | |
test_args: --lib | |
- task: test | |
rust: stable | |
target: x86_64-unknown-linux-gnu | |
features: keyboard | |
test_args: --lib | |
- task: test | |
rust: stable | |
target: x86_64-unknown-linux-gnu | |
features: mouse | |
test_args: --lib | |
- task: test | |
rust: stable | |
target: x86_64-unknown-linux-gnu | |
features: default | |
# Test targets | |
- task: test | |
rust: stable | |
target: i686-unknown-linux-gnu | |
features: default | |
- task: test | |
rust: stable | |
target: x86_64-unknown-linux-gnu | |
features: default | |
- task: test | |
rust: stable | |
target: arm-unknown-linux-gnueabihf | |
features: default | |
test_args: --no-run | |
- task: test | |
rust: stable | |
target: armv7-unknown-linux-gnueabihf | |
features: default | |
test_args: --no-run | |
- task: test | |
rust: stable | |
target: aarch64-unknown-linux-gnu | |
features: default | |
test_args: --no-run | |
#- task: test | |
# rust: stable | |
# target: mips-unknown-linux-gnu | |
# features: default | |
# test_args: --no-run | |
#- task: test | |
# rust: stable | |
# target: mips64-unknown-linux-gnuabi64 | |
# features: default | |
# test_args: --no-run | |
#- task: test | |
# rust: stable | |
# target: mipsel-unknown-linux-gnu | |
# features: default | |
# test_args: --no-run | |
#- task: test | |
# rust: stable | |
# target: mips64el-unknown-linux-gnuabi64 | |
# features: default | |
# test_args: --no-run | |
- task: test | |
rust: stable | |
target: powerpc-unknown-linux-gnu | |
features: default | |
test_args: --no-run | |
- task: test | |
rust: stable | |
target: powerpc64-unknown-linux-gnu | |
features: default | |
test_args: --no-run | |
#- task: test | |
# rust: stable | |
# target: sparc64-unknown-linux-gnu | |
# features: default | |
# test_args: --no-run | |
# Test channels | |
- task: channels | |
rust: stable | |
target: x86_64-unknown-linux-gnu | |
features: default | |
- task: channels | |
rust: beta | |
target: x86_64-unknown-linux-gnu | |
features: default | |
- task: channels | |
rust: nightly | |
target: x86_64-unknown-linux-gnu | |
features: default | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup cross linux toolchain | |
if: contains(matrix.target, '-linux-') && !startsWith(matrix.target, 'x86_64-') | |
run: | | |
GCC_TARGET=$(printf "${{ matrix.target }}" | sed 's/-unknown-/-/' | sed 's/arm[^-]*/arm/g') | |
ENV_TARGET=$(printf "${{ matrix.target }}" | tr '-' '_') | |
ENV_TARGET_UC=$(printf "${ENV_TARGET}" | tr '[[:lower:]]' '[[:upper:]]') | |
sudo apt-get update -y | |
sudo apt-get install -y --install-recommends gcc-${GCC_TARGET} | |
echo "CC_${ENV_TARGET}=${GCC_TARGET}-gcc" >> $GITHUB_ENV | |
echo "CARGO_TARGET_${ENV_TARGET_UC}_LINKER=${GCC_TARGET}-gcc" >> $GITHUB_ENV | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
target: ${{ matrix.target }} | |
- uses: Swatinem/rust-cache@v2 | |
- name: Update deps | |
run: cargo update | |
- name: Build | |
run: cargo build --target ${{ matrix.target }} --no-default-features --features ${{ matrix.features }} | |
- name: Test | |
timeout-minutes: 2 | |
env: | |
RUST_BACKTRACE: full | |
run: cargo test --all --target ${{ matrix.target }} --no-default-features --features ${{ matrix.features }} ${{ matrix.test_args }} | |
publish: | |
if: github.repository == 'katyo/hidg-rs' && startsWith(github.ref, 'refs/tags/') | |
needs: | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Publish crates | |
uses: katyo/publish-crates@v1 | |
with: | |
registry-token: ${{ secrets.CRATES_TOKEN }} | |
args: --no-verify | |
#dry-run: true |