XML Support #9
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
name: Go with Docker | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22.0' | |
- name: Build Go project | |
run: go build -v ./... | |
- name: Run tests | |
run: go test -v ./... | |
# Docker steps | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build Docker image | |
run: | | |
docker build -t korcen-api . | |
- name: Run Docker container | |
run: | | |
docker run -d -p 7777:7777 korcen-api | |
- name: Test Docker container | |
run: | | |
# Add a simple test to ensure the service inside the container is running | |
curl --fail http://localhost:7777 || exit 1 | |
- name: Stop Docker container | |
run: | | |
docker ps -q --filter "ancestor=korcen-api" | xargs docker stop |