mirror of
https://github.com/actions-rust-lang/msrv.git
synced 2025-12-27 01:43:48 -05:00
feat: add action file
This commit is contained in:
91
.github/workflows/ci.yml
vendored
Normal file
91
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
merge_group:
|
||||
types: [checks_requested]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
msrv:
|
||||
name: MSRV
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
|
||||
- name: Determine MSRV
|
||||
id: msrv
|
||||
uses: ./
|
||||
with:
|
||||
manifest-path: ./test-workspace/Cargo.toml
|
||||
|
||||
outputs:
|
||||
msrv: "${{ steps.msrv.outputs.msrv }}"
|
||||
|
||||
build:
|
||||
needs: msrv
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
toolchain:
|
||||
- { name: msrv, version: "${{ needs.msrv.outputs.msrv }}" }
|
||||
- { name: stable, version: stable }
|
||||
|
||||
name: Test / ${{ matrix.toolchain.name }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ matrix.toolchain.version }}
|
||||
cache-workspaces: ./test-workspace
|
||||
|
||||
- name: Test
|
||||
run: cargo run --manifest-path=./test-workspace/Cargo.toml
|
||||
|
||||
combined:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
name: Test Combined
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust (stable)
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
cache: false
|
||||
|
||||
- name: Determine MSRV
|
||||
id: msrv
|
||||
uses: ./
|
||||
with:
|
||||
manifest-path: ./test-workspace/Cargo.toml
|
||||
|
||||
- name: Install Rust (MSRV)
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: ${{ steps.msrv.outputs.msrv }}
|
||||
cache-workspaces: ./test-workspace
|
||||
|
||||
- name: Test
|
||||
run: cargo run --manifest-path=./test-workspace/Cargo.toml
|
||||
5
CHANGELOG.md
Normal file
5
CHANGELOG.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## 0.1.0
|
||||
|
||||
- Initial release.
|
||||
30
action.yml
Normal file
30
action.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
name: Determine minimum supported Rust version (MSRV) for workspace
|
||||
|
||||
description: |
|
||||
Determine minimum supported Rust version (MSRV) for workspace for use in a job matrix.
|
||||
|
||||
inputs:
|
||||
manifest-path:
|
||||
description: Path to Cargo.toml manifest for workspace
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
|
||||
steps:
|
||||
- name: Read MSRV from workspace manifest
|
||||
id: read_msrv
|
||||
shell: bash
|
||||
run: |
|
||||
cargo metadata --format-version=1 --manifest-path=${{ inputs.manifest-path || 'Cargo.toml' }} \
|
||||
| jq -r 'first(.packages[] | select(.source == null and .rust_version)) | .rust_version' \
|
||||
| sed -E 's/^1\.([0-9]{2})$/1\.\1\.0/' \
|
||||
| xargs -0 printf "msrv=%s" \
|
||||
| tee /dev/stderr \
|
||||
>> "$GITHUB_OUTPUT"
|
||||
|
||||
outputs:
|
||||
msrv:
|
||||
description: |-
|
||||
Minimum supported Rust version. E.g.: 1.72.1"
|
||||
value: ${{ steps.read_msrv.outputs.msrv }}
|
||||
74
test-workspace/Cargo.lock
generated
Normal file
74
test-workspace/Cargo.lock
generated
Normal file
@@ -0,0 +1,74 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "crate"
|
||||
version = "1.0.0"
|
||||
dependencies = [
|
||||
"detrim",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "detrim"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a398843bbb5c8aa78639440d0ab4d6d14e9a24337046394053a95299ec4418da"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.84"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec96c6a92621310b51366f1e28d05ef11489516e93be030060e5fc12024a49d6"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.36"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.203"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.203"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
||||
9
test-workspace/Cargo.toml
Normal file
9
test-workspace/Cargo.toml
Normal file
@@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "crate"
|
||||
version = "1.0.0"
|
||||
publish = false
|
||||
edition = "2018"
|
||||
rust-version = "1.72"
|
||||
|
||||
[dependencies]
|
||||
detrim = "0.1"
|
||||
3
test-workspace/src/main.rs
Normal file
3
test-workspace/src/main.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
Reference in New Issue
Block a user