Skip to content

Commit

Permalink
Backend merge (#98)
Browse files Browse the repository at this point in the history
Co-authored-by: Tanya Golubev <[email protected]>
Co-authored-by: TanyaSpiden <[email protected]>
Co-authored-by: Tanya <[email protected]>
  • Loading branch information
4 people authored Oct 30, 2023
1 parent 5a738d2 commit 9c84b51
Show file tree
Hide file tree
Showing 57 changed files with 6,040 additions and 44 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/build-and-deploy-backend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Build Image and Deploy to Cloud Run
on:
push:
branches:
- backend
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

env:
REPOSITORY_REGION: europe-west10
PROJECT_ID: dockerruntest
REPO_NAME: quickstart-docker-repo
IMAGE_NAME: django-backend-shift-enter
PROJECT_USER: [email protected]

jobs:
docker-release:
name: Tagged Docker release to Google Artifact Registry
runs-on: ubuntu-latest
if: contains(github.event.head_commit.message, '-deploy')

steps:
- id: checkout
name: Checkout
uses: actions/checkout@v4

- name: Login to Artifact Registry
uses: docker/login-action@v1
with:
registry: ${{ env.REPOSITORY_REGION }}-docker.pkg.dev
username: _json_key
password: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_GUIL }}

- name: Get tag
id: get-tag
run: echo "{short_ref}={GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT

- name: Create .env
env:
ENV_FILE_BACKEND: ${{ secrets.ENV_FILE_BACKEND }}
run: echo $ENV_FILE_BACKEND | base64 --decode > ./src/backend/.env

- id: docker-push-tagged
name: Tag Docker image and push to Google Artifact Registry
uses: docker/[email protected]
with:
push: true
tags: |
${{ env.REPOSITORY_REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPO_NAME }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
context: ./src/backend

- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_GUIL }}'

- id: 'deploy'
name: Deploy to GC RUN
uses: 'google-github-actions/deploy-cloudrun@v1'
with:
service: ${{ env.IMAGE_NAME }}
image: ${{ env.REPOSITORY_REGION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPO_NAME }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
region: ${{ env.REPOSITORY_REGION }}

- name: 'Use output'
run: 'curl "${{ steps.deploy.outputs.url }}"'
37 changes: 37 additions & 0 deletions .github/workflows/req_lint_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: requirements_lint_test
on:
# Triggers the workflow on push to all the branches and on pull request to the "master" or the "dev" branch
push:
pull_request:
branches: [ "master", "dev", "backend", "pytest"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
test-n-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- name: Install dependencies
run: |
python -m pip install -r src/backend/requirements.txt
python -m pip install -r requirements_git_actions.txt
- name: apply_black
run:
black --verbose .

- uses: psf/black@stable
with:
options: "--check --verbose"
src: "."
jupyter: true
version: "~= 22.0"

- name: Test with pytest
run: |
pytest
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
.DS_Store
/.idea
.ngnix_def.conf
api/insert_embededs.py
docker-compose.yml
gunicorn/
notebooks/
skill_db_relax_20.json
static/
token_dist.json
backend/extrac_table.ipynb
backend/logs/
backend/qcls
backend/rest_framework/
backend/secrets/
backend/shift_3_womenpp/__pycache__
backend/api/__pycache__/
backend/api/imported_auth_models.py
backend/api/insert_embededs.py
backend/api/migrations/__pycache__/
*.bak
backend/api/old_models.py
backend/csvs_database/
backend/.venv/
backend/Presenation.zip
backend/admin/
backend/.env
.vscode
backend/django_extensions/
Loading

0 comments on commit 9c84b51

Please sign in to comment.