-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
70 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,52 @@ | ||
name: Go Application Tests | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- 'backend/aashub/**' | ||
push: | ||
branches: [main] | ||
paths: | ||
- 'backend/aashub/**' | ||
|
||
jobs: | ||
unit-tests: | ||
name: Run Unit Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.22' | ||
- name: Get dependencies | ||
working-directory: backend/aashub | ||
run: go mod download | ||
- name: Run unit tests | ||
run: go test ./... -v -tags=unit | ||
working-directory: backend/aashub | ||
|
||
integration-tests: | ||
name: Run Integration Tests | ||
needs: unit-tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
- name: Set up Docker Compose | ||
run: | | ||
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | ||
sudo chmod +x /usr/local/bin/docker-compose | ||
- name: Start all services with Docker Compose | ||
run: docker-compose -f ci/docker-compose.yml up -d | ||
- name: Wait for services to be ready | ||
run: | | ||
until [ "$(docker inspect --format='{{.State.Health.Status}}' app)" == "healthy" ]; do | ||
echo "Current health status: $(docker inspect --format='{{.State.Health.Status}}' app)" | ||
sleep 5 | ||
done | ||
- name: Run integration tests | ||
run: docker exec app /bin/sh -c "cd /workspace/backend/aashub && go test ./... -tags=integration" | ||
- name: Shutdown services | ||
run: docker-compose -f ci/docker-compose.yml down |
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
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