-
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.
ci: try merging github actions for testing
- Loading branch information
Showing
4 changed files
with
102 additions
and
97 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,101 @@ | ||
name: Tests | ||
on: | ||
push: | ||
branches: | ||
- "*" | ||
|
||
jobs: | ||
Build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
- name: Setup Go | ||
uses: actions/[email protected] | ||
- name: Install dependencies | ||
run: go get . | ||
HTTP-Tests: | ||
runs-on: ubuntu-latest | ||
needs: Build | ||
services: | ||
db: | ||
image: postgres:16 | ||
env: | ||
POSTGRES_PASSWORD: "changeme" | ||
POSTGRES_USER: "godrink" | ||
POSTGRES_DB: "godrink" | ||
ports: | ||
- "5432:5432" | ||
volumes: | ||
- pgdata:/var/lib/postgresql/data | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
- name: Setup Go | ||
uses: actions/[email protected] | ||
- name: Run Go-Drink | ||
env: | ||
GODRINK_DB: postgresql://godrink:changeme@localhost:5432/godrink?sslmode=disable | ||
run: "go run . &" | ||
- name: Execute HTTP requests | ||
run: ./http-test/test.sh | ||
timeout-minutes: 3 | ||
- name: Upload Test results | ||
if: success() || failure() # always run even if the previous step fails | ||
uses: actions/[email protected] | ||
with: | ||
name: HTTP Test Report | ||
path: ./test-reports/report.xml | ||
Go-Tests: | ||
needs: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
- name: Setup Go | ||
uses: actions/[email protected] | ||
- name: Install dependencies | ||
run: go get . | ||
- name: Test with Go | ||
run: go test -json ./... > TestResults.json | ||
- name: Upload Go test results | ||
if: success() || failure() # always run even if the previous step fails | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Go Test Result | ||
path: TestResults.json | ||
- name: Convert GoTest JSON to JUnit XML | ||
uses: pl-strflt/gotest-json-to-junit-xml@v1 | ||
with: | ||
input: TestResults.json | ||
output: test-reports/TestResults-JUnit.xml | ||
- name: Upload Go test JUnit report | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Go Test Report | ||
path: test-reports/TestResults-JUnit.xml | ||
Report: | ||
needs: | ||
- Go-Tests | ||
- HTTP-Tests | ||
if: always() | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
actions: read | ||
checks: write | ||
steps: | ||
- name: Download Http-Test-Report | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: "*Test Report*" | ||
path: test-reports | ||
merge-multiple: true | ||
- name: Publish Test Report | ||
uses: mikepenz/action-junit-report@v4 | ||
with: | ||
detailed_summary: true | ||
include_passed: true | ||
require_passed_tests: true | ||
update_check: true | ||
report_paths: "test-reports/*.xml" |
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