mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-12 23:35:50 +00:00
Merge pull request #2962 from gradido/2960-devops-workflow-tests-run-when-database-is-changed-on-database-dependend-modules
refactor(other): finalize workflow separation and resolve mariadb and database dependencies in workflow files
This commit is contained in:
commit
5670c74824
6
.github/file-filters.yml
vendored
6
.github/file-filters.yml
vendored
@ -30,6 +30,9 @@
|
||||
admin: &admin
|
||||
- 'admin/**/*'
|
||||
|
||||
backend: &backend
|
||||
- 'backend/**/*'
|
||||
|
||||
dht_node: &dht_node
|
||||
- 'dht-node/**/*'
|
||||
|
||||
@ -42,5 +45,8 @@ federation: &federation
|
||||
frontend: &frontend
|
||||
- 'frontend/**/*'
|
||||
|
||||
mariadb: &mariadb
|
||||
- 'mariadb/**/*'
|
||||
|
||||
nginx: &nginx
|
||||
- 'nginx/**/*'
|
||||
195
.github/workflows/test.yml
vendored
195
.github/workflows/test.yml
vendored
@ -1,195 +0,0 @@
|
||||
name: gradido test CI
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
##############################################################################
|
||||
# JOB: DOCKER BUILD TEST BACKEND #############################################
|
||||
##############################################################################
|
||||
build_test_backend:
|
||||
name: Docker Build Test - Backend
|
||||
runs-on: ubuntu-latest
|
||||
#needs: [nothing]
|
||||
steps:
|
||||
##########################################################################
|
||||
# CHECKOUT CODE ##########################################################
|
||||
##########################################################################
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
##########################################################################
|
||||
# BACKEND ################################################################
|
||||
##########################################################################
|
||||
- name: Backend | Build `test` image
|
||||
run: |
|
||||
docker build -f ./backend/Dockerfile --target test -t "gradido/backend:test" .
|
||||
docker save "gradido/backend:test" > /tmp/backend.tar
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: docker-backend-test
|
||||
path: /tmp/backend.tar
|
||||
|
||||
##############################################################################
|
||||
# JOB: DOCKER BUILD TEST DATABASE UP #########################################
|
||||
##############################################################################
|
||||
build_test_database_up:
|
||||
name: Docker Build Test - Database up
|
||||
runs-on: ubuntu-latest
|
||||
#needs: [nothing]
|
||||
steps:
|
||||
##########################################################################
|
||||
# CHECKOUT CODE ##########################################################
|
||||
##########################################################################
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
##########################################################################
|
||||
# DATABASE UP ############################################################
|
||||
##########################################################################
|
||||
- name: Database | Build `test_up` image
|
||||
run: |
|
||||
docker build --target test_up -t "gradido/database:test_up" database/
|
||||
docker save "gradido/database:test_up" > /tmp/database_up.tar
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: docker-database-test_up
|
||||
path: /tmp/database_up.tar
|
||||
|
||||
##############################################################################
|
||||
# JOB: DOCKER BUILD TEST MARIADB #############################################
|
||||
##############################################################################
|
||||
build_test_mariadb:
|
||||
name: Docker Build Test - MariaDB
|
||||
runs-on: ubuntu-latest
|
||||
#needs: [nothing]
|
||||
steps:
|
||||
##########################################################################
|
||||
# CHECKOUT CODE ##########################################################
|
||||
##########################################################################
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
##########################################################################
|
||||
# BUILD MARIADB DOCKER IMAGE #############################################
|
||||
##########################################################################
|
||||
- name: mariadb | Build `test` image
|
||||
run: |
|
||||
docker build --target mariadb_server -t "gradido/mariadb:test" -f ./mariadb/Dockerfile ./
|
||||
docker save "gradido/mariadb:test" > /tmp/mariadb.tar
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: docker-mariadb-test
|
||||
path: /tmp/mariadb.tar
|
||||
|
||||
##############################################################################
|
||||
# JOB: LINT BACKEND ##########################################################
|
||||
##############################################################################
|
||||
lint_backend:
|
||||
name: Lint - Backend
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
##########################################################################
|
||||
# CHECKOUT CODE ##########################################################
|
||||
##########################################################################
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
##########################################################################
|
||||
# LINT BACKEND ###########################################################
|
||||
##########################################################################
|
||||
- name: backend | Lint
|
||||
run: cd database && yarn && cd ../backend && yarn && yarn run lint
|
||||
|
||||
##############################################################################
|
||||
# JOB: LOCALES BACKEND #######################################################
|
||||
##############################################################################
|
||||
locales_backend:
|
||||
name: Locales - Backend
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
##########################################################################
|
||||
# CHECKOUT CODE ##########################################################
|
||||
##########################################################################
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
##########################################################################
|
||||
# LOCALES BACKEND #####################################################
|
||||
##########################################################################
|
||||
- name: Backend | Locales
|
||||
run: cd backend && yarn && yarn locales
|
||||
|
||||
##############################################################################
|
||||
# JOB: LINT DATABASE UP ######################################################
|
||||
##############################################################################
|
||||
lint_database_up:
|
||||
name: Lint - Database Up
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
##########################################################################
|
||||
# CHECKOUT CODE ##########################################################
|
||||
##########################################################################
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
##########################################################################
|
||||
# LINT DATABASE ##########################################################
|
||||
##########################################################################
|
||||
- name: Database | Lint
|
||||
run: cd database && yarn && yarn run lint
|
||||
|
||||
##############################################################################
|
||||
# JOB: UNIT TEST BACKEND ####################################################
|
||||
##############################################################################
|
||||
unit_test_backend:
|
||||
name: Unit tests - Backend
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build_test_mariadb]
|
||||
steps:
|
||||
##########################################################################
|
||||
# CHECKOUT CODE ##########################################################
|
||||
##########################################################################
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
##########################################################################
|
||||
# DOWNLOAD DOCKER IMAGES #################################################
|
||||
##########################################################################
|
||||
- name: Download Docker Image (Mariadb)
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: docker-mariadb-test
|
||||
path: /tmp
|
||||
- name: Load Docker Image
|
||||
run: docker load < /tmp/mariadb.tar
|
||||
##########################################################################
|
||||
# UNIT TESTS BACKEND #####################################################
|
||||
##########################################################################
|
||||
- name: backend | docker-compose mariadb
|
||||
run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mariadb
|
||||
- name: Sleep for 30 seconds
|
||||
run: sleep 30s
|
||||
shell: bash
|
||||
- name: backend | docker-compose database
|
||||
run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps database
|
||||
- name: backend Unit tests | test
|
||||
run: cd database && yarn && yarn build && cd ../backend && yarn && yarn test
|
||||
|
||||
##########################################################################
|
||||
# DATABASE MIGRATION TEST UP + RESET #####################################
|
||||
##########################################################################
|
||||
database_migration_test:
|
||||
name: Database Migration Test - Up + Reset
|
||||
runs-on: ubuntu-latest
|
||||
#needs: [nothing]
|
||||
steps:
|
||||
##########################################################################
|
||||
# CHECKOUT CODE ##########################################################
|
||||
##########################################################################
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
##########################################################################
|
||||
# DOCKER COMPOSE DATABASE UP + RESET #####################################
|
||||
##########################################################################
|
||||
- name: database | docker-compose
|
||||
run: docker-compose -f docker-compose.yml up --detach mariadb
|
||||
- name: database | up
|
||||
run: docker-compose -f docker-compose.yml run -T database yarn up
|
||||
- name: database | reset
|
||||
run: docker-compose -f docker-compose.yml run -T database yarn reset
|
||||
81
.github/workflows/test_backend.yml
vendored
Normal file
81
.github/workflows/test_backend.yml
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
name: Gradido Backend Test CI
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
files-changed:
|
||||
name: Detect File Changes - Backend
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
backend: ${{ steps.changes.outputs.backend }}
|
||||
database: ${{ steps.changes.outputs.database }}
|
||||
docker-compose: ${{ steps.changes.outputs.docker-compose }}
|
||||
mariadb: ${{ steps.changes.outputs.mariadb }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3.3.0
|
||||
|
||||
- name: Check for frontend file changes
|
||||
uses: dorny/paths-filter@v2.11.1
|
||||
id: changes
|
||||
with:
|
||||
token: ${{ github.token }}
|
||||
filters: .github/file-filters.yml
|
||||
list-files: shell
|
||||
|
||||
build_test:
|
||||
if: needs.files-changed.outputs.backend == 'true'
|
||||
name: Docker Build Test - Backend
|
||||
needs: files-changed
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Backend | Build 'test' image
|
||||
run: docker build -f ./backend/Dockerfile --target test -t "gradido/backend:test" .
|
||||
|
||||
unit_test:
|
||||
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.database == 'true' || needs.files-changed.outputs.docker-compose == 'true' || needs.files-changed.outputs.mariadb == 'true'
|
||||
name: Unit tests - Backend
|
||||
needs: files-changed
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Backend | docker-compose mariadb
|
||||
run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps mariadb
|
||||
|
||||
- name: Sleep for 30 seconds
|
||||
run: sleep 30s
|
||||
shell: bash
|
||||
|
||||
- name: Backend | docker-compose database
|
||||
run: docker-compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps database
|
||||
|
||||
- name: Backend | Unit tests
|
||||
run: cd database && yarn && yarn build && cd ../backend && yarn && yarn test
|
||||
|
||||
lint:
|
||||
if: needs.files-changed.outputs.backend == 'true'
|
||||
name: Lint - Backend
|
||||
needs: files-changed
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Backend | Lint
|
||||
run: cd database && yarn && cd ../backend && yarn && yarn run lint
|
||||
|
||||
locales:
|
||||
if: needs.files-changed.outputs.backend == 'true'
|
||||
name: Locales - Backend
|
||||
needs: files-changed
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Backend | Locales
|
||||
run: cd backend && yarn && yarn locales
|
||||
64
.github/workflows/test_database.yml
vendored
Normal file
64
.github/workflows/test_database.yml
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
name: Gradido Database Test CI
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
files-changed:
|
||||
name: Detect File Changes - Database
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
database: ${{ steps.changes.outputs.database }}
|
||||
docker-compose: ${{ steps.changes.outputs.docker-compose }}
|
||||
mariadb: ${{ steps.changes.outputs.mariadb }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3.3.0
|
||||
|
||||
- name: Check for frontend file changes
|
||||
uses: dorny/paths-filter@v2.11.1
|
||||
id: changes
|
||||
with:
|
||||
token: ${{ github.token }}
|
||||
filters: .github/file-filters.yml
|
||||
list-files: shell
|
||||
|
||||
build:
|
||||
if: needs.files-changed.outputs.database == 'true'
|
||||
name: Docker Build Test - Database up
|
||||
needs: files-changed
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Database | Build 'test_up' image
|
||||
run: docker build --target test_up -t "gradido/database:test_up" database/
|
||||
|
||||
database_migration_test:
|
||||
if: needs.files-changed.outputs.database == 'true' || needs.files-changed.outputs.docker-compose == 'true' || needs.files-changed.outputs.mariadb == 'true'
|
||||
name: Database Migration Test - Up + Reset
|
||||
needs: files-changed
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Database | docker-compose
|
||||
run: docker-compose -f docker-compose.yml up --detach mariadb
|
||||
|
||||
- name: Database | up
|
||||
run: docker-compose -f docker-compose.yml run -T database yarn up
|
||||
|
||||
- name: Database | reset
|
||||
run: docker-compose -f docker-compose.yml run -T database yarn reset
|
||||
|
||||
lint:
|
||||
if: needs.files-changed.outputs.database == 'true'
|
||||
name: Lint - Database Up
|
||||
needs: files-changed
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Database | Lint
|
||||
run: cd database && yarn && yarn run lint
|
||||
3
.github/workflows/test_dht_node.yml
vendored
3
.github/workflows/test_dht_node.yml
vendored
@ -7,6 +7,7 @@ jobs:
|
||||
name: Detect File Changes - DHT Node
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
database: ${{ steps.changes.outputs.database }}
|
||||
dht_node: ${{ steps.changes.outputs.dht_node }}
|
||||
docker-compose: ${{ steps.changes.outputs.docker-compose }}
|
||||
steps:
|
||||
@ -54,7 +55,7 @@ jobs:
|
||||
|
||||
unit_test:
|
||||
name: Unit Tests - DHT Node
|
||||
if: needs.files-changed.outputs.dht_node == 'true' || needs.files-changed.outputs.docker-compose == 'true'
|
||||
if: needs.files-changed.outputs.database == 'true' || needs.files-changed.outputs.dht_node == 'true' || needs.files-changed.outputs.docker-compose == 'true' || needs.files-changed.outputs.mariadb == 'true'
|
||||
needs: [files-changed, build]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
2
.github/workflows/test_federation.yml
vendored
2
.github/workflows/test_federation.yml
vendored
@ -54,7 +54,7 @@ jobs:
|
||||
|
||||
unit_test:
|
||||
name: Unit Tests - Federation
|
||||
if: needs.files-changed.outputs.docker-compose == 'true' || needs.files-changed.outputs.federation == 'true'
|
||||
if: needs.files-changed.outputs.database == 'true' || needs.files-changed.outputs.docker-compose == 'true' || needs.files-changed.outputs.federation == 'true' || needs.files-changed.outputs.mariadb == 'true'
|
||||
needs: [files-changed, build]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
32
.github/workflows/test_mariadb.yml
vendored
Normal file
32
.github/workflows/test_mariadb.yml
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
name: Gradido MariaDB Test CI
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
files-changed:
|
||||
name: Detect File Changes - MariaDB
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
mariadb: ${{ steps.changes.outputs.mariadb }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3.3.0
|
||||
|
||||
- name: Check for frontend file changes
|
||||
uses: dorny/paths-filter@v2.11.1
|
||||
id: changes
|
||||
with:
|
||||
token: ${{ github.token }}
|
||||
filters: .github/file-filters.yml
|
||||
list-files: shell
|
||||
|
||||
build_test:
|
||||
if: needs.files-changed.outputs.mariadb == 'true'
|
||||
name: Docker Build Test - MariaDB
|
||||
needs: files-changed
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: MariaDB | Build 'test' image
|
||||
run: docker build --target mariadb_server -t "gradido/mariadb:test" -f ./mariadb/Dockerfile ./
|
||||
@ -2,8 +2,3 @@
|
||||
# mariadb server
|
||||
#########################################################################################################
|
||||
FROM mariadb/server:10.5 as mariadb_server
|
||||
|
||||
# ENV DOCKER_WORKDIR="/docker-entrypoint-initdb.d"
|
||||
|
||||
# RUN mkdir -p ${DOCKER_WORKDIR}
|
||||
# WORKDIR ${DOCKER_WORKDIR}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user