update ci workflow #21
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: Monolith App CI/CD | ||
on: | ||
pull_request: | ||
branches: [ main ] | ||
paths: | ||
- 'backAgent/**' | ||
- 'BackSimulation/**' | ||
- 'front/**' | ||
- 'Dockerfile' | ||
- 'docker_launcher.sh' | ||
- 'docker_nginx.conf' | ||
- 'app_deploy_test.yml' | ||
jobs: | ||
build-and-dockerize: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
- name: Build and Push Docker Image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
tags: siliataider/citymanager-app:latest | ||
context: . | ||
file: ./Dockerfile | ||
test-back-python: | ||
runs-on: ubuntu-latest | ||
needs: build-and-dockerize | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.10.12' | ||
- name: Install Python dependencies | ||
run: | | ||
cd backAgent | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Run tests | ||
run: | | ||
cd backAgent | ||
python -m pytest | ||
test-back-java: | ||
runs-on: ubuntu-latest | ||
needs: build-and-dockerize | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
- name: Test with Maven | ||
run: cd BackSimulation && mvn test | ||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: test-back-python, test-back-java | ||
Check failure on line 79 in .github/workflows/app_deploy_test.yml GitHub Actions / Monolith App CI/CDInvalid workflow file
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Deploy to Render | ||
run: > | ||
curl -X POST -H 'Authorization: Bearer ${{ secrets.RENDER_API_KEY }}' -d '' | ||
https://api.render.com/deploy/srv-cmkfojta73kc73bmc4a0?key=8aIKnO5Qv_w | ||
test-deployment: | ||
runs-on: ubuntu-latest | ||
needs: build-and-deploy | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.10.12' | ||
- name: Install Python dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install requests | ||
- name: Check Deployment Status on Render | ||
run: python backAgent/tests/check_deployment_status.py | ||
env: | ||
RENDER_API_KEY: ${{ secrets.RENDER_API_KEY }} | ||
SERVICE_ID: 'srv-cmikfaq1hbls738fek40' |