mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-27 12:08:02 -05:00
fix(backend): Add directory filter to backend workflows
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
e72afeb427
commit
31381b2cf0
4 changed files with 122 additions and 4 deletions
38
.github/workflows/backend-docker.yml
vendored
38
.github/workflows/backend-docker.yml
vendored
|
@ -11,15 +11,37 @@ on:
|
||||||
branches: [ develop ]
|
branches: [ develop ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
changes:
|
||||||
|
name: Check for backend changes
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
pull-requests: read
|
||||||
|
outputs:
|
||||||
|
changed: ${{ steps.changed.outputs.files }}
|
||||||
|
steps:
|
||||||
|
- name: Check for backend file changes
|
||||||
|
uses: dorny/paths-filter@v2
|
||||||
|
id: changed
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
files:
|
||||||
|
- 'backend/**'
|
||||||
|
- '.github/**'
|
||||||
|
- '.yarn/**'
|
||||||
|
|
||||||
build-dev:
|
build-dev:
|
||||||
|
needs: changes
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
|
|
||||||
- name: Login to GHCR
|
- name: Login to GHCR
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
|
@ -27,6 +49,7 @@ jobs:
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build dev image
|
- name: Build dev image
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
push: true
|
push: true
|
||||||
|
@ -39,27 +62,31 @@ jobs:
|
||||||
|
|
||||||
sqlite-test:
|
sqlite-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ build-dev ]
|
needs: [ build-dev, changes ]
|
||||||
container:
|
container:
|
||||||
image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-ci:${{ github.sha }}
|
image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-ci:${{ github.sha }}
|
||||||
steps:
|
steps:
|
||||||
- run: cd /usr/src/app && yarn run test
|
- run: cd /usr/src/app && yarn run test
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
|
|
||||||
sqlite-e2e:
|
sqlite-e2e:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ build-dev ]
|
needs: [ build-dev, changes ]
|
||||||
container:
|
container:
|
||||||
image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-ci:${{ github.sha }}
|
image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-ci:${{ github.sha }}
|
||||||
steps:
|
steps:
|
||||||
- run: cd /usr/src/app && yarn run test:e2e
|
- run: cd /usr/src/app && yarn run test:e2e
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
|
|
||||||
build-prod:
|
build-prod:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ sqlite-test, sqlite-e2e ]
|
needs: [ sqlite-test, sqlite-e2e, changes ]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
|
|
||||||
- name: Generate Docker metadata
|
- name: Generate Docker metadata
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v4
|
uses: docker/metadata-action@v4
|
||||||
with:
|
with:
|
||||||
|
@ -72,12 +99,14 @@ jobs:
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v2
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
|
|
||||||
- name: Login to GHCR
|
- name: Login to GHCR
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request' && needs.changes.outputs.changed == 'true'
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
|
@ -85,6 +114,7 @@ jobs:
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
|
43
.github/workflows/backend-e2e-tests.yml
vendored
43
.github/workflows/backend-e2e-tests.yml
vendored
|
@ -18,26 +18,55 @@ defaults:
|
||||||
working-directory: backend
|
working-directory: backend
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
changes:
|
||||||
|
name: Check for backend changes
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
pull-requests: read
|
||||||
|
outputs:
|
||||||
|
changed: ${{ steps.changed.outputs.files }}
|
||||||
|
steps:
|
||||||
|
- name: Check for backend file changes
|
||||||
|
uses: dorny/paths-filter@v2
|
||||||
|
id: changed
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
files:
|
||||||
|
- 'backend/**'
|
||||||
|
- '.github/**'
|
||||||
|
- '.yarn/**'
|
||||||
|
|
||||||
sqlite: # This run also collects coverage
|
sqlite: # This run also collects coverage
|
||||||
|
needs: changes
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
cache-dependency-path: backend/yarn.lock
|
cache-dependency-path: backend/yarn.lock
|
||||||
node-version: ${{ env.NODEJS_VERSION }}
|
node-version: ${{ env.NODEJS_VERSION }}
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
|
|
||||||
- run: yarn install --immutable
|
- run: yarn install --immutable
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
|
|
||||||
- run: yarn run test:e2e:cov
|
- run: yarn run test:e2e:cov
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
|
|
||||||
- uses: codecov/codecov-action@v3
|
- uses: codecov/codecov-action@v3
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
with:
|
with:
|
||||||
directory: backend/coverage-e2e
|
directory: backend/coverage-e2e
|
||||||
flags: e2e-tests
|
flags: e2e-tests
|
||||||
|
|
||||||
mariadb:
|
mariadb:
|
||||||
|
needs: changes
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
services:
|
services:
|
||||||
mariadb:
|
mariadb:
|
||||||
|
@ -52,20 +81,27 @@ jobs:
|
||||||
- 3306:3306
|
- 3306:3306
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
cache-dependency-path: backend/yarn.lock
|
cache-dependency-path: backend/yarn.lock
|
||||||
node-version: ${{ env.NODEJS_VERSION }}
|
node-version: ${{ env.NODEJS_VERSION }}
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
- run: yarn install --immutable
|
- run: yarn install --immutable
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
|
|
||||||
- run: yarn run test:e2e
|
- run: yarn run test:e2e
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
env:
|
env:
|
||||||
HEDGEDOC_TEST_DB_TYPE: mariadb
|
HEDGEDOC_TEST_DB_TYPE: mariadb
|
||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
|
needs: changes
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
|
@ -78,15 +114,22 @@ jobs:
|
||||||
- 5432:5432
|
- 5432:5432
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
cache-dependency-path: backend/yarn.lock
|
cache-dependency-path: backend/yarn.lock
|
||||||
node-version: ${{ env.NODEJS_VERSION }}
|
node-version: ${{ env.NODEJS_VERSION }}
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
|
|
||||||
- run: yarn install --immutable
|
- run: yarn install --immutable
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
|
|
||||||
- run: yarn run test:e2e
|
- run: yarn run test:e2e
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
env:
|
env:
|
||||||
HEDGEDOC_TEST_DB_TYPE: postgres
|
HEDGEDOC_TEST_DB_TYPE: postgres
|
||||||
|
|
45
.github/workflows/backend-tests.yml
vendored
45
.github/workflows/backend-tests.yml
vendored
|
@ -19,49 +19,94 @@ defaults:
|
||||||
working-directory: backend
|
working-directory: backend
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
changes:
|
||||||
|
name: Check for backend changes
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
pull-requests: read
|
||||||
|
outputs:
|
||||||
|
changed: ${{ steps.changed.outputs.files }}
|
||||||
|
steps:
|
||||||
|
- name: Check for backend file changes
|
||||||
|
uses: dorny/paths-filter@v2
|
||||||
|
id: changed
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
files:
|
||||||
|
- 'backend/**'
|
||||||
|
- '.github/**'
|
||||||
|
- '.yarn/**'
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
|
needs: changes
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
|
|
||||||
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
cache-dependency-path: backend/yarn.lock
|
cache-dependency-path: backend/yarn.lock
|
||||||
node-version: ${{ env.NODEJS_VERSION }}
|
node-version: ${{ env.NODEJS_VERSION }}
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
|
|
||||||
- run: yarn install --immutable
|
- run: yarn install --immutable
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
|
|
||||||
- run: yarn run lint
|
- run: yarn run lint
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
needs: changes
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [ 14.x, 16.x, 18.x ]
|
node-version: [ 14.x, 16.x, 18.x ]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
cache-dependency-path: backend/yarn.lock
|
cache-dependency-path: backend/yarn.lock
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
|
|
||||||
- run: yarn install --immutable
|
- run: yarn install --immutable
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
|
|
||||||
- run: yarn run build
|
- run: yarn run build
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
|
|
||||||
integration-tests:
|
integration-tests:
|
||||||
|
needs: changes
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
cache-dependency-path: backend/yarn.lock
|
cache-dependency-path: backend/yarn.lock
|
||||||
node-version: ${{ env.NODEJS_VERSION }}
|
node-version: ${{ env.NODEJS_VERSION }}
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
|
|
||||||
- run: yarn install --immutable
|
- run: yarn install --immutable
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
|
|
||||||
- run: yarn run test:cov
|
- run: yarn run test:cov
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
|
|
||||||
- uses: codecov/codecov-action@v3
|
- uses: codecov/codecov-action@v3
|
||||||
|
if: needs.changes.outputs.changed == 'true'
|
||||||
with:
|
with:
|
||||||
directory: backend/coverage
|
directory: backend/coverage
|
||||||
flags: integration-tests
|
flags: integration-tests
|
||||||
|
|
Loading…
Reference in a new issue