chore(gh): Automate Github

This commit is contained in:
Ed Page 2021-07-01 15:45:56 -05:00
parent fc05aa9633
commit 4254f47a79
5 changed files with 222 additions and 165 deletions

View file

@ -6,42 +6,3 @@ updates:
interval: monthly interval: monthly
time: "07:00" time: "07:00"
open-pull-requests-limit: 10 open-pull-requests-limit: 10
ignore:
- dependency-name: env_logger
versions:
- 0.8.3
- dependency-name: once_cell
versions:
- 1.7.0
- dependency-name: ahash
versions:
- 0.7.0
- 0.7.2
- dependency-name: bstr
versions:
- 0.2.15
- dependency-name: nom
versions:
- 6.1.0
- 6.1.2
- dependency-name: thiserror
versions:
- 1.0.24
- dependency-name: serde_json
versions:
- 1.0.64
- dependency-name: syn
versions:
- 1.0.60
- dependency-name: log
versions:
- 0.4.14
- dependency-name: derive_setters
versions:
- 0.1.5
- dependency-name: predicates
versions:
- 1.0.7
- dependency-name: proc-exit
versions:
- 1.0.2

47
.github/settings.yml vendored Normal file
View file

@ -0,0 +1,47 @@
# These settings are synced to GitHub by https://probot.github.io/apps/settings/
repository:
description: Source code spell checker
topics: rust cli code-quality spell-checker
has_issues: true
has_projects: false
has_wiki: false
has_downloads: true
default_branch: master
allow_squash_merge: true
allow_merge_commit: true
allow_rebase_merge: true
# Manual: allow_auto_merge: true, see https://github.com/probot/settings/issues/402
delete_branch_on_merge: true
labels:
# Type
- name: bug
color: '#b60205'
description: Not as expected
- name: enhancement
color: '#1d76db'
description: Improve the expected
# Flavor
- name: question
color: "#cc317c"
description: Uncertainty is involved
- name: breaking-change
color: "#e99695"
- name: good first issue
color: '#c2e0c6'
description: Help wanted!
branches:
- name: master
protection:
required_pull_request_reviews:
required_approving_review_count: 1
dismiss_stale_reviews: false
require_code_owner_reviews: false
# Manual: required_conversation_resolution: true, see https://github.com/probot/settings/issues/458
required_status_checks:
# Required. Require branches to be up to date before merging.
strict: true

21
.github/workflows/audit.yml vendored Normal file
View file

@ -0,0 +1,21 @@
name: Security audit
on:
pull_request:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
schedule:
- cron: '3 3 3 * *'
jobs:
security_audit:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

