Skip to content

Commit

Permalink
ci: build image and test
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobLinCool committed Feb 13, 2024
1 parent 26b90ff commit 2305814
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Image
on:
push:
branches:
- main

jobs:
image:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
packages: write
steps:
- uses: actions/checkout@v4

- name: Login to ghcr
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/jacoblincool/ad-service-dcard-2024:latest
36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Test
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.21.7"
- run: go test -v
- run: go build .

stress-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build service
run: |
cd deployment/docker-compose
cp .env.example .env
docker compose up -d --build
cd ../../
- name: Run k6 test
uses: grafana/k6-action@v0.3.1
with:
filename: scripts/stress.js
flags: --vus 100 --duration 10s

0 comments on commit 2305814

Please sign in to comment.