fix console errors #327
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: Run Tests and Publish Docker Image | |
on: | |
push: | |
branches: [ master, dev ] | |
pull_request: | |
branches: [ master, dev ] | |
types: [ opened, synchronize ] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
tests: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.6' | |
- name: Install backend dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
working-directory: ./lintuasema-backend | |
- name: Test backend with pytest | |
run: | | |
python3 -m pytest | |
working-directory: ./lintuasema-backend | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '12.x' | |
- name: Install frontend packages | |
run: npm install | |
working-directory: ./frontend | |
- name: Run frontend tests | |
run: npm test | |
working-directory: ./frontend | |
- name: Build & copy frontend to backend | |
run: npm run build-copy | |
working-directory: ./frontend | |
- name: Run backend | |
env: | |
AUTH_TOKEN: ${{ secrets.TEST_CONFIG_AUTH_TOKEN }} | |
TARGET: ${{ secrets.TEST_CONFIG_TARGET }} | |
run: flask run --port=3000 & | |
working-directory: ./lintuasema-backend | |
- name: Run Cypress tests | |
env: | |
cypress_person_token: ${{ secrets.CYPRESS_PERSON_TOKEN }} | |
run: | | |
sleep 10 | |
npm run cypress:cmd | |
working-directory: ./frontend | |
- name: Save Cypress screenshots if fails | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: frontend/cypress/screenshots/ | |
- name: Save Cypress videos if fails | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: cypress-videos | |
path: frontend/cypress/videos/ | |
build: | |
if: ${{ github.event_name == 'push' && contains(join(github.event.commits.*.message, ', '), '#skip') == false }} | |
needs: [tests] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Buildah Action | |
id: build_image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
image: ${{ env.IMAGE_NAME }} | |
tags: ${{ steps.meta.outputs.tags }} | |
oci: true | |
containerfiles: | | |
./Dockerfile | |
- name: Push To GHCR | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
tags: ${{ steps.build_image.outputs.tags }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} |