cargo-semver-checks/.github/workflows/test-inputs.yml
Mieszko Grodzicki 43d6c89249
Remove TODOs from workflows. (#35)
* Remove TODOs from workflows.

* Remove TODO in test-cache.yml
2023-04-08 10:19:56 -04:00

188 lines
6.6 KiB
YAML

name: Test action inputs
# Assumes that the latest published normal version of `ref_slice` not greater
# than 1.2.1 is 1.2.1 itself.
on:
workflow_call:
env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
jobs:
test-package-patch:
name: Test input package (patch change)
runs-on: ubuntu-latest
steps:
- name: Checkout the action
uses: actions/checkout@v3
with:
path: action
- name: Setup the workspace with ref_slice patch change
uses: ./action/.github/workflows/setup-test-workspace
with:
ref-slice-ref: patch_change
- name: Run the action on ref_slice patch change
uses: ./action/
with:
package: ref_slice
- name: Run the action on the whole workspace (allowed to fail)
id: action_all
uses: ./action/
continue-on-error: true
- name: Fail if the action has not returned any errors (but it should have)
if: steps.action_all.outcome != 'failure'
run: |
echo "Error! The action should have failed because of checking the dummy crate, but it has not!"
exit 1
test-package-major:
name: Test input package (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)
id: action_major
uses: ./action/
with:
package: ref_slice
continue-on-error: true
- name: Fail if the action has not returned any errors (but it should have)
if: steps.action_major.outcome != 'failure'
run: |
echo "Error! The action should have failed because of the breaking change, but it has not."
exit 1
test-verbose:
# There is currently no way of asserting that the output is indeed verbose,
# so we at least check if the action runs without an error when the
# verbose option is enabled.
name: Test input verbose
runs-on: ubuntu-latest
steps:
- name: Checkout the test repository
uses: actions/checkout@v3
with:
repository: mgr0dzicki/cargo-semver-action-ref-slice
ref: patch_change
- name: Checkout the action
uses: actions/checkout@v3
with:
path: action
- name: Run the action on ref_slice patch change
uses: ./action/
with:
verbose: true
test-manifest-path-patch:
name: Test input manifest-path (patch change)
runs-on: ubuntu-latest
steps:
- name: Checkout the action
uses: actions/checkout@v3
with:
path: action
- name: Setup the workspace with ref_slice patch change
uses: ./action/.github/workflows/setup-test-workspace
with:
ref-slice-ref: patch_change
- name: Run the action on ref_slice patch change (Cargo.toml path)
uses: ./action/
with:
manifest-path: ref_slice/Cargo.toml
- name: Run the action on ref_slice patch change (crate path)
uses: ./action/
with:
manifest-path: ref_slice
- name: Run the action on the whole workspace (Cargo.toml path, allowed to fail)
id: action_all_cargo_toml
uses: ./action/
with:
manifest-path: ./Cargo.toml
continue-on-error: true
- name: Fail if the action has not returned any errors (but it should have)
if: steps.action_all_cargo_toml.outcome != 'failure'
run: |
echo "Error! The action should have failed because of checking the dummy crate, but it has not!"
exit 1
test-manifest-path-major:
name: Test input manifest-path (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)
id: action_major_cargo_toml
uses: ./action/
with:
manifest-path: ref_slice/Cargo.toml
continue-on-error: true
- name: Fail if the action has not returned any errors (but it should have)
if: steps.action_major_cargo_toml.outcome != 'failure'
run: |
echo "Error! The action should have failed because of the breaking change, but it has not."
exit 1
- name: Run the action on ref_slice major change (crate path, allowed to fail)
id: action_major_crate
uses: ./action/
with:
manifest-path: ref_slice
continue-on-error: true
- name: Fail if the action has not returned any errors (but it should have)
if: steps.action_major_crate.outcome != 'failure'
run: |
echo "Error! The action should have failed because of the breaking change, but it has not."
exit 1
test-manifest-path-with-space:
name: Test input manifest-path against path containing space
runs-on: ubuntu-latest
steps:
- name: Checkout the test repository and test with patch change and patch version bump
uses: actions/checkout@v3
with:
# Space inside the directory name is used in order to ensure it will
# be handled properly by the action.
path: 'ref slice'
repository: mgr0dzicki/cargo-semver-action-ref-slice
ref: patch_change
persist-credentials: true
- name: Checkout the action
uses: actions/checkout@v3
with:
path: action
- name: Run the action
uses: ./action/
with:
manifest-path: 'ref slice/Cargo.toml'
- name: Checkout the test with major change and patch version bump
run: |
cd "ref slice"
git fetch origin major_change
git checkout major_change
- name: Run the action (allowed to fail)
id: action_major
uses: ./action/
with:
manifest-path: 'ref slice/Cargo.toml'
continue-on-error: true
- name: Fail if the action has not returned any errors (but it should have)
if: steps.action_major.outcome != 'failure'
run: |
echo "Error! The action should have failed because of the breaking change, but it has not."
exit 1