Skip to content

Commit

Permalink
chore: Update to skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Apr 25, 2022
1 parent 2c151bc commit 0acd8b3
Show file tree
Hide file tree
Showing 19 changed files with 682 additions and 103 deletions.
5 changes: 5 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[target.x86_64-pc-windows-msvc]
rustflags = ["-Ctarget-feature=+crt-static"]

[target.i686-pc-windows-msvc]
rustflags = ["-Ctarget-feature=+crt-static"]
1 change: 1 addition & 0 deletions .clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
msrv = "1.54.0" # MSRV
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2
updates:
- package-ecosystem: cargo
directory: "/"
schedule:
interval: monthly
time: "07:00"
open-pull-requests-limit: 10

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: monthly
time: "07:00"
open-pull-requests-limit: 10
48 changes: 48 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# These settings are synced to GitHub by https://probot.github.io/apps/settings/

repository:
description: Command-line tool to run Rust \"scripts\" which can make use of crates.
homepage: https://rust-script.org
topics: rust cargo script
has_issues: true
has_projects: false
has_wiki: false
has_downloads: true
default_branch: main

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: main
protection:
required_pull_request_reviews: null
required_conversation_resolution: true
required_status_checks:
# Required. Require branches to be up to date before merging.
strict: false
contexts: ["CI", "Lint Commits", "Spell Check with Typos"]
enforce_admins: false
restrictions: null
21 changes: 21 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Security audit
on:
pull_request:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
schedule:
- cron: '1 1 1 * *'
jobs:
security_audit:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
212 changes: 123 additions & 89 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,104 +1,74 @@
name: CI

on: push

on:
pull_request:
paths:
- '**'
- '!/*.md'
- '!/docs/**'
- "!/LICENSE-*"
push:
branches:
- main
paths:
- '**'
- '!/*.md'
- '!/docs/**'
- "!/LICENSE-*"
schedule:
- cron: '1 1 1 * *'
jobs:

ci:
name: CI
needs: [test, test-install-file-association, msrv, docs, rustfmt, clippy]
runs-on: ubuntu-latest
steps:
- name: Done
run: exit 0
test:
name: Test
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
rust: ["stable"]
continue-on-error: ${{ matrix.rust != 'stable' }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Setup stable rust
uses: hecrj/setup-rust-action@v1
with:
rust-version: "stable"
- name: Setup nightly rust
uses: hecrj/setup-rust-action@v1
with:
rust-version: nightly
- name: Setup MSRV rust
uses: hecrj/setup-rust-action@v1
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
rust-version: "1.54.0"
- name: Run unit tests
run: rustc --version && cargo --version && cargo test
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
- name: Build
run: cargo test --no-run --workspace --all-features
- 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
- name: Run script tests
if: runner.os != 'Windows'
run: |
# Run twice to test problem with expression caching
./tests/scripts/test-runner.sh
./tests/scripts/test-runner.sh
(cd tests/scripts/ignores-rust-toolchain && ../../../target/debug/rust-script test.rs)
check-format:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Setup rust
uses: hecrj/setup-rust-action@v1
- name: Install rustfmt
run: rustup component add rustfmt
- name: Check formatting with rustfmt
run: cargo fmt -- --check

check-clippy:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Setup rust
uses: hecrj/setup-rust-action@v1
- name: Install rustfmt
run: rustup component add clippy
- name: Check for clippy warnings
run: cargo clippy --all-targets --all-features -- -D warnings -W clippy::cargo

upload-debug-builds:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Setup rust
uses: hecrj/setup-rust-action@v1
- name: Build debug
run: cargo build
- name: Upload Windows debug build
if: runner.os == 'Windows'
uses: actions/upload-artifact@v2
with:
path: ./target/debug/rust-script.exe
name: windows-binary
- name: Upload macOS debug build
if: runner.os == 'macOS'
uses: actions/upload-artifact@v2
with:
path: ./target/debug/rust-script
name: mac-binary
- name: Upload Linux debug build
if: runner.os == 'Linux'
uses: actions/upload-artifact@v2
with:
path: ./target/debug/rust-script
name: linux-binary

test-install-file-association:
runs-on: windows-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Setup rust
uses: hecrj/setup-rust-action@v1
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
- name: Build debug
run: cargo build
- name: Install file association
Expand All @@ -110,11 +80,75 @@ jobs:
- name: Run example script
run: cmd.exe /C .\examples\hello.ers
continue-on-error: true

security-audit:
msrv:
name: "Check MSRV: 1.54.0"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.54.0 # MSRV
profile: minimal
override: true
- 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
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
- name: Check documentation
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --workspace --all-features --no-deps --document-private-items
rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
# Not MSRV because its harder to jump between versions and people are
# more likely to have stable
toolchain: stable
profile: minimal
override: true
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@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.54.0 # MSRV
profile: minimal
override: true
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 --allow deprecated
16 changes: 16 additions & 0 deletions .github/workflows/committed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Not run as part of pre-commit checks because they don't handle sending the correct commit
# range to `committed`
name: Lint Commits
on: [pull_request]

jobs:
committed:
name: Lint Commits
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Lint Commits
uses: crate-ci/committed@master
Loading

0 comments on commit 0acd8b3

Please sign in to comment.