asg-server/.github/workflows/docker-publish.yml
2024-11-25 19:14:48 +07:00

64 lines
1.5 KiB
YAML

name: docker-publish
on:
pull_request:
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
# step 1: checkout repository code
- name: Checkout code into workspace directory
uses: actions/checkout@v4
# step 2: set up go
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
# step 3: install dependencies
- name: Install all Go dependencies
run: go mod download
# step 4: run test
- name: Run coverage
run: go test -race -coverprofile=coverage.out -covermode=atomic ./...
e2e:
name: E2E
runs-on: ubuntu-latest
steps:
# step 1: checkout repository code
- name: Checkout code into workspace directory
uses: actions/checkout@v4
# step 2: set up go
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
# step 3: start services
- name: Start services
env:
"FCM__CREDENTIALS_JSON": ${{ secrets.FCM__CREDENTIALS_JSON }}
run: docker compose -f test/e2e/docker-compose.yml up -d --build
# step 4: run test
- name: Run e2e tests
run: cd test/e2e && go test .
build:
name: Build
needs:
- test
- e2e
uses: ./.github/workflows/docker-build.yml
with:
app-name: sms-gateway
secrets:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}