Skip to content

Commit

Permalink
Merge pull request #12 from thomastaylor312/feat/add_pipelines
Browse files Browse the repository at this point in the history
feat(ci): Adds pipelines for testing and release
  • Loading branch information
thomastaylor312 authored Dec 17, 2021
2 parents e2c121a + 483974c commit 4271c7f
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 3 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -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
36 changes: 36 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
12 changes: 9 additions & 3 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
);
}
}
}

0 comments on commit 4271c7f

Please sign in to comment.