Run tests (lib folder) #23
Workflow file for this run
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: Run tests (lib folder) | |
on: | |
push: | |
paths: | |
- 'lib/**' | |
workflow_dispatch: | |
workflow_call: | |
jobs: | |
test: | |
name: Test lib folder | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.21 | |
- name: Test Go config Module | |
run: | | |
cd lib/config | |
go test ./... | |
test_exit_code=$? # Capture the exit code of the go test command | |
if [ $test_exit_code -eq 0 ]; then | |
echo "Tests passed successfully." | |
else | |
echo "Tests failed with exit code $test_exit_code." | |
exit 1 # Fail the GitHub Actions workflow | |
fi | |
- name: Test Go router Module | |
run: | | |
cd lib/router | |
go test ./... | |
test_exit_code=$? # Capture the exit code of the go test command | |
if [ $test_exit_code -eq 0 ]; then | |
echo "Tests passed successfully." | |
else | |
echo "Tests failed with exit code $test_exit_code." | |
exit 1 # Fail the GitHub Actions workflow | |
fi | |
- name: Test Go rpc Module | |
run: | | |
cd lib/rpc | |
go test ./... | |
test_exit_code=$? # Capture the exit code of the go test command | |
if [ $test_exit_code -eq 0 ]; then | |
echo "Tests passed successfully." | |
else | |
echo "Tests failed with exit code $test_exit_code." | |
exit 1 # Fail the GitHub Actions workflow | |
fi |