Skip to content

Commit

Permalink
Cleanup github actions. Replace actions-rs to other maintained actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
naokiri committed Sep 24, 2024
1 parent de975d4 commit 626d6a1
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 226 deletions.
26 changes: 26 additions & 0 deletions .github/actions/install_required_cargo_bins/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: 'Install required cargo binaries'
description: "install cargo binaries to build C ABI library. Requires cargo installed before use."
runs:
using: "composite"
steps:
- name: Check rustup toolchain
run: rustup default
shell: bash
- name: cbindgen-exists
id: cbindgenCheck
run: test -e ~/.cargo/bin/cbindgen
continue-on-error: true
shell: bash
- name: Install cbindgen
if: ${{ always() && steps.cbindgenCheck.outcome == 'failure' }}
run: cargo +stable install cbindgen
shell: bash
- name: cargo-c-exists
id: cargoCCheck
run: test -e ~/.cargo/bin/cargo-cbuild
continue-on-error: true
shell: bash
- name: Install cargo-c
if: ${{ always() && steps.cargoCCheck.outcome == 'failure' }}
run: cargo +stable install cargo-c --version 0.9.12
shell: bash
17 changes: 17 additions & 0 deletions .github/actions/lint_format/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: 'Lint and Format'
description: "Lint and format check. Requires cargo, rustfmt and clippy installed before use."
inputs:
github_token:
description: 'github token'
required: true
runs:
using: "composite"
steps:
- name: Format check
run: cargo fmt -- --check
shell: bash
- name: Lint check
uses: giraffate/clippy-action@v1
with:
github_token: ${{ inputs.github_token }}
clippy_flags: -- -D warnings -A dead_code -A improper_ctypes_definitions
62 changes: 62 additions & 0 deletions .github/workflows/basic_checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Only check that build passes
name: Basic check
on:
workflow_call:
inputs:
toolchain:
type: string
required: true
secrets:
gh_token:
required: true

jobs:
lint:
name: lint and format check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ inputs.toolchain }}
- name: Install cargo
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ inputs.toolchain }}
components: rustfmt, clippy
rustflags: ""
override: true
- name: Lint and format
uses: ./.github/actions/lint_format
with:
github_token: ${{ secrets.gh_token }}
rust_test:
name: cargo test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ inputs.toolchain }}
- name: Install required libs (Ubuntu)
run: sudo apt-get install libxkbcommon-dev
- name: Install cargo
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ inputs.toolchain }}
rustflags: ""
override: true
- name: Run rust test
run: cargo test --features capi
64 changes: 6 additions & 58 deletions .github/workflows/beta_testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,61 +9,9 @@ on:
- master

jobs:
lint:
name: lint and format check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-beta
- name: Install cargo
uses: actions-rs/toolchain@v1
with:
toolchain: beta
profile: minimal
components: rustfmt, clippy
override: true
- name: Format check
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
- name: Lint check
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: -- -D warnings -A dead_code -A improper_ctypes_definitions
rust_test:
name: cargo test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-beta
- name: Install required libs (Ubuntu)
run: sudo apt-get install libxkbcommon-dev
- name: Install cargo
uses: actions-rs/toolchain@v1
with:
toolchain: beta
profile: minimal
override: true
- name: Run rust test
uses: actions-rs/cargo@v1
with:
command: test
args: --features capi
basic_check:
uses: ./.github/workflows/basic_checks.yaml
with:
toolchain: "beta"
secrets:
gh_token: "${{ secrets.GITHUB_TOKEN }}"
27 changes: 5 additions & 22 deletions .github/workflows/continuous_testing.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test
name: Continuous branch tests before merge
on: [push, workflow_dispatch]

concurrency:
Expand Down Expand Up @@ -27,13 +27,10 @@ jobs:
components: rustfmt, clippy
rustflags: ""
override: true
- name: Format check
run: cargo fmt -- --check
- name: Lint check
uses: giraffate/clippy-action@v1
- name: Lint and format
uses: ./.github/actions/lint_format
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
clippy_flags: -- -D warnings -A dead_code -A improper_ctypes_definitions
rust_test:
name: cargo test
strategy:
Expand Down Expand Up @@ -93,22 +90,8 @@ jobs:
~/.cargo/git/db/
target
key: ${{ runner.os }}-cargo-libtest-v6-${{ hashFiles('**/Cargo.lock') }}-cargo-c-v0.9.6
- name: Check rustup toolchain
run: rustup default
- name: cbindgen-exists
id: cbindgenCheck
run: test -e ~/.cargo/bin/cbindgen
continue-on-error: true
- name: Install cbindgen
if: ${{ always() && steps.cbindgenCheck.outcome == 'failure' }}
run: cargo +stable install cbindgen
- name: cargo-c-exists
id: cargoCCheck
run: test -e ~/.cargo/bin/cargo-cbuild
continue-on-error: true
- name: Install cargo-c
if: ${{ always() && steps.cargoCCheck.outcome == 'failure' }}
run: cargo +stable install cargo-c --version 0.9.12
- name: Install required rust tools
uses: ./.github/actions/install_required_cargo_bins
- name: Install required libs (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install libxkbcommon-dev
Expand Down
37 changes: 8 additions & 29 deletions .github/workflows/deployment_artifact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,44 +26,23 @@ jobs:
run: |
grep -F "[${{ steps.versions.outputs.version }}]" CHANGELOG.md
- name: Install cargo
uses: actions-rs/toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
profile: minimal
toolchain: ${{ inputs.toolchain }}
rustflags: ""
override: true
- name: Install cbindgen
uses: actions-rs/cargo@v1
with:
command: install
args: cbindgen
- name: cargo-c-exists
id: cargoCCheck
run: test -e ~/.cargo/bin/cargo-cbuild
continue-on-error: true
- name: Install cargo-c
if: ${{ always() && steps.cargoCCheck.outcome == 'failure' }}
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-c
- name: Install required rust tools
uses: .github/actions/install_required_cargo_bins
- name: Install required libs (Ubuntu)
run: sudo apt-get install libxkbcommon-dev
- name: Build library
uses: actions-rs/cargo@v1
with:
command: cbuild
args: --release
run: cargo cbuild --release
- name: Build symbolic links
run: bin/generate_deb_symlinks.sh
- name: Install cargo-deb
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-deb
run: cargo install cargo-deb --force
- name: Prepare deb file
uses: actions-rs/cargo@v1
with:
command: deb
run: cargo deb
- name: Upload release artifact
uses: softprops/action-gh-release@v1
with:
Expand Down
64 changes: 6 additions & 58 deletions .github/workflows/nightly_testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,61 +6,9 @@ on:
workflow_dispatch:

jobs:
lint:
name: lint and format check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-nightly
- name: Install cargo
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
components: rustfmt, clippy
override: true
- name: Format check
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
- name: Lint check
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: -- -D warnings -A dead_code -A improper_ctypes_definitions
rust_test:
name: cargo test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-nightly
- name: Install required libs (Ubuntu)
run: sudo apt-get install libxkbcommon-dev
- name: Install cargo
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true
- name: Run rust test
uses: actions-rs/cargo@v1
with:
command: test
args: --features capi
basic_check:
uses: ./.github/workflows/basic_checks.yaml
with:
toolchain: "nightly"
secrets:
gh_token: "${{ secrets.GITHUB_TOKEN }}"
Loading

0 comments on commit 626d6a1

Please sign in to comment.