diff options
-rwxr-xr-x | .ci/build.sh | 17 | ||||
-rwxr-xr-x | .ci/test.sh | 17 | ||||
-rw-r--r-- | .github/workflows/build.yml | 36 | ||||
-rw-r--r-- | .github/workflows/release.yaml | 48 |
4 files changed, 118 insertions, 0 deletions
diff --git a/.ci/build.sh b/.ci/build.sh new file mode 100755 index 0000000..610f33d --- /dev/null +++ b/.ci/build.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +: "${FEATURE_BUILD:=default}" + +CARGO_ARGS=() + +function set_cargo_args() { + if [ "$FEATURE_BUILD" != "default" ]; then + CARGO_ARGS+=(--no-default-features) + fi +} + +set_cargo_args + +set -x + +cargo build --verbose --release "${CARGO_ARGS[@]}" diff --git a/.ci/test.sh b/.ci/test.sh new file mode 100755 index 0000000..6840023 --- /dev/null +++ b/.ci/test.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +: "${FEATURE_BUILD:=default}" + +CARGO_ARGS=() + +function set_cargo_args() { + if [ "$FEATURE_BUILD" != "default" ]; then + CARGO_ARGS+=(--no-default-features) + fi +} + +set_cargo_args + +set -x + +cargo test --verbose "${CARGO_ARGS[@]}" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..08dbc35 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,36 @@ +name: Build + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + static-analysis: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - name: Install cargo components + run: | + rustup component add rustfmt + rustup component add clippy + - name: Rust Format + run: cargo fmt --all -- --check + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --all-features + build: + strategy: + matrix: + build: + - type: linux + os: ubuntu-latest + runs-on: ${{matrix.build.os}} + steps: + - uses: actions/checkout@v2 + - name: Build + run: .ci/build.sh + - name: Run tests + run: .ci/test.sh diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..eae8666 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,48 @@ +on: + push: + tags: + - 'v*' +name: Release + +jobs: + create_release: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Delete Previous Draft Releases + uses: jakeswenson/action-delete-latest-release@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Checkout # needed so that changelog generator can pull the latest release tag + uses: actions/checkout@v2 + - name: Generate changelog + id: changelog + uses: metcalfc/changelog-generator@v0.3.2 + with: + myToken: ${{ secrets.GITHUB_TOKEN }} + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + body: ${{ steps.changelog.outputs.changelog }} + draft: true + prerelease: false + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + + build-release: + name: Release Build + needs: create_release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: build + run: .ci/build.sh + - name: Cargo Publish + if: matrix.build.publish == true + run: cargo publish --locked --token "${{secrets.crates_token}}" |