use github runner again

This commit is contained in:
leehk 2025-04-12 21:34:45 +08:00
parent 08a45a9c76
commit 036a01f5ef

View File

@ -1,6 +1,6 @@
name: CI/CD - develop name: CI/CD - develop
on: on:
pull_request: pull_request:
branches: branches:
- develop - develop
@ -9,10 +9,9 @@ env:
IMAGE: ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')/aimingmed-ai-backend IMAGE: ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')/aimingmed-ai-backend
jobs: jobs:
build: build:
name: Build Docker Image name: Build Docker Image
runs-on: self-hosted runs-on: ubuntu-latest
permissions: permissions:
contents: read contents: read
packages: write packages: write
@ -41,7 +40,7 @@ jobs:
test: test:
name: Test Docker Image name: Test Docker Image
runs-on: self-hosted runs-on: ubuntu-latest
needs: build needs: build
steps: steps:
- name: Checkout - name: Checkout
@ -62,7 +61,7 @@ jobs:
--tag ${{ env.IMAGE }}:latest \ --tag ${{ env.IMAGE }}:latest \
--file ./app/backend/Dockerfile.prod \ --file ./app/backend/Dockerfile.prod \
"./app/backend" "./app/backend"
- name: Run container - name: Run container
run: | run: |
docker run \ docker run \
@ -74,7 +73,7 @@ jobs:
-e TESTING=0 \ -e TESTING=0 \
-p 8004:8765 \ -p 8004:8765 \
${{ env.IMAGE }}:latest ${{ env.IMAGE }}:latest
- name: Pytest - name: Pytest
run: docker exec backend pipenv run python -m pytest tests --disable-warnings run: docker exec backend pipenv run python -m pytest tests --disable-warnings
# - name: Flake8 # - name: Flake8
@ -85,4 +84,4 @@ jobs:
# run: docker exec backend pipenv run python -m isort . --check-only # run: docker exec backend pipenv run python -m isort . --check-only
- name: Cleanup container at end of job - name: Cleanup container at end of job
if: always() if: always()
run: docker stop backend || true && docker rm backend || true run: docker stop backend || true && docker rm backend || true