adding test containers
Some checks failed
Check scripts syntax / check-scripts-syntax (push) Successful in 3s
Test automated-nfs-backup / test-automated-nfs-backup (push) Successful in 4s
Haven Notify Build and Deploy / Build Haven Notify Image (pull_request) Has been cancelled
Haven Notify Build and Deploy / Build Haven Notify Image (PR) (pull_request) Has been cancelled
Haven Notify Build and Deploy / Deploy Haven Notify (internal) (pull_request) Has been cancelled
Haven Notify Build and Deploy / Test Haven Notify (pull_request) Has been cancelled
Some checks failed
Check scripts syntax / check-scripts-syntax (push) Successful in 3s
Test automated-nfs-backup / test-automated-nfs-backup (push) Successful in 4s
Haven Notify Build and Deploy / Build Haven Notify Image (pull_request) Has been cancelled
Haven Notify Build and Deploy / Build Haven Notify Image (PR) (pull_request) Has been cancelled
Haven Notify Build and Deploy / Deploy Haven Notify (internal) (pull_request) Has been cancelled
Haven Notify Build and Deploy / Test Haven Notify (pull_request) Has been cancelled
This commit is contained in:
@@ -6,16 +6,74 @@ on:
|
||||
- main
|
||||
paths:
|
||||
- "haven-notify/**"
|
||||
- ".gitea/workflows/**"
|
||||
- ".gitea/workflows/haven-notify.yaml"
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "haven-notify/**"
|
||||
- ".gitea/workflows/haven-notify.yaml"
|
||||
workflow_dispatch: {}
|
||||
|
||||
env:
|
||||
IMAGE: git.ivanch.me/ivanch/haven-notify
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test Haven Notify
|
||||
runs-on: runner-full-amd64
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: haven-notify/go.mod
|
||||
cache-dependency-path: haven-notify/go.sum
|
||||
|
||||
- name: Verify formatting
|
||||
working-directory: haven-notify
|
||||
run: |
|
||||
unformatted="$(gofmt -l *.go)"
|
||||
if [ -n "$unformatted" ]; then
|
||||
echo "The following Go files need formatting:"
|
||||
echo "$unformatted"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Verify Docker access
|
||||
run: docker info
|
||||
|
||||
- name: Run static analysis
|
||||
working-directory: haven-notify
|
||||
run: go vet ./...
|
||||
|
||||
- name: Run race tests and collect coverage
|
||||
working-directory: haven-notify
|
||||
run: go test -race -shuffle=on -count=1 -covermode=atomic -coverprofile=coverage.out ./...
|
||||
|
||||
- name: Enforce coverage threshold
|
||||
working-directory: haven-notify
|
||||
run: |
|
||||
coverage="$(go tool cover -func=coverage.out | awk '/^total:/ {gsub("%", "", $3); print $3}')"
|
||||
echo "Statement coverage: ${coverage}%"
|
||||
awk -v coverage="$coverage" 'BEGIN { exit !(coverage + 0 >= 90) }'
|
||||
|
||||
- name: Run fuzz smoke test
|
||||
working-directory: haven-notify
|
||||
run: go test -run=^$ -fuzz=FuzzErrorNotificationHandler -fuzztime=10s .
|
||||
|
||||
- name: Run container end-to-end tests
|
||||
working-directory: haven-notify
|
||||
run: go test -tags=e2e -run '^TestContainerE2E$' -count=1 -timeout=5m -v .
|
||||
|
||||
build:
|
||||
name: Build Haven Notify Image
|
||||
runs-on: runner-slim
|
||||
needs: test
|
||||
if: ${{ gitea.event_name != 'pull_request' }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
@@ -28,6 +86,18 @@ jobs:
|
||||
ssh_key: ${{ secrets.SSH_KEY_DOCKERBUILD }}
|
||||
build_context: haven-notify
|
||||
|
||||
build-pr:
|
||||
name: Build Haven Notify Image (PR)
|
||||
runs-on: runner-full-amd64
|
||||
needs: test
|
||||
if: ${{ gitea.event_name == 'pull_request' }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build Docker image
|
||||
run: docker build --pull --tag haven-notify:pr-${{ gitea.sha }} haven-notify
|
||||
|
||||
deploy:
|
||||
name: Deploy Haven Notify (internal)
|
||||
runs-on: runner-slim
|
||||
|
||||
Reference in New Issue
Block a user