chore: remove unnecessary log tag #676
Workflow file for this run
This file contains hidden or 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: ["**"] | |
| tags: | |
| - "v*" | |
| pull_request: | |
| branches: ["**"] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| CRATE_MANIFEST: crates/nesium-core/Cargo.toml | |
| # Skip ESP32 crate here because it needs the Xtensa toolchain/SDK. | |
| WORKSPACE_FLAGS: --workspace --exclude nesium-esp32 | |
| COVERAGE_FLAGS: --manifest-path crates/nesium-core/Cargo.toml --all-targets | |
| PUBLISH_MANIFESTS: | | |
| crates/nesium-core/Cargo.toml | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| rust: | |
| - stable | |
| - beta | |
| - nightly | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: List workspace members | |
| run: | | |
| set -euo pipefail | |
| cargo metadata --no-deps --format-version 1 | jq -r '.packages[].name' | sort | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| components: rustfmt, clippy, llvm-tools-preview | |
| - name: Cache cargo artifacts | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: ${{ matrix.rust }} | |
| - name: Install system development libraries | |
| run: | | |
| set -euo pipefail | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| pkg-config \ | |
| libasound2-dev \ | |
| libudev-dev \ | |
| libfreetype6-dev \ | |
| libfontconfig1-dev | |
| - name: Run tests | |
| run: cargo test ${{ env.WORKSPACE_FLAGS }} --all-targets --verbose | |
| - name: Format | |
| run: cargo fmt --all -- --check | |
| - name: Clippy | |
| run: cargo clippy ${{ env.WORKSPACE_FLAGS }} --all-targets | |
| - name: Install cargo-llvm-cov | |
| if: matrix.rust == 'stable' | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-llvm-cov | |
| - name: Generate coverage report | |
| if: matrix.rust == 'stable' | |
| run: cargo llvm-cov ${{ env.COVERAGE_FLAGS }} --lcov --output-path lcov.info | |
| - name: Upload coverage to Codecov | |
| if: matrix.rust == 'stable' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: lcov.info | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| flags: nesium-core | |
| name: codecov-nesium-core | |
| fail_ci_if_error: true | |
| release: | |
| needs: build | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| - name: Get version from tag | |
| id: tag | |
| run: | | |
| set -euo pipefail | |
| version=${GITHUB_REF#refs/tags/} | |
| echo "version=$version" >> $GITHUB_OUTPUT | |
| - name: Publish crates to crates.io (skip prerelease) | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| run: | | |
| set -euo pipefail | |
| version=${{ steps.tag.outputs.version }} | |
| if [[ "$version" =~ -(dev|alpha|beta|rc|prerelease).* ]]; then | |
| echo "Pre-release version ($version), skip publishing to crates.io" | |
| exit 0 | |
| fi | |
| for manifest in $PUBLISH_MANIFESTS; do | |
| echo "Publishing $manifest..." | |
| cargo publish --manifest-path "$manifest" --token "$CARGO_REGISTRY_TOKEN" | |
| done | |
| - name: Package source code | |
| run: | | |
| set -euo pipefail | |
| version=${{ steps.tag.outputs.version }} | |
| repo_name=${{ github.event.repository.name }} | |
| git archive --format=tar.gz --output=${repo_name}-${version}.tar.gz HEAD | |
| sha256sum ${repo_name}-${version}.tar.gz > ${repo_name}-${version}.tar.gz.sha256 | |
| - name: Generate changelog | |
| id: changelog | |
| run: | | |
| set -euo pipefail | |
| prev_tag=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") | |
| if [ -n "$prev_tag" ]; then | |
| log=$(git log --pretty=format:"* %s" ${prev_tag}..HEAD) | |
| else | |
| log=$(git log --pretty=format:"* %s") | |
| fi | |
| if [ -z "$log" ]; then | |
| log="Initial release" | |
| fi | |
| echo "log<<EOF" >> $GITHUB_OUTPUT | |
| echo "$log" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: "Release ${{ steps.tag.outputs.version }}" | |
| tag_name: ${{ steps.tag.outputs.version }} | |
| body: ${{ steps.changelog.outputs.log }} | |
| files: | | |
| ${{ github.event.repository.name }}-${{ steps.tag.outputs.version }}.tar.gz | |
| ${{ github.event.repository.name }}-${{ steps.tag.outputs.version }}.tar.gz.sha256 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |