Skip to content

Update test.yml

Update test.yml #34

Workflow file for this run

on: [push, workflow_dispatch]
jobs:
test:
runs-on: ubuntu-latest
name: Test
steps:
# To use this repository's private action,
# you must check out the repository
- name: Checkout
uses: actions/[email protected]
# basic simple test: just print current this package's version
- name: Test functionality
uses: ./ # Uses an action in the root directory
id: test
with:
file: 'testdata/testproj/testproj.csproj'
- name: Print results
run: echo ${{ steps.test.outputs.version }}
# simple test on fixed test data
- name: Test on simple format
uses: ./
id: simple
with:
file: testdata/simple/simple.csproj
- name: Print results
run: echo ${{ steps.simple.outputs.version }}
- name: Verify results
run: |
if [ "${{ steps.simple.outputs.version }}" == "1.2.3" ]; then
echo "Version matches"
else
echo "Version mismatch"
exit -1
fi
# simple test with custom regex on fixed test data
- name: Test on simple format with custom regex
uses: ./
id: custom
with:
file: testdata/simple/simple.csproj
regex: '^(?<major>[0-9]+)\.(?<minor>[0-9]+)\.(?<patch>[0-9]+)$'
xpath: '//PropertyGroup/Version'
- name: Print results
run: echo ${{ steps.custom.outputs.version }}
- name: Verify results
run: |
if [ "${{ steps.custom.outputs.version }}" == "1.2.3" ]; then
echo "Version matches"
else
echo "Version mismatch"
exit -1
fi
# prerelease test on fixed test data
- name: Test on prerelease format
uses: ./
id: prerelease
with:
file: testdata/prerelease/prerelease.csproj
- name: Print results
run: echo ${{ steps.prerelease.outputs.version }}
- name: Verify results
run: |
if [ "${{ steps.prerelease.outputs.version }}" == "1.2.3-beta.5" ]; then
echo "Version matches"
else
echo "Version mismatch"
exit -1
fi
# buildmeta test on fixed test data
- name: Test on buildmetadata format
uses: ./
id: buildmeta
with:
file: testdata/buildmeta/buildmeta.csproj
- name: Print results
run: echo ${{ steps.buildmeta.outputs.version }}
- name: Verify results
run: |
if [ "${{ steps.buildmeta.outputs.version }}" == "1.2.3+foobar.42" ]; then
echo "Version matches"
else
echo "Version mismatch"
exit -1
fi
# complex test on fixed test data
- name: Test on complex format
uses: ./
id: complex
with:
file: testdata/complex/complex.csproj
- name: Print results
run: echo ${{ steps.complex.outputs.version }}
- name: Verify results
run: |
if [ "${{ steps.complex.outputs.version }}" == "1.2.3-beta.5+foobar.42" ]; then
echo "Version matches"
else
echo "Version mismatch"
exit -1
fi