From 319da125e7393737ca5813ced3225b74f1123807 Mon Sep 17 00:00:00 2001 From: Ninjani <48680156+Ninjani@users.noreply.github.com> Date: Sat, 28 Nov 2020 15:11:09 +0100 Subject: [PATCH] ci(actions): add issue/pull request templates and github actions From https://github.com/rust-github/template --- .github/ISSUE_TEMPLATE/bug_report.md | 42 ++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 1 + .github/ISSUE_TEMPLATE/feature_request.md | 27 ++++++++ .github/PULL_REQUEST_TEMPLATE.md | 14 ++++ .github/workflows/audit.yml | 22 ++++++ .github/workflows/cd.yml | 79 ++++++++++++++++++++++ .github/workflows/ci.yml | 82 +++++++++++++++++++++++ 7 files changed, 267 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/audit.yml create mode 100644 .github/workflows/cd.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..34769f9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,42 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +## Bug description + + + +## To Reproduce + + + +## Expected behavior + + + +## Screenshots + + + +## Environment + + + +- OS: [e.g. iOS] +- Browser [e.g. chrome, safari] +- Version [e.g. 22] + +## Additional context + + diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..0086358 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: true diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..dc3d67f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,27 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: '' + +--- + +## Problem + + + +## Solution + + + +## Alternatives + + + +## Additional context + + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..d7f26b1 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,14 @@ + + + diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml new file mode 100644 index 0000000..9e603ac --- /dev/null +++ b/.github/workflows/audit.yml @@ -0,0 +1,22 @@ +name: Security audit + +on: + schedule: + # Runs at 00:00 UTC everyday + - cron: '0 0 * * *' + push: + paths: + - '**/Cargo.toml' + - '**/Cargo.lock' + pull_request: + +jobs: + audit: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - uses: actions-rs/audit-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..de532ca --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,79 @@ +name: Continuous Deployment + +on: + push: + tags: + - '[0-9]+.[0-9]+.[0-9]+' + +jobs: + publish: + name: Publishing for ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ macos-latest, ubuntu-latest ] + # os: [macos-latest, ubuntu-latest, windows-latest] + rust: [ stable ] + include: + - os: macos-latest + artifact_prefix: macos + target: x86_64-apple-darwin + binary_postfix: "" + - os: ubuntu-latest + artifact_prefix: linux + target: x86_64-unknown-linux-gnu + binary_postfix: "" + # - os: windows-latest + # artifact_prefix: windows + # target: x86_64-pc-windows-msvc + # binary_postfix: ".exe" + + steps: + - name: Installing Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + override: true + - name: Checkout repository + uses: actions/checkout@v2 + - name: Cargo build + uses: actions-rs/cargo@v1 + with: + command: build + toolchain: ${{ matrix.rust }} + args: --release --target ${{ matrix.target }} + + - name: Packaging final binary + shell: bash + run: | + cd target/${{ matrix.target }}/release + strip gooseberry${{ matrix.binary_postfix }} + tar czvf gooseberry-${{ matrix.artifact_prefix }}.tar.gz gooseberry${{ matrix.binary_postfix }} + + if [[ ${{ runner.os }} == 'Windows' ]]; then + certutil -hashfile gooseberry-${{ matrix.artifact_prefix }}.tar.gz sha256 | grep -E [A-Fa-f0-9]{64} > gooseberry-${{ matrix.artifact_prefix }}.sha256 + else + shasum -a 256 gooseberry-${{ matrix.artifact_prefix }}.tar.gz > gooseberry-${{ matrix.artifact_prefix }}.sha256 + fi + - name: Releasing assets + uses: softprops/action-gh-release@v1 + with: + files: | + target/${{ matrix.target }}/release/gooseberry-${{ matrix.artifact_prefix }}.tar.gz + target/${{ matrix.target }}/release/gooseberry-${{ matrix.artifact_prefix }}.sha256 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + publish-cargo: + name: Publishing to Cargo + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + with: + command: publish + args: --token ${{ secrets.CARGO_API_KEY }} --allow-dirty diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f2512c9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,82 @@ +on: [ push, pull_request ] +name: Continuous Integration + +jobs: + + # test: + # name: Test Suite + # runs-on: ubuntu-latest + # steps: + # - name: Checkout repository + # uses: actions/checkout@v2 + # - name: Install Rust + # uses: actions-rs/toolchain@v1 + # with: + # toolchain: stable + # profile: minimal + # override: true + # - uses: actions-rs/cargo@v1 + # with: + # command: test + + rustfmt: + name: Rustfmt + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + components: rustfmt + - name: Check formatting + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + clippy: + name: Clippy + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + components: clippy + - name: Clippy Check + uses: actions-rs/cargo@v1 + with: + command: clippy + args: -- -D warnings + +# coverage: +# name: Code coverage +# runs-on: ubuntu-latest +# steps: +# - name: Checkout repository +# uses: actions/checkout@v2 +# - name: Install stable toolchain +# uses: actions-rs/toolchain@v1 +# with: +# toolchain: stable +# override: true +# - name: Run cargo-tarpaulin +# uses: actions-rs/tarpaulin@v0.1 +# with: +# args: '--ignore-tests --out Lcov' +# - name: Upload to Coveralls +# # upload only if push +# if: ${{ github.event_name == 'push' }} +# uses: coverallsapp/github-action@master +# with: +# github-token: ${{ secrets.GITHUB_TOKEN }} +# path-to-lcov: './lcov.info' +