Merge pull request #53 from WyriHaximus/stricten-working-directory-tests #135
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous Integration | |
on: | |
push: | |
branches: | |
- 'master' | |
pull_request: | |
jobs: | |
get-previous-tag-with-working-directory: | |
name: Test Get Previous Tag on ${{ matrix.os }} with Working Directory | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- windows-latest | |
- macos-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags | |
- uses: actions/checkout@v4 | |
with: | |
repository: WyriHaximus/php-fake-php-version | |
ref: master | |
path: tmp/some/other/path | |
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags | |
- name: 'Get Previous tag' | |
id: previoustag | |
uses: ./ | |
with: | |
workingDirectory: tmp/some/other/path | |
- run: | | |
echo "Tag: ${{ steps.previoustag.outputs.tag }}" | |
echo "Timestamp: ${{ steps.previoustag.outputs.timestamp }}" | |
test -n "${{ steps.previoustag.outputs.tag }}" | |
test -n "${{ steps.previoustag.outputs.timestamp }}" | |
- name: Assert we got the tag | |
uses: therussiankid92/gat@v1 | |
with: | |
assertion: should.equal | |
expected: 1.8.38 | |
actual: ${{ steps.previoustag.outputs.tag }} | |
get-previous-tag: | |
name: Test Get Previous Tag on ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- windows-latest | |
- macos-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags | |
- name: 'Get Previous tag' | |
id: previoustag | |
uses: ./ | |
- run: | | |
echo "Tag: ${{ steps.previoustag.outputs.tag }}" | |
echo "Timestamp: ${{ steps.previoustag.outputs.timestamp }}" | |
test -n "${{ steps.previoustag.outputs.tag }}" | |
test -n "${{ steps.previoustag.outputs.timestamp }}" | |
- name: Assert we got the tag | |
uses: therussiankid92/gat@v1 | |
with: | |
assertion: should.equal | |
expected: v1 | |
actual: ${{ steps.previoustag.outputs.tag }} | |
- name: Add tag with prefix | |
run: | | |
git tag tag-with-prefix-v1.0.0 | |
- name: 'Get Previous tag with prefix' | |
id: previoustagwithprefix | |
uses: ./ | |
with: | |
prefix: tag-with-prefix-v | |
- run: | | |
echo "Tag: ${{ steps.previoustagwithprefix.outputs.tag }}" | |
echo "Timestamp: ${{ steps.previoustagwithprefix.outputs.timestamp }}" | |
test -n "${{ steps.previoustagwithprefix.outputs.tag }}" | |
test -n "${{ steps.previoustagwithprefix.outputs.timestamp }}" | |
- name: Remove tags | |
run: | | |
rm -r .git/refs/tags | |
- name: Assert we got the tag with the expected prefix | |
uses: therussiankid92/gat@v1 | |
with: | |
assertion: should.equal | |
expected: tag-with-prefix-v1.0.0 | |
actual: ${{ steps.previoustagwithprefix.outputs.tag }} | |
- name: 'Get Previous tag with fallback' | |
id: previoustagwithfallback | |
uses: ./ | |
with: | |
fallback: v1.0.0 | |
- run: | | |
echo "Tag: ${{ steps.previoustagwithfallback.outputs.tag }}" | |
echo "Timestamp: ${{ steps.previoustagwithfallback.outputs.timestamp }}" | |
test -n "${{ steps.previoustagwithfallback.outputs.tag }}" | |
test -n "${{ steps.previoustagwithfallback.outputs.timestamp }}" | |
- name: Assert we got the fallback | |
uses: therussiankid92/gat@v1 | |
with: | |
assertion: should.equal | |
expected: v1.0.0 | |
actual: ${{ steps.previoustagwithfallback.outputs.tag }} |