-
-
Notifications
You must be signed in to change notification settings - Fork 821
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 #221 from cosmtrek/add_smoke_test
add smoke support for file change in macOS, windows, ubuntu
- Loading branch information
Showing
3 changed files
with
90 additions
and
27 deletions.
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
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,37 @@ | ||
name: Reusable smoke_test | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
run_on: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
smoke_test: | ||
name: smoke_test | ||
runs-on: ${{ inputs.run_on }} | ||
steps: | ||
- name: check out code | ||
uses: actions/checkout@v2 | ||
- name: setup Go 1.16 | ||
id: go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ^1.16 | ||
- name: install | ||
run: make install | ||
- name: check rebuild | ||
id: check_rebuild | ||
working-directory: ./smoke_test/check_rebuild | ||
run: | | ||
nohup air > nohup.out 2> nohup.err < /dev/null & | ||
sleep 15 | ||
echo "" >> main.go | ||
sleep 5 | ||
cat nohup.out | ||
grep "running" nohup.out | wc -l | if [ "$(cat -)" -eq "2" ]; then echo "::set-output name=value::PASS"; else echo "::set-output name=value::FAIL"; fi | ||
- uses: nick-invision/assert-action@v1 | ||
with: | ||
expected: "PASS" | ||
actual: ${{ steps.check_rebuild.outputs.value }} |
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,41 @@ | ||
name: Reusable smoke_test | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
run_on: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
smoke_test: | ||
name: smoke_test | ||
runs-on: ${{ inputs.run_on }} | ||
steps: | ||
- name: check out code | ||
uses: actions/checkout@v2 | ||
- name: setup Go 1.16 | ||
id: go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ^1.16 | ||
- name: install | ||
run: make install | ||
- name: check rebuild | ||
id: check_rebuild | ||
working-directory: ./smoke_test/check_rebuild | ||
run: | | ||
nohup air > nohup.out & | ||
sleep 15 | ||
echo "" >> main.go | ||
sleep 5 | ||
cat nohup.out | ||
If ($(grep "running" nohup.out | wc -l) –eq '2' ) { | ||
echo "::set-output name=value::PASS" | ||
} Else { | ||
echo "::set-output name=value::FAIL" | ||
} | ||
- uses: nick-invision/assert-action@v1 | ||
with: | ||
expected: "PASS" | ||
actual: ${{ steps.check_rebuild.outputs.value }} |