From 483974c37e278884ba27742ab89a7506345ac931 Mon Sep 17 00:00:00 2001 From: Taylor Thomas Date: Fri, 17 Dec 2021 09:17:55 -0700 Subject: [PATCH] feat(ci): Adds pipelines for testing and release Signed-off-by: Taylor Thomas --- .github/workflows/build.yaml | 33 +++++++++++++++++++++++++++++++ .github/workflows/release.yaml | 36 ++++++++++++++++++++++++++++++++++ src/error.rs | 12 +++++++++--- 3 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/build.yaml create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..188470c --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,33 @@ +name: Build + +on: + push: + branches: [master] + pull_request: + +env: + CARGO_TERM_COLOR: always + +jobs: + test: + runs-on: ${{ matrix.config.os }} + strategy: + fail-fast: false + matrix: + config: + - { os: "ubuntu-latest" } + - { os: "macos-latest" } + - { os: "windows-latest" } + + steps: + - uses: actions/checkout@v2 + - name: Install latest Rust stable toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + default: true + components: clippy, rustfmt + - name: Format check + run: cargo fmt --all -- --check + - name: Test + run: cargo test diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..455d0a5 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,36 @@ +name: Release + +on: + push: + tags: + - "v*" + +env: + CARGO_TERM_COLOR: always + +jobs: + github_release: + if: startswith(github.ref, 'refs/tags/') # Only run on tag push + runs-on: ubuntu-latest + steps: + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: true + + crates_release: + if: startswith(github.ref, 'refs/tags/') # Only run on tag push + needs: github_release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - id: crates-release-action + uses: wasmcloud/common-actions/crates-release@main + with: + crates-token: ${{ secrets.CRATES_PUBLISH_TOKEN }} diff --git a/src/error.rs b/src/error.rs index 63841e9..efb3e52 100644 --- a/src/error.rs +++ b/src/error.rs @@ -131,7 +131,13 @@ impl fmt::Display for Error { mod tests { #[test] fn test_error_to_string() { - assert_eq!(err!(InvalidSeedLength, "Testing").to_string(), "Invalid seed length: Testing"); - assert_eq!(err!(InvalidSeedLength, "Testing {}", 1).to_string(), "Invalid seed length: Testing 1"); + assert_eq!( + err!(InvalidSeedLength, "Testing").to_string(), + "Invalid seed length: Testing" + ); + assert_eq!( + err!(InvalidSeedLength, "Testing {}", 1).to_string(), + "Invalid seed length: Testing 1" + ); } -} \ No newline at end of file +}