Skip to content

new domain and features #2

new domain and features

new domain and features #2

Workflow file for this run

name: game-service CI/CD
on:
push:
paths:
- "services/game-service/**"
- ".github/workflows/game-service.yml"
pull_request:
paths:
- "services/game-service/**"
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/gamehub-game-service
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: services/game-service
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- run: pip install ruff
- run: ruff check app/
test:
name: Test
runs-on: ubuntu-latest
defaults:
run:
working-directory: services/game-service
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- run: pip install -r requirements.txt
- run: pytest tests/ -v --tb=short
build-and-push:
name: Build & Push
runs-on: ubuntu-latest
needs: [lint, test]
if: github.ref == 'refs/heads/main'
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha,prefix=sha-
type=raw,value=latest,enable={{is_default_branch}}
- uses: docker/build-push-action@v5
with:
context: services/game-service
target: runtime
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max