mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 06:44:16 +00:00
chore(gh): Add CI for v2-master
I'm considering making `v2-master` an LTS but will only offer new releases on ecosystem-wide breakages (ie unlikely to happen). This would be to make users more comfortable with the rate of breaking releases.
This commit is contained in:
parent
d51ae89656
commit
432e889f10
12 changed files with 319 additions and 135 deletions
|
@ -1,61 +0,0 @@
|
|||
name: $(Build.BuildId)
|
||||
trigger:
|
||||
# Always build master
|
||||
- v2-master
|
||||
pr:
|
||||
# Enable building pull requests.
|
||||
- v2-master
|
||||
stages:
|
||||
- stage: Testing
|
||||
jobs:
|
||||
- job:
|
||||
variables:
|
||||
rust: 1.36.0
|
||||
strategy:
|
||||
matrix:
|
||||
Windows 32-bit (MSVC):
|
||||
image: vs2017-win2016
|
||||
target: i686-pc-windows-msvc
|
||||
Windows 64-bit (MSVC):
|
||||
image: vs2017-win2016
|
||||
target: x86_64-pc-windows-msvc
|
||||
Windows 32-bit (MinGW):
|
||||
image: vs2017-win2016
|
||||
target: i686-pc-windows-gnu
|
||||
Windows 64-bit (MinGW):
|
||||
image: vs2017-win2016
|
||||
target: x86_64-pc-windows-gnu
|
||||
pool:
|
||||
vmImage: $(image)
|
||||
steps:
|
||||
- checkout: self
|
||||
fetchDepth: 1
|
||||
path: clap
|
||||
displayName: Checkout repository
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: cargo | "$(rust)" | $(target) | Cargo.toml
|
||||
path: C:\Rust\.cargo
|
||||
displayName: Caching cargo
|
||||
- task: Cache@2
|
||||
inputs:
|
||||
key: compiled | "$(rust)" | $(target) | Cargo.toml
|
||||
path: target
|
||||
displayName: Caching compiled
|
||||
- script: rustup default $(rust)-$(target)
|
||||
displayName: Install rust
|
||||
- script: cargo test --no-default-features
|
||||
displayName: Test without default features
|
||||
env:
|
||||
RUST_BACKTRACE: full
|
||||
- script: cargo test --features "yaml unstable"
|
||||
displayName: Test with most features
|
||||
env:
|
||||
RUST_BACKTRACE: full
|
||||
- script: |
|
||||
rmdir /Q /S C:\Rust\.cargo\registry\src
|
||||
rmdir /Q /S target\.rustc_info.json
|
||||
rmdir /Q /S target\debug\examples
|
||||
rmdir /Q /S target\debug\incremental
|
||||
displayName: Cleaning for cache
|
||||
continueOnError: true
|
1
.clippy.toml
Normal file
1
.clippy.toml
Normal file
|
@ -0,0 +1 @@
|
|||
msrv = "1.46.0" # MSRV
|
112
.github/workflows/ci.yml
vendored
Normal file
112
.github/workflows/ci.yml
vendored
Normal file
|
@ -0,0 +1,112 @@
|
|||
name: CI
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [v2-master]
|
||||
schedule:
|
||||
- cron: '3 3 3 * *'
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
permissions:
|
||||
contents: none
|
||||
name: CI
|
||||
needs: [test, check, docs]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Done
|
||||
run: exit 0
|
||||
test:
|
||||
name: Test
|
||||
strategy:
|
||||
matrix:
|
||||
build: [linux, windows, mac, minimal, default]
|
||||
include:
|
||||
- build: linux
|
||||
os: ubuntu-latest
|
||||
rust: "stable"
|
||||
features: "full"
|
||||
- build: windows
|
||||
os: windows-latest
|
||||
rust: "stable"
|
||||
features: "full"
|
||||
- build: mac
|
||||
os: macos-latest
|
||||
rust: "stable"
|
||||
features: "full"
|
||||
- build: minimal
|
||||
os: ubuntu-latest
|
||||
rust: "stable"
|
||||
features: "minimal"
|
||||
- build: default
|
||||
os: ubuntu-latest
|
||||
rust: "stable"
|
||||
features: "default"
|
||||
continue-on-error: ${{ matrix.rust != 'stable' }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ matrix.rust }}
|
||||
profile: minimal
|
||||
override: true
|
||||
- uses: Swatinem/rust-cache@v1
|
||||
- name: Build
|
||||
run: make build-${{matrix.features}}
|
||||
- name: Test
|
||||
run: make test-${{matrix.features}}
|
||||
- name: Test (ultra-minimal)
|
||||
if: matrix.build == 'minimal'
|
||||
run: make test-minimal ARGS='--manifest-path Cargo.toml'
|
||||
check:
|
||||
name: Check
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
build: [msrv, debug, release]
|
||||
include:
|
||||
- build: msrv
|
||||
rust: 1.46.0 # MSRV
|
||||
target: x86_64-unknown-linux-gnu
|
||||
features: full
|
||||
- build: debug
|
||||
rust: stable
|
||||
target: x86_64-unknown-linux-gnu
|
||||
features: debug
|
||||
- build: release
|
||||
rust: stable
|
||||
target: x86_64-unknown-linux-gnu
|
||||
features: release
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
- name: Install rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ matrix.rust }}
|
||||
target: ${{ matrix.target }}
|
||||
override: true
|
||||
- uses: Swatinem/rust-cache@v1
|
||||
- name: Check
|
||||
run: make check-${{ matrix.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
|
||||
run: make doc
|
16
.github/workflows/committed.yml
vendored
Normal file
16
.github/workflows/committed.yml
vendored
Normal file
|
@ -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
|
42
.github/workflows/post-release.yml
vendored
Normal file
42
.github/workflows/post-release.yml
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
name: post-release
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
create-release:
|
||||
permissions:
|
||||
contents: write # for actions/create-release to create a release
|
||||
name: create-release
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
upload_url: ${{ steps.release.outputs.upload_url }}
|
||||
release_version: ${{ env.RELEASE_VERSION }}
|
||||
steps:
|
||||
- name: Get the release version from the tag
|
||||
shell: bash
|
||||
if: env.RELEASE_VERSION == ''
|
||||
run: |
|
||||
# See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027
|
||||
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
||||
echo "version is: ${{ env.RELEASE_VERSION }}"
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- name: Generate Release Notes
|
||||
run: |
|
||||
./.github/workflows/release-notes.py --tag ${{ env.RELEASE_VERSION }} --output notes-${{ env.RELEASE_VERSION }}.md
|
||||
cat notes-${{ env.RELEASE_VERSION }}.md
|
||||
- name: Create GitHub release
|
||||
id: release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ env.RELEASE_VERSION }}
|
||||
release_name: ${{ env.RELEASE_VERSION }}
|
||||
body_path: notes-${{ env.RELEASE_VERSION }}.md
|
43
.github/workflows/release-notes.py
vendored
Executable file
43
.github/workflows/release-notes.py
vendored
Executable file
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import re
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
|
||||
_STDIO = pathlib.Path("-")
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-i", "--input", type=pathlib.Path, default="CHANGELOG.md")
|
||||
parser.add_argument("--tag", required=True)
|
||||
parser.add_argument("-o", "--output", type=pathlib.Path, required=True)
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.input == _STDIO:
|
||||
lines = sys.stdin.readlines()
|
||||
else:
|
||||
with args.input.open() as fh:
|
||||
lines = fh.readlines()
|
||||
version = args.tag.lstrip("v")
|
||||
|
||||
note_lines = []
|
||||
for line in lines:
|
||||
if line.startswith("## ") and version in line:
|
||||
note_lines.append(line)
|
||||
elif note_lines and line.startswith("## "):
|
||||
break
|
||||
elif note_lines:
|
||||
note_lines.append(line)
|
||||
|
||||
notes = "".join(note_lines).strip()
|
||||
if args.output == _STDIO:
|
||||
print(notes)
|
||||
else:
|
||||
args.output.write_text(notes)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
61
.github/workflows/rust-next.yml
vendored
Normal file
61
.github/workflows/rust-next.yml
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
name: rust-next
|
||||
on:
|
||||
schedule:
|
||||
- cron: '3 3 3 * *'
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
strategy:
|
||||
matrix:
|
||||
build: [stable, linux, windows, mac, nightly, minimal, default, next]
|
||||
include:
|
||||
- build: stable
|
||||
os: ubuntu-latest
|
||||
rust: "stable"
|
||||
features: "full"
|
||||
- build: linux
|
||||
os: ubuntu-latest
|
||||
rust: "beta"
|
||||
features: "full"
|
||||
- build: windows
|
||||
os: windows-latest
|
||||
rust: "beta"
|
||||
features: "full"
|
||||
- build: mac
|
||||
os: macos-latest
|
||||
rust: "beta"
|
||||
features: "full"
|
||||
- build: nightly
|
||||
os: ubuntu-latest
|
||||
rust: "nightly"
|
||||
features: "full"
|
||||
- build: minimal
|
||||
os: ubuntu-latest
|
||||
rust: "stable"
|
||||
features: "minimal"
|
||||
- build: default
|
||||
os: ubuntu-latest
|
||||
rust: "stable"
|
||||
features: "default"
|
||||
continue-on-error: ${{ matrix.rust != 'stable' }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ matrix.rust }}
|
||||
profile: minimal
|
||||
override: true
|
||||
- uses: Swatinem/rust-cache@v1
|
||||
- name: Build
|
||||
run: make build-${{matrix.features}}
|
||||
- name: Test
|
||||
run: make test-${{matrix.features}}
|
||||
- name: Test (ultra-minimal)
|
||||
if: matrix.build == 'minimal'
|
||||
run: make test-minimal ARGS='--manifest-path Cargo.toml'
|
66
.travis.yml
66
.travis.yml
|
@ -1,66 +0,0 @@
|
|||
os: linux
|
||||
language: rust
|
||||
cache: cargo
|
||||
before_cache:
|
||||
- find target/debug -type f -maxdepth 1 -delete
|
||||
- rm -rf target/.rustc_info.json
|
||||
- rm -rf target/debug/examples
|
||||
- rm -rf target/debug/incremental
|
||||
- rm -rf target/tests/target/debug/incremental
|
||||
- rm -rf target/tests/target/debug/deps/{clap*, trybuild*}
|
||||
- rm -rf target/debug/{deps,.fingerpint}/clap*
|
||||
- find target/debug/deps -name "clap*" -exec rm -rf {} +
|
||||
- ls -1 examples/ | sed -e 's/\.rs$//' | xargs -I "{{}}" find target/debug/deps -name "{{}}*" -exec rm -rf {} +
|
||||
- ls -1 tests/ | sed -e 's/\.rs$//' | xargs -I "{{}}" find target/debug/deps -name "{{}}*" -exec rm -rf {} +
|
||||
rust: stable
|
||||
branches:
|
||||
only:
|
||||
# Always build master & Enable building pull requests.
|
||||
- v2-master
|
||||
jobs:
|
||||
allow_failures:
|
||||
- rust: nightly
|
||||
- env:
|
||||
- SHARD=coverage
|
||||
fast_finish: true
|
||||
include:
|
||||
- os: osx
|
||||
rust: 1.36.0
|
||||
- rust: 1.36.0
|
||||
- {}
|
||||
- rust: beta
|
||||
- rust: nightly
|
||||
- env:
|
||||
- SHARD=lint
|
||||
before_script:
|
||||
- rustup component add clippy
|
||||
- rustup component add rustfmt
|
||||
script:
|
||||
- echo "Checking codebase with Clippy release `cargo clippy --version`."
|
||||
- cargo clippy --lib --features "yaml unstable"
|
||||
- cargo clippy --tests --examples --features "yaml unstable"
|
||||
- cargo fmt -- --check
|
||||
- rust: nightly
|
||||
env:
|
||||
- SHARD=bench
|
||||
script:
|
||||
- cargo bench
|
||||
- env:
|
||||
- SHARD=coverage
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libssl-dev
|
||||
- cmake
|
||||
- pkg-config
|
||||
- zlib1g-dev
|
||||
update: true
|
||||
before_script:
|
||||
- cargo install cargo-tarpaulin
|
||||
script:
|
||||
- cargo tarpaulin --features "yaml unstable" --ciserver travis-ci --coveralls $TRAVIS_JOB_ID
|
||||
script:
|
||||
- cargo test --no-default-features
|
||||
- cargo test --features yaml unstable
|
||||
notifications:
|
||||
email: false
|
|
@ -14,6 +14,7 @@ description = """
|
|||
A simple to use, efficient, and full-featured Command Line Argument Parser
|
||||
"""
|
||||
edition = "2018"
|
||||
rust-version = "1.46.0" # MSRV
|
||||
|
||||
[badges]
|
||||
travis-ci = { repository = "clap-rs/clap" }
|
||||
|
|
37
Makefile
Normal file
37
Makefile
Normal file
|
@ -0,0 +1,37 @@
|
|||
# CI Steps
|
||||
#
|
||||
# Considerations
|
||||
# - Easy to debug: show the command being run
|
||||
# - Leverage CI features: Only run individual steps so we can use features like reporting elapsed time per step
|
||||
|
||||
ARGS?=--workspace
|
||||
TOOLCHAIN_TARGET ?=
|
||||
ifneq (${TOOLCHAIN_TARGET},)
|
||||
ARGS+=--target ${TOOLCHAIN_TARGET}
|
||||
endif
|
||||
|
||||
MSRV?=1.46.0
|
||||
|
||||
_FEATURES = minimal default wasm full debug release
|
||||
_FEATURES_minimal = --no-default-features
|
||||
_FEATURES_default =
|
||||
_FEATURES_full = --features "wrap_help yaml doc"
|
||||
_FEATURES_debug = ${_FEATURES_full} --features debug
|
||||
_FEATURES_release = ${_FEATURES_full} --release
|
||||
|
||||
_TARGETS=--lib --tests --examples
|
||||
|
||||
check-%:
|
||||
cargo check ${_FEATURES_${@:check-%=%}} ${_TARGETS} ${ARGS}
|
||||
|
||||
build-%:
|
||||
cargo test ${_FEATURES_${@:build-%=%}} ${_TARGETS} --no-run ${ARGS}
|
||||
|
||||
test-%:
|
||||
cargo test ${_FEATURES_${@:test-%=%}} ${ARGS}
|
||||
|
||||
clippy-%:
|
||||
cargo clippy ${_FEATURES_${@:clippy-%=%}} ${ARGS} ${_TARGETS} -- -D warnings -A deprecated
|
||||
|
||||
doc:
|
||||
cargo doc --workspace --all-features --no-deps --document-private-items
|
3
committed.toml
Normal file
3
committed.toml
Normal file
|
@ -0,0 +1,3 @@
|
|||
style="conventional"
|
||||
ignore_author_re="dependabot"
|
||||
merge_commit = false
|
11
src/lib.rs
11
src/lib.rs
|
@ -497,15 +497,10 @@
|
|||
//! This will cause *only* the patch version to be updated upon a `cargo update` call, and therefore
|
||||
//! cannot break due to new features, or bumped minimum versions of Rust.
|
||||
//!
|
||||
//! #### Minimum Version of Rust
|
||||
//! #### Minimum Version of Rust (MSRV)
|
||||
//!
|
||||
//! `clap` will officially support current stable Rust, minus two releases, but may work with prior
|
||||
//! releases as well. For example, current stable Rust at the time of this writing is 1.21.0,
|
||||
//! meaning `clap` is guaranteed to compile with 1.19.0 and beyond. At the 1.22.0 release, `clap`
|
||||
//! will be guaranteed to compile with 1.20.0 and beyond, etc.
|
||||
//!
|
||||
//! Upon bumping the minimum version of Rust (assuming it's within the stable-2 range), it *must* be
|
||||
//! clearly annotated in the `CHANGELOG.md`
|
||||
//! `clap` v2's MSRV is 1.46.0 and will only be updated for critical changes. Any changes will be
|
||||
//! noted in the `CHANGELOG.md`
|
||||
//!
|
||||
//! ## License
|
||||
//!
|
||||
|
|
Loading…
Reference in a new issue