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 ]
|
||||
|
||||
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:
|
||||
needs: changes
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- name: Login to GHCR
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
|
@ -27,6 +49,7 @@ jobs:
|
|||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build dev image
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
push: true
|
||||
|
@ -39,27 +62,31 @@ jobs:
|
|||
|
||||
sqlite-test:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ build-dev ]
|
||||
needs: [ build-dev, changes ]
|
||||
container:
|
||||
image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-ci:${{ github.sha }}
|
||||
steps:
|
||||
- run: cd /usr/src/app && yarn run test
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
sqlite-e2e:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ build-dev ]
|
||||
needs: [ build-dev, changes ]
|
||||
container:
|
||||
image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-ci:${{ github.sha }}
|
||||
steps:
|
||||
- run: cd /usr/src/app && yarn run test:e2e
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
build-prod:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [ sqlite-test, sqlite-e2e ]
|
||||
needs: [ sqlite-test, sqlite-e2e, changes ]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- name: Generate Docker metadata
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
|
@ -72,12 +99,14 @@ jobs:
|
|||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- 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
|
||||
with:
|
||||
registry: ghcr.io
|
||||
|
@ -85,6 +114,7 @@ jobs:
|
|||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
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
|
||||
|
||||
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
|
||||
needs: changes
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
cache-dependency-path: backend/yarn.lock
|
||||
node-version: ${{ env.NODEJS_VERSION }}
|
||||
cache: 'yarn'
|
||||
|
||||
- run: yarn install --immutable
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- run: yarn run test:e2e:cov
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- uses: codecov/codecov-action@v3
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
with:
|
||||
directory: backend/coverage-e2e
|
||||
flags: e2e-tests
|
||||
|
||||
mariadb:
|
||||
needs: changes
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
mariadb:
|
||||
|
@ -52,20 +81,27 @@ jobs:
|
|||
- 3306:3306
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
cache-dependency-path: backend/yarn.lock
|
||||
node-version: ${{ env.NODEJS_VERSION }}
|
||||
cache: 'yarn'
|
||||
- run: yarn install --immutable
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- run: yarn run test:e2e
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
env:
|
||||
HEDGEDOC_TEST_DB_TYPE: mariadb
|
||||
|
||||
postgres:
|
||||
needs: changes
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
postgres:
|
||||
|
@ -78,15 +114,22 @@ jobs:
|
|||
- 5432:5432
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
cache-dependency-path: backend/yarn.lock
|
||||
node-version: ${{ env.NODEJS_VERSION }}
|
||||
cache: 'yarn'
|
||||
|
||||
- run: yarn install --immutable
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- run: yarn run test:e2e
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
env:
|
||||
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
|
||||
|
||||
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:
|
||||
needs: changes
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
cache-dependency-path: backend/yarn.lock
|
||||
node-version: ${{ env.NODEJS_VERSION }}
|
||||
cache: 'yarn'
|
||||
|
||||
- run: yarn install --immutable
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- run: yarn run lint
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
build:
|
||||
needs: changes
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [ 14.x, 16.x, 18.x ]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
cache-dependency-path: backend/yarn.lock
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'yarn'
|
||||
|
||||
- run: yarn install --immutable
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- run: yarn run build
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
integration-tests:
|
||||
needs: changes
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Use Node.js ${{ env.NODEJS_VERSION }}
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
cache-dependency-path: backend/yarn.lock
|
||||
node-version: ${{ env.NODEJS_VERSION }}
|
||||
cache: 'yarn'
|
||||
|
||||
- run: yarn install --immutable
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- run: yarn run test:cov
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
|
||||
- uses: codecov/codecov-action@v3
|
||||
if: needs.changes.outputs.changed == 'true'
|
||||
with:
|
||||
directory: backend/coverage
|
||||
flags: integration-tests
|
||||
|
|
Loading…
Reference in a new issue