refactor: create usb submodule (#55) #42
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: CI on Master | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
coverage: | |
name: Code Coverage | |
runs-on: ubuntu-latest | |
container: | |
image: docker.io/xd009642/tarpaulin:0.31.0 | |
options: --security-opt seccomp=unconfined | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Generate code coverage | |
run: | | |
cargo tarpaulin --verbose --timeout 120 | |
- name: Upload coverage report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tarpaulin-report | |
path: tarpaulin-report.html | |
build: | |
name: Build the project | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
- name: run cargo build | |
run: cargo build --all-features | |
get-next-version: | |
name: Get the next version | |
runs-on: ubuntu-latest | |
outputs: | |
version : ${{ steps.semantic-version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: paulhatch/semantic-version@c423ebb78413907bc5382d5a0e840be160a83981 | |
id: semantic-version | |
with: | |
tag_prefix: "v" | |
major_pattern: "/breaking change:/" | |
major_regexp_flags: "ig" | |
minor_pattern: "/^feat:/" | |
minor_regexp_flags: "ig" | |
version_format: "${major}.${minor}.${patch}" | |
bump_each_commit: false | |
search_commit_body: true | |
enable_prerelease_mode: true | |
release: | |
name: Publish a new release | |
needs: | |
- get-next-version | |
- build | |
permissions: | |
# This permission is required in order to push the new | |
# tag to the repository. | |
contents: write | |
runs-on: ubuntu-latest | |
env: | |
next-version: ${{ needs.get-next-version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Print the next version | |
run: | | |
echo "The next version is ${{ env.next-version }}" | |
- name: Patch the Cargo version | |
run: | | |
sed -i 's/0.0.0-placeholder-version/${{ env.next-version }}/' Cargo.toml | |
git diff | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
- name: Publish new Cargo version | |
env: | |
# This token needs to be created with the publish-update scope. | |
# The other scopes are not necessary. | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
run: | | |
cargo publish --allow-dirty | |
- name: Tag the next version | |
run: | | |
new_tag_name="v${{ env.next-version }}" | |
git tag "$new_tag_name" "${{ github.sha }}" | |
git push origin "$new_tag_name" |