151
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,151 @@
name: ci
on:
pull_request:
paths:
- '**'
- '!/*.md'
- '!/docs/**'
- "!/LICENSE-*"
push:
branches:
- master
paths:
- '**'
- '!/*.md'
- '!/docs/**'
- "!/LICENSE-*"
schedule:
- cron: '3 3 3 * *'
jobs:
smoke:
name: Quick Check
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
- uses: Swatinem/rust-cache@v1
- name: Default features
run: cargo check --workspace --all-targets
- name: All features
run: cargo check --workspace --all-targets --all-features
- name: No-default features
run: cargo check --workspace --all-targets --no-default-features
test:
name: Test
needs: smoke
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
rust: ["stable", "beta"]
include:
- os: ubuntu-latest
rust: "nightly"
continue-on-error: ${{ matrix.rust != 'stable' }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
- uses: Swatinem/rust-cache@v1
- name: Default features
run: cargo test --workspace
- name: All features
run: cargo test --workspace --all-features
- name: No-default features
run: cargo test --workspace --no-default-features
msrv:
name: "Check MSRV: 1.44.0"
needs: smoke
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.44.0 # MSRV
profile: minimal
- uses: Swatinem/rust-cache@v1
- name: Default features
run: cargo check --workspace --all-targets
- name: All features
run: cargo check --workspace --all-targets --all-features
- name: No-default features
run: cargo check --workspace --all-targets --no-default-features
docs:
name: Docs
needs: smoke
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
- uses: Swatinem/rust-cache@v1
- name: Check documentation
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --no-deps --document-private-items --workspace
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
components: rustfmt
- uses: Swatinem/rust-cache@v1
- name: Check formatting
run: cargo fmt --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: 1.44.0 # MSRV
profile: minimal
components: clippy
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --workspace --all-features --all-targets -- -D warnings
clippy-next:
name: clippy (next)
needs: clippy
continue-on-error: true
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
components: clippy
- uses: Swatinem/rust-cache@v1
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --workspace --all-features --all-targets -- -D warnings

View file

@ -20,91 +20,11 @@ schedules:
- master - master
variables: variables:
minrust: 1.53.0 minrust: 1.53.0
codecov_token: $(CODECOV_TOKEN_SECRET) windows_vm: windows-latest
windows_vm: vs2017-win2016 mac_vm: macOS-latest
mac_vm: macos-10.14 linux_vm: ubuntu-latest
linux_vm: ubuntu-16.04
stages: stages:
- stage: check
displayName: Compilation Check
jobs:
- job: cargo_check
displayName: cargo check
pool:
vmImage: ${{ variables.linux_vm }}
steps:
- template: install-rust.yml@templates
parameters:
rust: stable
- script: cargo check --workspace --locked
displayName: Check that Cargo.lock is satisfiable
- script: cargo check --workspace --all-targets
displayName: Default features
- script: cargo check --all-targets --no-default-features
displayName: No features
- script: cargo check --all-targets --all-features
displayName: All features
- stage: test
displayName: Test
jobs:
- job: test
displayName: Test
strategy:
matrix:
windows:
imageName: ${{ variables.windows_vm }}
target: 'x86_64-pc-windows-msvc'
channel: stable
mac:
imageName: ${{ variables.mac_vm }}
target: 'x86_64-apple-darwin'
channel: stable
linux:
imageName: ${{ variables.linux_vm }}
target: 'x86_64-unknown-linux-gnu'
channel: stable
# Check for upcoming platform-specific compiler breakages
windows_beta:
imageName: ${{ variables.windows_vm }}
target: 'x86_64-pc-windows-msvc'
channel: beta
mac_beta:
imageName: ${{ variables.mac_vm }}
target: 'x86_64-apple-darwin'
channel: beta
linux_beta:
imageName: ${{ variables.linux_vm }}
target: 'x86_64-unknown-linux-gnu'
channel: beta
# Check for compiler breakages
linux_nightly:
imageName: ${{ variables.linux_vm }}
target: 'x86_64-unknown-linux-gnu'
channel: nightly
continueOnError: $[ne(variables.channel, 'stable')]
pool:
vmImage: $(imageName)
steps:
- template: install-rust.yml@templates
parameters:
rust: $(channel)
targets: ["$(TARGET)"]
- script: cargo test --target $(TARGET) --workspace
displayName: cargo test
- script: cargo doc --target $(TARGET) --workspace --no-deps
displayName: cargo doc
- job: msrv
displayName: "${{ format('Minimum supported Rust version: {0}', variables.minrust) }}"
dependsOn: []
pool:
vmImage: ${{ variables.linux_vm }}
steps:
- template: install-rust.yml@templates
parameters:
rust: ${{ variables.minrust }}
- script: cargo check --all --bins --examples --tests
displayName: cargo check
- stage: style - stage: style
displayName: Style checks displayName: Style checks
dependsOn: [] dependsOn: []
@ -132,49 +52,6 @@ stages:
$(Build.StagingDirectory)/tools/committed HEAD~..HEAD^2 --no-merge-commit -vv $(Build.StagingDirectory)/tools/committed HEAD~..HEAD^2 --no-merge-commit -vv
displayName: Lint commit history displayName: Lint commit history
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest')) condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
- job: style
displayName: Style checking
pool:
vmImage: ${{ variables.linux_vm }}
steps:
- template: install-rust.yml@templates
parameters:
rust: stable
components:
- rustfmt
- script: cargo fmt --all -- --check
displayName: rustfmt
- job: lint
displayName: Linting
strategy:
matrix:
current:
channel: ${{ variables.minrust }}
next:
channel: stable
continueOnError: $[eq(variables.channel, 'stable')]
pool:
vmImage: ${{ variables.linux_vm }}
steps:
- template: install-rust.yml@templates
parameters:
rust: $(channel)
components:
- clippy
- script: cargo check --workspace --all-targets --all-features
displayName: Warnings
env:
RUSTFLAGS: "-D warnings"
- script: cargo clippy --workspace --all-features --all-targets -- -D warnings
displayName: clippy
- ${{ if ne('', variables.codecov_token) }}:
- stage: coverage
displayName: Code coverage
dependsOn: test
jobs:
- template: coverage.yml@templates
parameters:
token: ${{ variables.codecov_token }}
- stage: codegen - stage: codegen
displayName: Verify Code-gen displayName: Verify Code-gen
dependsOn: ["check"] dependsOn: ["check"]