mirror of
https://github.com/makayabou/asg-server.git
synced 2026-05-02 17:43:36 +02:00
73 lines
1.7 KiB
YAML
73 lines
1.7 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
|
|
cache-dependency-path: test/e2e/go.sum
|
|
|
|
# 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 -count=1 .
|
|
|
|
# step 5: stop services
|
|
- name: Stop services
|
|
run: docker compose -f test/e2e/docker-compose.yml down -v
|
|
continue-on-error: true
|
|
|
|
build:
|
|
name: Build
|
|
permissions:
|
|
packages: write
|
|
needs:
|
|
- test
|
|
- e2e
|
|
if: github.actor != 'dependabot[bot]'
|
|
uses: ./.github/workflows/docker-build.yml
|
|
with:
|
|
app-name: sms-gateway
|
|
secrets:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|