Skip to content

Merge pull request #111 from aftix/master #156

Merge pull request #111 from aftix/master

Merge pull request #111 from aftix/master #156

Workflow file for this run

name: Build
on:
push:
pull_request:
jobs:
build:
timeout-minutes: 10
strategy:
matrix:
include:
# native stable
- name: 'stable linux'
os: 'ubuntu-latest'
target: 'x86_64-unknown-linux-gnu'
rust_version: 'stable'
- name: 'stable mac'
os: 'macos-latest'
target: 'x86_64-apple-darwin'
rust_version: 'stable'
- name: 'stable windows'
os: 'windows-latest'
target: 'x86_64-pc-windows-msvc'
rust_version: 'stable'
fail-fast: false
runs-on: ${{ matrix.os }}
name: ${{ matrix.name }}
steps:
- name: checkout repo
uses: actions/checkout@v2
- name: load cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ matrix.os }}-${{ matrix.target }}-${{ matrix.rust_version }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ matrix.os }}-${{ matrix.target }}-${{ matrix.rust_version }}-cargo-
- name: install rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust_version }}
target: ${{ matrix.target }}
profile: minimal
components: clippy
default: true
- name: check
uses: actions-rs/cargo@v1
with:
command: clippy
args: --target ${{ matrix.target }} -- -D warnings
- name: build
uses: actions-rs/cargo@v1
with:
command: build
args: --target ${{ matrix.target }}
- name: doc
uses: actions-rs/cargo@v1
env:
RUSTDOCFLAGS: -D warnings
with:
command: doc
args: --no-deps --target ${{ matrix.target }}
cargo-fmt:
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v2
- name: install rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
components: rustfmt
default: true
- name: check format
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
cargo-deny:
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v2
- name: check denies
uses: EmbarkStudios/cargo-deny-action@v1
with:
log-level: warn
command: check
arguments: --all-features
publish:
runs-on: ubuntu-latest
needs: ['build', 'cargo-fmt', 'cargo-deny']
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
steps:
- name: checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- name: install cargo-release
run: |
curl -LsSf https://github.com/crate-ci/cargo-release/releases/download/v0.21.0/cargo-release-v0.21.0-x86_64-unknown-linux-gnu.tar.gz | tar xzf - -C ${CARGO_HOME:-~/.cargo}/bin
- name: release to crates.io
run: |
git config user.name "releasebot"
git config user.email "[email protected]"
git checkout master
cargo login ${{ secrets.CRATES_TOKEN }}
cargo release --no-confirm --execute $( echo '${{ github.ref }}' | sed 's?refs/tags/v??' )
- name: generate release notes
id: notes
run: |
NOTES=$(python -c 'import re; print(re.search("## v\\d+.\\d+.\\d+\n\nReleased \\d+-\\d+-\\d+\n\n((?:[\n]|.)*?)(?=## [vD])", open("CHANGELOG.md", "r").read()).group(1).strip().replace("%", "%25").replace("\n", "%0A"))')
echo "::set-output name=notes::$NOTES"
- name: release to github
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: ${{ steps.notes.outputs.notes }}
draft: false
prerelease: false