CI improvements (#17)

This commit is contained in:
Mieszko Grodzicki 2023-02-27 20:35:32 +01:00 committed by Predrag Gruevski
parent 4a28a50dd4
commit 5618d5abb9
4 changed files with 56 additions and 28 deletions

9
.github/workflows/README.md vendored Normal file
View 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`.

View file

@ -1,4 +1,9 @@
name: Setup test workspace
inputs:
ref-slice-ref:
description: 'Reference of the ref_slice to checkout'
required: false
default: ''
runs:
using: 'composite'
steps:
@ -6,7 +11,7 @@ runs:
uses: actions/checkout@v3
with:
repository: mgr0dzicki/cargo-semver-action-ref-slice
fetch-depth: 0
ref: ${{ inputs.ref-slice-ref }}
persist-credentials: true
path: ref_slice
- name: Create dummy crate

View file

@ -23,22 +23,22 @@ jobs:
name: Run tests
runs-on: ${{ inputs.runs-on }}
steps:
- name: Checkout the test repository
- name: Checkout the test repository and test with patch change and patch version bump
uses: actions/checkout@v3
with:
repository: mgr0dzicki/cargo-semver-action-ref-slice
fetch-depth: 0
ref: patch_change
persist-credentials: true
- name: Checkout the action
uses: actions/checkout@v3
with:
path: action
- name: Checkout the test with patch change and patch version bump
run: git checkout patch_change
- name: Run the action
uses: ./action/
- 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)
id: action_major
uses: ./action/

View file

@ -15,20 +15,18 @@ env:
CARGO_TERM_COLOR: always
jobs:
test-package:
name: Test input package
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
- name: Setup the workspace with ref_slice patch change
uses: ./action/.github/workflows/setup-test-workspace
- name: Checkout the test with patch change and patch version bump
run: |
cd ref_slice
git checkout patch_change
with:
ref-slice-ref: patch_change
- name: Run the action on ref_slice patch change
uses: ./action/
with:
@ -42,10 +40,19 @@ jobs:
run: |
echo "Error! The action should have failed because of checking the dummy crate, but it has not!"
exit 1
- name: Checkout the test with major change and patch version bump
run: |
cd ref_slice
git checkout major_change
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/
@ -79,20 +86,18 @@ jobs:
with:
verbose: true
test-manifest-path:
name: Test input manifest-path
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
- name: Setup the workspace with ref_slice patch change
uses: ./action/.github/workflows/setup-test-workspace
- name: Checkout the test with patch change and patch version bump
run: |
cd ref_slice
git checkout patch_change
with:
ref-slice-ref: patch_change
- name: Run the action on ref_slice patch change (Cargo.toml path)
uses: ./action/
with:
@ -112,10 +117,19 @@ jobs:
run: |
echo "Error! The action should have failed because of checking the dummy crate, but it has not!"
exit 1
- name: Checkout the test with major change and patch version bump
run: |
cd ref_slice
git checkout major_change
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/