Skip to content

adapting to https://github.com/manulera/ShareYourCloning_backend/pull… #619

adapting to https://github.com/manulera/ShareYourCloning_backend/pull…

adapting to https://github.com/manulera/ShareYourCloning_backend/pull… #619

Workflow file for this run

name: CI / CD
on: [push, pull_request]
jobs:
cypress-run:
name: Run Cypress tests
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Install Python
uses: actions/setup-python@v1
with:
python-version: 3.11
- name: Install poetry
run: |
python -m pip install --upgrade pip
pip install poetry
# - name: Load cached venv
# id: cached-poetry-dependencies
# uses: actions/cache@v2
# with:
# path: .venv
# key: venv-${{ runner.os }}-${{ hashFiles('ShareYourCloning_backend/poetry.lock') }}
- name: Install python dependencies
# if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
cd ShareYourCloning_backend
poetry install --no-dev
- name: run python dev server in background
env:
NCBI_API_KEY: ${{ secrets.NCBI_API_KEY }}
run: |
cd ShareYourCloning_backend
poetry run shareyourcloning.uvicorn main:app &
- name: enable yarn 3
run: corepack enable
# Install npm dependencies, cache them correctly
# and run all Cypress tests
- name: Cypress run E2E tests
uses: cypress-io/github-action@v6
env:
VITE_COVERAGE: "true"
VITE_LOG_LEVEL: "warn"
with:
start: yarn start
- name: Cypress run component tests
uses: cypress-io/github-action@v6
env:
VITE_COVERAGE: "true"
VITE_LOG_LEVEL: "warn"
with:
component: true
- name: Upload screenshots
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
- name: Upload coverage
uses: actions/upload-artifact@v3
with:
name: cypress-coverage
path: coverage
- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage/coverage-final.json
# Update docker image when committing to master branch if tests pass
push_to_registry:
name: Push Docker image to Docker Hub
# Only run if tests pass
needs: cypress-run
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: manulera/shareyourcloningfrontend
- name: Build and push Docker image
uses: docker/build-push-action@v6.9.0
with:
context: .
push: true
tags: manulera/shareyourcloningfrontend:latest
labels: ${{ steps.meta.outputs.labels }}
build-args: |
COMMIT_SHA=${{ github.sha }}
- name: Build and push Docker image
uses: docker/build-push-action@v6.9.0
with:
context: .
push: true
tags: manulera/shareyourcloningfrontend:latest-syc-base
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BASE_URL=/shareyourcloning/
COMMIT_SHA=${{ github.sha }}