mirror of
https://github.com/obi1kenobi/cargo-semver-checks-action.git
synced 2024-11-22 16:09:33 +01:00
CI improvements (#17)
This commit is contained in:
parent
4a28a50dd4
commit
5618d5abb9
4 changed files with 56 additions and 28 deletions
9
.github/workflows/README.md
vendored
Normal file
9
.github/workflows/README.md
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
The testing workflow is divided into three parts:
|
||||||
|
- `test-build.yml` is run on `ubuntu-latest` and contains source-related checks:
|
||||||
|
linters, formatters and verifying whether the sources match dist/ directory.
|
||||||
|
- `test-action.yml` contains simple, general integration tests of the action
|
||||||
|
that should be run on each platform.
|
||||||
|
- `test-inputs.yml` is run on `ubuntu-latest` and contains specific integration
|
||||||
|
tests checking whether the action inputs are processed properly.
|
||||||
|
|
||||||
|
`setup-test-workspace` is a helper action that creates a workspace containing two crates: the test fork of `ref_slice` and a dummy crate that has no matching baseline version on `crates.io`.
|
|
@ -1,4 +1,9 @@
|
||||||
name: Setup test workspace
|
name: Setup test workspace
|
||||||
|
inputs:
|
||||||
|
ref-slice-ref:
|
||||||
|
description: 'Reference of the ref_slice to checkout'
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
runs:
|
runs:
|
||||||
using: 'composite'
|
using: 'composite'
|
||||||
steps:
|
steps:
|
||||||
|
@ -6,7 +11,7 @@ runs:
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
repository: mgr0dzicki/cargo-semver-action-ref-slice
|
repository: mgr0dzicki/cargo-semver-action-ref-slice
|
||||||
fetch-depth: 0
|
ref: ${{ inputs.ref-slice-ref }}
|
||||||
persist-credentials: true
|
persist-credentials: true
|
||||||
path: ref_slice
|
path: ref_slice
|
||||||
- name: Create dummy crate
|
- name: Create dummy crate
|
||||||
|
|
10
.github/workflows/test-action.yml
vendored
10
.github/workflows/test-action.yml
vendored
|
@ -23,22 +23,22 @@ jobs:
|
||||||
name: Run tests
|
name: Run tests
|
||||||
runs-on: ${{ inputs.runs-on }}
|
runs-on: ${{ inputs.runs-on }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout the test repository
|
- name: Checkout the test repository and test with patch change and patch version bump
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
repository: mgr0dzicki/cargo-semver-action-ref-slice
|
repository: mgr0dzicki/cargo-semver-action-ref-slice
|
||||||
fetch-depth: 0
|
ref: patch_change
|
||||||
persist-credentials: true
|
persist-credentials: true
|
||||||
- name: Checkout the action
|
- name: Checkout the action
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
path: action
|
path: action
|
||||||
- name: Checkout the test with patch change and patch version bump
|
|
||||||
run: git checkout patch_change
|
|
||||||
- name: Run the action
|
- name: Run the action
|
||||||
uses: ./action/
|
uses: ./action/
|
||||||
- name: Checkout the test with major change and patch version bump
|
- name: Checkout the test with major change and patch version bump
|
||||||
run: git checkout major_change
|
run: |
|
||||||
|
git fetch origin major_change
|
||||||
|
git checkout major_change
|
||||||
- name: Run the action (allowed to fail)
|
- name: Run the action (allowed to fail)
|
||||||
id: action_major
|
id: action_major
|
||||||
uses: ./action/
|
uses: ./action/
|
||||||
|
|
58
.github/workflows/test-inputs.yml
vendored
58
.github/workflows/test-inputs.yml
vendored
|
@ -15,20 +15,18 @@ env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-package:
|
test-package-patch:
|
||||||
name: Test input package
|
name: Test input package (patch change)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout the action
|
- name: Checkout the action
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
path: action
|
path: action
|
||||||
- name: Setup the workspace
|
- name: Setup the workspace with ref_slice patch change
|
||||||
uses: ./action/.github/workflows/setup-test-workspace
|
uses: ./action/.github/workflows/setup-test-workspace
|
||||||
- name: Checkout the test with patch change and patch version bump
|
with:
|
||||||
run: |
|
ref-slice-ref: patch_change
|
||||||
cd ref_slice
|
|
||||||
git checkout patch_change
|
|
||||||
- name: Run the action on ref_slice patch change
|
- name: Run the action on ref_slice patch change
|
||||||
uses: ./action/
|
uses: ./action/
|
||||||
with:
|
with:
|
||||||
|
@ -42,10 +40,19 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
echo "Error! The action should have failed because of checking the dummy crate, but it has not!"
|
echo "Error! The action should have failed because of checking the dummy crate, but it has not!"
|
||||||
exit 1
|
exit 1
|
||||||
- name: Checkout the test with major change and patch version bump
|
|
||||||
run: |
|
test-package-major:
|
||||||
cd ref_slice
|
name: Test input package (major change)
|
||||||
git checkout major_change
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout the action
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
path: action
|
||||||
|
- name: Setup the workspace with ref_slice major change
|
||||||
|
uses: ./action/.github/workflows/setup-test-workspace
|
||||||
|
with:
|
||||||
|
ref-slice-ref: major_change
|
||||||
- name: Run the action on ref_slice major change (allowed to fail)
|
- name: Run the action on ref_slice major change (allowed to fail)
|
||||||
id: action_major
|
id: action_major
|
||||||
uses: ./action/
|
uses: ./action/
|
||||||
|
@ -79,20 +86,18 @@ jobs:
|
||||||
with:
|
with:
|
||||||
verbose: true
|
verbose: true
|
||||||
|
|
||||||
test-manifest-path:
|
test-manifest-path-patch:
|
||||||
name: Test input manifest-path
|
name: Test input manifest-path (patch change)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout the action
|
- name: Checkout the action
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
path: action
|
path: action
|
||||||
- name: Setup the workspace
|
- name: Setup the workspace with ref_slice patch change
|
||||||
uses: ./action/.github/workflows/setup-test-workspace
|
uses: ./action/.github/workflows/setup-test-workspace
|
||||||
- name: Checkout the test with patch change and patch version bump
|
with:
|
||||||
run: |
|
ref-slice-ref: patch_change
|
||||||
cd ref_slice
|
|
||||||
git checkout patch_change
|
|
||||||
- name: Run the action on ref_slice patch change (Cargo.toml path)
|
- name: Run the action on ref_slice patch change (Cargo.toml path)
|
||||||
uses: ./action/
|
uses: ./action/
|
||||||
with:
|
with:
|
||||||
|
@ -112,10 +117,19 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
echo "Error! The action should have failed because of checking the dummy crate, but it has not!"
|
echo "Error! The action should have failed because of checking the dummy crate, but it has not!"
|
||||||
exit 1
|
exit 1
|
||||||
- name: Checkout the test with major change and patch version bump
|
|
||||||
run: |
|
test-manifest-path-major:
|
||||||
cd ref_slice
|
name: Test input manifest-path (major change)
|
||||||
git checkout major_change
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout the action
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
path: action
|
||||||
|
- name: Setup the workspace with ref_slice major change
|
||||||
|
uses: ./action/.github/workflows/setup-test-workspace
|
||||||
|
with:
|
||||||
|
ref-slice-ref: major_change
|
||||||
- name: Run the action on ref_slice major change (Cargo.toml path, allowed to fail)
|
- name: Run the action on ref_slice major change (Cargo.toml path, allowed to fail)
|
||||||
id: action_major_cargo_toml
|
id: action_major_cargo_toml
|
||||||
uses: ./action/
|
uses: ./action/
|
||||||
|
|
Loading…
Reference in a new issue