Skip to content

Commit

Permalink
ci(actions): add issue/pull request templates and github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninjani committed Nov 28, 2020
1 parent 69a6562 commit 319da12
Show file tree
Hide file tree
Showing 7 changed files with 267 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

## Bug description

<!-- A clear and concise description of what the bug is. -->

## To Reproduce

<!--
Steps to reproduce the behavior. Something like:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
-->

## Expected behavior

<!-- A clear and concise description of what you expected to happen. -->

## Screenshots

<!-- If applicable, add screenshots to help explain your problem. -->

## Environment

<!-- Please fill the following information. -->

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

## Additional context

<!-- Add any other context about the problem here. -->
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: true
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

## Problem

<!--
If your feature request is related to a problem, please describe it.
Ex. I hate when [...]
-->

## Solution

<!-- Describe the solution you'd like. -->

## Alternatives

<!-- Describe any alternative solutions or features you've considered. -->

## Additional context

<!-- Add any other context or screenshots about the feature request here. -->
14 changes: 14 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!-- Please explain the changes you made -->

<!--
Please, make sure:
- you have read the contributing guidelines:
https://github.com/out-of-cheese-error/gooseberry/blob/master/docs/CONTRIBUTING.md
- you have linted the code using clippy:
https://github.com/rust-lang/rust-clippy
- you have formatted the code using rustfmt:
https://github.com/rust-lang/rustfmt
- you have checked that all tests pass, by running `cargo test --all` (see CONTRIBUTING.md for information on setting up tests)
- you have updated the changelog (if needed):
https://github.com/out-of-cheese-error/gooseberry/blob/master/CHANGELOG.md
-->
22 changes: 22 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -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 }}

79 changes: 79 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -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
82 changes: 82 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
# 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'

0 comments on commit 319da12

Please sign in to comment.