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:
|
2022-12-31 13:03:06 +01:00
|
|
|
- name: Checkout 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
|
2022-12-31 12:20:57 +01:00
|
|
|
- name: Checkout action
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
path: action
|
2022-12-31 13:03:06 +01:00
|
|
|
# test without semver violation
|
|
|
|
- name: Checkout branch patch_change
|
|
|
|
run: git checkout patch_change
|
2022-12-31 12:05:36 +01:00
|
|
|
- name: Run action
|
2022-12-31 12:20:57 +01:00
|
|
|
uses: ./action/
|
2022-12-31 13:03:06 +01:00
|
|
|
# test with semver violation
|
|
|
|
- name: Checkout branch major_change
|
|
|
|
run: git checkout major_change
|
2022-12-31 12:05:36 +01:00
|
|
|
- name: Run action
|
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:17:05 +01:00
|
|
|
- name: Check action outcome
|
|
|
|
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
|