2022-12-31 12:05:36 +01:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
|
|
|
env:
|
|
|
|
RUST_BACKTRACE: 1
|
|
|
|
CARGO_TERM_COLOR: always
|
|
|
|
|
|
|
|
jobs:
|
2022-12-31 13:03:06 +01:00
|
|
|
test-action:
|
|
|
|
name: Test the action
|
2022-12-31 12:05:36 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-01-01 13:41:20 +01:00
|
|
|
- name: Checkout the test repository
|
2022-12-31 12:05:36 +01:00
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
2022-12-31 12:17:24 +01:00
|
|
|
repository: mgr0dzicki/cargo-semver-action-ref-slice
|
2022-12-31 13:06:12 +01:00
|
|
|
fetch-depth: 0
|
2022-12-31 12:05:36 +01:00
|
|
|
persist-credentials: true
|
2023-01-01 13:41:20 +01:00
|
|
|
- name: Checkout the action
|
2022-12-31 12:20:57 +01:00
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
path: action
|
2023-01-03 02:38:11 +01:00
|
|
|
# Assumes that the latest published normal version of `ref_slice` smaller
|
|
|
|
# than 1.2.2 is 1.2.1.
|
2023-01-03 10:15:20 +01:00
|
|
|
# TODO: Change the crate version in the corresponding branch `patch_change`
|
|
|
|
# to 1.2.1 once new logic of choosing baseline is adapted. Otherwise
|
|
|
|
# if new version 1.2.2 of `ref_slice` is released, the tests might stop
|
|
|
|
# working correctly.
|
2023-01-01 13:41:20 +01:00
|
|
|
- name: Checkout the test with patch change and patch version bump
|
2022-12-31 13:03:06 +01:00
|
|
|
run: git checkout patch_change
|
2023-01-01 13:41:20 +01:00
|
|
|
- name: Run the action
|
2022-12-31 12:20:57 +01:00
|
|
|
uses: ./action/
|
2023-01-03 02:38:11 +01:00
|
|
|
# Assumes that the latest published normal version of `ref_slice` smaller
|
|
|
|
# than 1.2.2 exports a public function `ref_slice`.
|
2023-01-03 10:15:20 +01:00
|
|
|
# TODO: Change the crate version in the corresponding branch `major_change`
|
|
|
|
# to 1.2.1 once new logic of choosing baseline is adapted. Otherwise
|
|
|
|
# if new version 1.2.2 of `ref_slice` is released, the tests might stop
|
|
|
|
# working correctly.
|
2023-01-01 13:41:20 +01:00
|
|
|
- name: Checkout the test with major change and patch version bump
|
2022-12-31 13:03:06 +01:00
|
|
|
run: git checkout major_change
|
2023-01-01 13:41:20 +01:00
|
|
|
- name: Run the action (allowed to fail)
|
2022-12-31 13:03:48 +01:00
|
|
|
id: action_major
|
2022-12-31 12:20:57 +01:00
|
|
|
uses: ./action/
|
2022-12-31 12:05:36 +01:00
|
|
|
continue-on-error: true
|
2023-01-01 13:41:20 +01:00
|
|
|
- name: Check the action outcome
|
2023-01-01 13:17:05 +01:00
|
|
|
run: |
|
|
|
|
if [[ "${{ steps.action_major.outcome }}" != 'failure' ]]; then
|
|
|
|
echo "Error! The action should have failed because of the breaking change, but it has not."
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "OK! The action has failed as expected on the breaking change."
|
|
|
|
fi
|