mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
for testing use only backend test workflow triggered by pushes on this branch
This commit is contained in:
parent
d468af8104
commit
b2632e3a88
5
.github/workflows/test-backend.yml
vendored
5
.github/workflows/test-backend.yml
vendored
@ -1,7 +1,10 @@
|
|||||||
name: ocelot.social backend test CI
|
name: ocelot.social backend test CI
|
||||||
|
|
||||||
|
|
||||||
on: [push]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- fix-runner
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
files-changed:
|
files-changed:
|
||||||
|
|||||||
202
.github/workflows/test-e2e.yml
vendored
202
.github/workflows/test-e2e.yml
vendored
@ -1,112 +1,112 @@
|
|||||||
name: ocelot.social end-to-end test CI
|
# name: ocelot.social end-to-end test CI
|
||||||
on: push
|
# on: push
|
||||||
|
|
||||||
jobs:
|
# jobs:
|
||||||
docker_preparation:
|
# docker_preparation:
|
||||||
name: Fullstack test preparation
|
# name: Fullstack test preparation
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
steps:
|
# steps:
|
||||||
- name: Checkout code
|
# - name: Checkout code
|
||||||
uses: actions/checkout@v3
|
# uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Copy env files
|
# - name: Copy env files
|
||||||
run: |
|
# run: |
|
||||||
cp webapp/.env.template webapp/.env
|
# cp webapp/.env.template webapp/.env
|
||||||
cp backend/.env.template backend/.env
|
# cp backend/.env.template backend/.env
|
||||||
|
|
||||||
- name: Build docker images
|
# - name: Build docker images
|
||||||
run: |
|
# run: |
|
||||||
mkdir /tmp/images
|
# mkdir /tmp/images
|
||||||
docker build --target community -t "ocelotsocialnetwork/neo4j-community:test" neo4j/
|
# docker build --target community -t "ocelotsocialnetwork/neo4j-community:test" neo4j/
|
||||||
docker save "ocelotsocialnetwork/neo4j-community:test" > /tmp/images/neo4j.tar
|
# docker save "ocelotsocialnetwork/neo4j-community:test" > /tmp/images/neo4j.tar
|
||||||
docker build --target test -t "ocelotsocialnetwork/backend:test" backend/
|
# docker build --target test -t "ocelotsocialnetwork/backend:test" backend/
|
||||||
docker save "ocelotsocialnetwork/backend:test" > /tmp/images/backend.tar
|
# docker save "ocelotsocialnetwork/backend:test" > /tmp/images/backend.tar
|
||||||
docker build --target test -t "ocelotsocialnetwork/webapp:test" webapp/
|
# docker build --target test -t "ocelotsocialnetwork/webapp:test" webapp/
|
||||||
docker save "ocelotsocialnetwork/webapp:test" > /tmp/images/webapp.tar
|
# docker save "ocelotsocialnetwork/webapp:test" > /tmp/images/webapp.tar
|
||||||
|
|
||||||
- name: Install cypress requirements
|
# - name: Install cypress requirements
|
||||||
run: |
|
# run: |
|
||||||
wget --no-verbose -O /opt/cucumber-json-formatter "https://github.com/cucumber/json-formatter/releases/download/v19.0.0/cucumber-json-formatter-linux-386"
|
# wget --no-verbose -O /opt/cucumber-json-formatter "https://github.com/cucumber/json-formatter/releases/download/v19.0.0/cucumber-json-formatter-linux-386"
|
||||||
cd backend
|
# cd backend
|
||||||
yarn install
|
# yarn install
|
||||||
yarn build
|
# yarn build
|
||||||
cd ..
|
# cd ..
|
||||||
yarn install
|
# yarn install
|
||||||
|
|
||||||
- name: Cache docker images
|
# - name: Cache docker images
|
||||||
id: cache
|
# id: cache
|
||||||
uses: actions/cache/save@v3.3.1
|
# uses: actions/cache/save@v3.3.1
|
||||||
with:
|
# with:
|
||||||
path: |
|
# path: |
|
||||||
/opt/cucumber-json-formatter
|
# /opt/cucumber-json-formatter
|
||||||
/home/runner/.cache/Cypress
|
# /home/runner/.cache/Cypress
|
||||||
/home/runner/work/Ocelot-Social/Ocelot-Social
|
# /home/runner/work/Ocelot-Social/Ocelot-Social
|
||||||
/tmp/images/
|
# /tmp/images/
|
||||||
key: ${{ github.run_id }}-e2e-preparation-cache
|
# key: ${{ github.run_id }}-e2e-preparation-cache
|
||||||
|
|
||||||
fullstack_tests:
|
# fullstack_tests:
|
||||||
name: Fullstack tests
|
# name: Fullstack tests
|
||||||
if: success()
|
# if: success()
|
||||||
needs: docker_preparation
|
# needs: docker_preparation
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
env:
|
# env:
|
||||||
jobs: 8
|
# jobs: 8
|
||||||
strategy:
|
# strategy:
|
||||||
matrix:
|
# matrix:
|
||||||
# run copies of the current job in parallel
|
# # run copies of the current job in parallel
|
||||||
job: [1, 2, 3, 4, 5, 6, 7, 8]
|
# job: [1, 2, 3, 4, 5, 6, 7, 8]
|
||||||
steps:
|
# steps:
|
||||||
- name: Restore cache
|
# - name: Restore cache
|
||||||
uses: actions/cache/restore@v3.3.1
|
# uses: actions/cache/restore@v3.3.1
|
||||||
id: cache
|
# id: cache
|
||||||
with:
|
# with:
|
||||||
path: |
|
# path: |
|
||||||
/opt/cucumber-json-formatter
|
# /opt/cucumber-json-formatter
|
||||||
/home/runner/.cache/Cypress
|
# /home/runner/.cache/Cypress
|
||||||
/home/runner/work/Ocelot-Social/Ocelot-Social
|
# /home/runner/work/Ocelot-Social/Ocelot-Social
|
||||||
/tmp/images/
|
# /tmp/images/
|
||||||
key: ${{ github.run_id }}e2e-preparation-cache
|
# key: ${{ github.run_id }}e2e-preparation-cache
|
||||||
fail-on-cache-miss: true
|
# fail-on-cache-miss: true
|
||||||
|
|
||||||
- name: Boot up test system | docker-compose
|
# - name: Boot up test system | docker-compose
|
||||||
run: |
|
# run: |
|
||||||
chmod +x /opt/cucumber-json-formatter
|
# chmod +x /opt/cucumber-json-formatter
|
||||||
sudo ln -fs /opt/cucumber-json-formatter /usr/bin/cucumber-json-formatter
|
# sudo ln -fs /opt/cucumber-json-formatter /usr/bin/cucumber-json-formatter
|
||||||
docker load < /tmp/images/neo4j.tar
|
# docker load < /tmp/images/neo4j.tar
|
||||||
docker load < /tmp/images/backend.tar
|
# docker load < /tmp/images/backend.tar
|
||||||
docker load < /tmp/images/webapp.tar
|
# docker load < /tmp/images/webapp.tar
|
||||||
docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps webapp neo4j backend
|
# docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps webapp neo4j backend
|
||||||
sleep 90s
|
# sleep 90s
|
||||||
|
|
||||||
- name: Full stack tests | run tests
|
# - name: Full stack tests | run tests
|
||||||
id: e2e-tests
|
# id: e2e-tests
|
||||||
run: yarn run cypress:run --spec $(cypress/parallel-features.sh ${{ matrix.job }} ${{ env.jobs }} )
|
# run: yarn run cypress:run --spec $(cypress/parallel-features.sh ${{ matrix.job }} ${{ env.jobs }} )
|
||||||
|
|
||||||
- name: Full stack tests | if tests failed, compile html report
|
# - name: Full stack tests | if tests failed, compile html report
|
||||||
if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }}
|
# if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }}
|
||||||
run: |
|
# run: |
|
||||||
cd cypress/
|
# cd cypress/
|
||||||
node create-cucumber-html-report.js
|
# node create-cucumber-html-report.js
|
||||||
|
|
||||||
- name: Full stack tests | if tests failed, upload report
|
# - name: Full stack tests | if tests failed, upload report
|
||||||
id: e2e-report
|
# id: e2e-report
|
||||||
if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }}
|
# if: ${{ failure() && steps.e2e-tests.conclusion == 'failure' }}
|
||||||
uses: actions/upload-artifact@v3
|
# uses: actions/upload-artifact@v3
|
||||||
with:
|
# with:
|
||||||
name: ocelot-e2e-test-report-pr${{ needs.docker_preparation.outputs.pr-number }}
|
# name: ocelot-e2e-test-report-pr${{ needs.docker_preparation.outputs.pr-number }}
|
||||||
path: /home/runner/work/Ocelot-Social/Ocelot-Social/cypress/reports/cucumber_html_report
|
# path: /home/runner/work/Ocelot-Social/Ocelot-Social/cypress/reports/cucumber_html_report
|
||||||
|
|
||||||
cleanup:
|
# cleanup:
|
||||||
name: Cleanup
|
# name: Cleanup
|
||||||
if: success()
|
# if: success()
|
||||||
needs: [docker_preparation, fullstack_tests]
|
# needs: [docker_preparation, fullstack_tests]
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
continue-on-error: true
|
# continue-on-error: true
|
||||||
steps:
|
# steps:
|
||||||
- name: Delete cache
|
# - name: Delete cache
|
||||||
env:
|
# env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
# run: |
|
||||||
gh extension install actions/gh-actions-cache
|
# gh extension install actions/gh-actions-cache
|
||||||
KEY="${{ github.run_id }}-e2e-preparation-cache"
|
# KEY="${{ github.run_id }}-e2e-preparation-cache"
|
||||||
gh actions-cache delete $KEY -R Ocelot-Social-Community/Ocelot-Social --confirm
|
# gh actions-cache delete $KEY -R Ocelot-Social-Community/Ocelot-Social --confirm
|
||||||
192
.github/workflows/test-webapp.yml
vendored
192
.github/workflows/test-webapp.yml
vendored
@ -1,115 +1,115 @@
|
|||||||
name: ocelot.social webapp test CI
|
# name: ocelot.social webapp test CI
|
||||||
|
|
||||||
|
|
||||||
on: [push]
|
# on: [push]
|
||||||
|
|
||||||
jobs:
|
# jobs:
|
||||||
files-changed:
|
# files-changed:
|
||||||
name: Detect File Changes - Webapp
|
# name: Detect File Changes - Webapp
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
outputs:
|
# outputs:
|
||||||
docker: ${{ steps.changes.outputs.docker }}
|
# docker: ${{ steps.changes.outputs.docker }}
|
||||||
webapp: ${{ steps.changes.outputs.webapp }}
|
# webapp: ${{ steps.changes.outputs.webapp }}
|
||||||
steps:
|
# steps:
|
||||||
- uses: actions/checkout@v3.3.0
|
# - uses: actions/checkout@v3.3.0
|
||||||
|
|
||||||
- name: Check for frontend file changes
|
# - name: Check for frontend file changes
|
||||||
uses: dorny/paths-filter@v2.11.1
|
# uses: dorny/paths-filter@v2.11.1
|
||||||
id: changes
|
# id: changes
|
||||||
with:
|
# with:
|
||||||
token: ${{ github.token }}
|
# token: ${{ github.token }}
|
||||||
filters: .github/file-filters.yml
|
# filters: .github/file-filters.yml
|
||||||
list-files: shell
|
# list-files: shell
|
||||||
|
|
||||||
prepare:
|
# prepare:
|
||||||
name: Prepare
|
# name: Prepare
|
||||||
if: needs.files-changed.outputs.webapp == 'true'
|
# if: needs.files-changed.outputs.webapp == 'true'
|
||||||
needs: files-changed
|
# needs: files-changed
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
steps:
|
# steps:
|
||||||
- name: Checkout code
|
# - name: Checkout code
|
||||||
uses: actions/checkout@v3
|
# uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Check translation files
|
# - name: Check translation files
|
||||||
run: |
|
# run: |
|
||||||
scripts/translations/sort.sh
|
# scripts/translations/sort.sh
|
||||||
scripts/translations/missing-keys.sh
|
# scripts/translations/missing-keys.sh
|
||||||
|
|
||||||
build_test_webapp:
|
# build_test_webapp:
|
||||||
name: Docker Build Test - Webapp
|
# name: Docker Build Test - Webapp
|
||||||
if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.webapp == 'true'
|
# if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.webapp == 'true'
|
||||||
needs: [files-changed, prepare]
|
# needs: [files-changed, prepare]
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
steps:
|
# steps:
|
||||||
- name: Checkout code
|
# - name: Checkout code
|
||||||
uses: actions/checkout@v3
|
# uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Webapp | Build 'test' image
|
# - name: Webapp | Build 'test' image
|
||||||
run: |
|
# run: |
|
||||||
docker build --target test -t "ocelotsocialnetwork/webapp:test" webapp/
|
# docker build --target test -t "ocelotsocialnetwork/webapp:test" webapp/
|
||||||
docker save "ocelotsocialnetwork/webapp:test" > /tmp/webapp.tar
|
# docker save "ocelotsocialnetwork/webapp:test" > /tmp/webapp.tar
|
||||||
|
|
||||||
- name: Cache docker image
|
# - name: Cache docker image
|
||||||
uses: actions/cache/save@v3.3.1
|
# uses: actions/cache/save@v3.3.1
|
||||||
with:
|
# with:
|
||||||
path: /tmp/webapp.tar
|
# path: /tmp/webapp.tar
|
||||||
key: ${{ github.run_id }}-webapp-cache
|
# key: ${{ github.run_id }}-webapp-cache
|
||||||
|
|
||||||
lint_webapp:
|
# lint_webapp:
|
||||||
name: Lint Webapp
|
# name: Lint Webapp
|
||||||
if: needs.files-changed.outputs.webapp == 'true'
|
# if: needs.files-changed.outputs.webapp == 'true'
|
||||||
needs: files-changed
|
# needs: files-changed
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
steps:
|
# steps:
|
||||||
- name: Checkout code
|
# - name: Checkout code
|
||||||
uses: actions/checkout@v3
|
# uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: webapp | Lint
|
# - name: webapp | Lint
|
||||||
run: cd webapp && yarn && yarn run lint
|
# run: cd webapp && yarn && yarn run lint
|
||||||
|
|
||||||
unit_test_webapp:
|
# unit_test_webapp:
|
||||||
name: Unit Tests - Webapp
|
# name: Unit Tests - Webapp
|
||||||
if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.webapp == 'true'
|
# if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.webapp == 'true'
|
||||||
needs: [files-changed, build_test_webapp]
|
# needs: [files-changed, build_test_webapp]
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
permissions:
|
# permissions:
|
||||||
checks: write
|
# checks: write
|
||||||
steps:
|
# steps:
|
||||||
- name: Checkout code
|
# - name: Checkout code
|
||||||
uses: actions/checkout@v3
|
# uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Restore webapp cache
|
# - name: Restore webapp cache
|
||||||
uses: actions/cache/restore@v3.3.1
|
# uses: actions/cache/restore@v3.3.1
|
||||||
with:
|
# with:
|
||||||
path: /tmp/webapp.tar
|
# path: /tmp/webapp.tar
|
||||||
key: ${{ github.run_id }}-webapp-cache
|
# key: ${{ github.run_id }}-webapp-cache
|
||||||
|
|
||||||
- name: Load Docker Image
|
# - name: Load Docker Image
|
||||||
run: docker load < /tmp/webapp.tar
|
# run: docker load < /tmp/webapp.tar
|
||||||
|
|
||||||
- name: Copy env files
|
# - name: Copy env files
|
||||||
run: |
|
# run: |
|
||||||
cp webapp/.env.template webapp/.env
|
# cp webapp/.env.template webapp/.env
|
||||||
cp backend/.env.template backend/.env
|
# cp backend/.env.template backend/.env
|
||||||
|
|
||||||
- name: backend | docker-compose
|
# - name: backend | docker-compose
|
||||||
run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps webapp
|
# run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps webapp
|
||||||
|
|
||||||
- name: webapp | Unit tests incl. coverage check
|
# - name: webapp | Unit tests incl. coverage check
|
||||||
run: docker-compose exec -T webapp yarn test
|
# run: docker-compose exec -T webapp yarn test
|
||||||
|
|
||||||
cleanup:
|
# cleanup:
|
||||||
name: Cleanup
|
# name: Cleanup
|
||||||
if: (needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.webapp == 'true') || success()
|
# if: (needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.webapp == 'true') || success()
|
||||||
needs: [files-changed, unit_test_webapp]
|
# needs: [files-changed, unit_test_webapp]
|
||||||
runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
continue-on-error: true
|
# continue-on-error: true
|
||||||
steps:
|
# steps:
|
||||||
- name: Delete cache
|
# - name: Delete cache
|
||||||
env:
|
# env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
# run: |
|
||||||
gh extension install actions/gh-actions-cache
|
# gh extension install actions/gh-actions-cache
|
||||||
KEY="${{ github.run_id }}-webapp-cache"
|
# KEY="${{ github.run_id }}-webapp-cache"
|
||||||
gh actions-cache delete $KEY -R Ocelot-Social-Community/Ocelot-Social --confirm
|
# gh actions-cache delete $KEY -R Ocelot-Social-Community/Ocelot-Social --confirm
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user