-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from robzr/add_actions
Add GitHub actions
- Loading branch information
Showing
5 changed files
with
903 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
cd "$(git rev-parse --show-toplevel)" | ||
tmp=$(mktemp) | ||
sed -n '1,/#action-sver-begin/p' action.yaml >"${tmp}" | ||
sed 's/^/ /' sver >>"${tmp}" | ||
sed -n '/#action-sver-end$/,$p' action.yaml >>"${tmp}" | ||
mv "$tmp" action.yaml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Test Action | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
name: Test Action | ||
runs-on: [ubuntu-latest] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
fetch-tags: true | ||
|
||
- run: | | ||
# test that action has current sver embedded | ||
.github/workflows/bin/embed_sver_in_action.sh | ||
if ! git diff --quiet action.yaml ; then | ||
echo '::error title=Action not updated::The action /action.yaml' \ | ||
'was not updated with the current sver script.' | ||
exit 1 | ||
fi | ||
shell: bash | ||
- id: sver-version | ||
name: sver version | ||
uses: ./ | ||
with: | ||
command: version | ||
|
||
- run: | | ||
# test sver-version | ||
if ! [[ '${{ steps.sver-version.outputs.output }}' =~ ^v[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]* ]] ; then | ||
echo '::error title=Action returned invalid response::The action' \ | ||
'/action.yaml returned an invalid response' \ | ||
'(${{ steps.sver-version.outputs.output }})' | ||
exit 1 | ||
fi | ||
- id: sver-max | ||
name: sver max | ||
uses: ./ | ||
with: | ||
command: max | ||
input-command: git tag -l | ||
|
||
- run: | | ||
# test sver-max | ||
if ! [[ '${{ steps.sver-max.outputs.output }}' =~ ^v[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]* ]] ; then | ||
echo '::error title=Action returned invalid response::The action' \ | ||
'/action.yaml returned an invalid response' \ | ||
'(${{ steps.sver-max.outputs.output }})' | ||
exit 1 | ||
fi | ||
- id: sver-equals-true | ||
name: sver equals (true) | ||
uses: ./ | ||
with: | ||
command: equals v1.2.3 v1.2.3+build-is-ignored | ||
|
||
- run: | | ||
# test sver-equals-true | ||
if [ '${{ steps.sver-equals-true.outputs.output }}' != 'true' ] ; then | ||
echo '::error title=Action returned invalid response::The action' \ | ||
'/action.yaml returned an invalid response' \ | ||
'(${{ steps.sver-equals-true.outputs.output }})' | ||
exit 1 | ||
fi | ||
- id: sver-equals-false | ||
name: sver equals (false) | ||
uses: ./ | ||
with: | ||
command: equals v1.2.3 v1.2.3-pre.is.not.ignored | ||
|
||
- run: | | ||
# test sver-equals-false | ||
if [ '${{ steps.sver-equals-false.outputs.output }}' != 'false' ] ; then | ||
echo '::error title=Action returned invalid response::The action' \ | ||
'/action.yaml returned an invalid response' \ | ||
'(${{ steps.sver-equals-false.outputs.output }})' | ||
exit 1 | ||
fi |
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
Oops, something went wrong.