Skip to content

fix: tix typo

fix: tix typo #26

Workflow file for this run

name: CI/CD
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
SECRET_KEY: ${{ secrets.SECRET_KEY }}
ALGORITHM: ${{ secrets.ALGORITHM }}
ACCESS_TOKEN_EXPIRE_MINUTES: ${{ secrets.ACCESS_TOKEN_EXPIRE_MINUTES }}
ENVIRONMENT: ${{ secrets.ENVIRONMENT }}
INSTANCE_CONNECTION_NAME: ${{ secrets.INSTANCE_CONNECTION_NAME }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASS: ${{ secrets.DB_PASS }}
DB_NAME: ${{ secrets.DB_NAME }}
WORKDAY_CUT_OFF_TIME: ${{ secrets.WORKDAY_CUT_OFF_TIME }}
MINIMUM_WORKING_HOURS: ${{ secrets.MINIMUM_WORKING_HOURS }}
HOLIDAYS_API_URL: ${{ secrets.HOLIDAYS_API_URL }}
HOLIDAYS_API_KEY: ${{ secrets.HOLIDAYS_API_KEY }}
COUNTRY: ${{ secrets.COUNTRY }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
run: python -m pytest
deploy:
needs: test
runs-on: ubuntu-latest
permissions:
contents: "read"
id-token: "write"
env:
IMAGE_NAME: gcr.io/${{secrets.PROJECT_ID}}/attendance-system-backend
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{secrets.WORKLOAD_IDENTITY_PROVIDER_LOCATION}}
service_account: ${{secrets.SERVICE_ACCOUNT}}
- name: Configure Docker
run: gcloud auth configure-docker --quiet
- name: Build Docker image
run: docker build . -t $IMAGE_NAME --cache-from $IMAGE_NAME
- name: Push Docker image
run: docker push $IMAGE_NAME
- id: deploy
name: Deploy Docker image
uses: "google-github-actions/deploy-cloudrun@v2"
with:
image: ${{ env.IMAGE_NAME }}
region: asia-east1
service: attendance-system-backend
flags: --port=8000
- name: Test URL
run: curl "${{ steps.deploy.outputs.url }}"