mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-24 12:07:08 -04:00
fix(frontend): move and rename workflows
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
686dc9b6e2
commit
31e4ab5e37
8 changed files with 0 additions and 19 deletions
39
.github/workflows/frontend-codeql.yml
vendored
Normal file
39
.github/workflows/frontend-codeql.yml
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
schedule:
|
||||
- cron: "54 23 * * 2"
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: TypeScript
|
||||
queries: +security-and-quality
|
||||
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
with:
|
||||
category: "/language:TypeScript"
|
50
.github/workflows/frontend-docker.yml
vendored
Normal file
50
.github/workflows/frontend-docker.yml
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
# SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
name: Build Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Generate Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to GHCR
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
push: true
|
||||
file: Dockerfile
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
build-args: |
|
||||
BUILD_VERSION=${{ github.event.head_commit.id }}
|
146
.github/workflows/frontend-e2e-tests.yml
vendored
Normal file
146
.github/workflows/frontend-e2e-tests.yml
vendored
Normal file
|
@ -0,0 +1,146 @@
|
|||
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
name: e2e
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request_target:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
NODE_VERSION: 18
|
||||
HEAD_COMMIT_HASH: "${{ !!github.event.pull_request && github.event.pull_request.head.sha || github.sha }}"
|
||||
|
||||
jobs:
|
||||
build-frontend:
|
||||
if: "${{ (github.event_name == 'pull_request_target') == github.event.pull_request.head.repo.fork }}"
|
||||
runs-on: ubuntu-latest
|
||||
name: Build test build of frontend
|
||||
steps:
|
||||
- name: Check out repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ env.HEAD_COMMIT_HASH }}
|
||||
|
||||
- name: Cache build
|
||||
uses: actions/cache@v3.0.11
|
||||
id: build-cache
|
||||
with:
|
||||
path: .next
|
||||
key: ${{ env.HEAD_COMMIT_HASH }}
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache yarn cache
|
||||
uses: actions/cache@v3
|
||||
id: yarn-cache
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Set up NodeJS
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: yarn install --immutable
|
||||
|
||||
- name: Build test production build
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: yarn build:test
|
||||
|
||||
- uses: actions/upload-artifact@master
|
||||
with:
|
||||
name: e2e-build
|
||||
path: |
|
||||
.next
|
||||
!.next/cache
|
||||
!.next/standalone
|
||||
|
||||
end2end:
|
||||
name: Perform E2E Test in ${{ matrix.browser }}
|
||||
needs: build-frontend
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: cypress/browsers:node18.12.0-chrome106-ff106
|
||||
options: --user 1001 --shm-size=2g
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
browser: [ 'chrome' ]
|
||||
containers: [ 1, 2, 3, 4, 5 ]
|
||||
steps:
|
||||
- name: Check out repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Cache build
|
||||
uses: actions/cache@v3.0.11
|
||||
id: build-cache
|
||||
with:
|
||||
path: .next
|
||||
key: ${{ env.HEAD_COMMIT_HASH }}
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache yarn cache
|
||||
uses: actions/cache@v3
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Set up NodeJS
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --immutable
|
||||
|
||||
- name: Download built frontend
|
||||
uses: actions/download-artifact@master
|
||||
with:
|
||||
name: e2e-build
|
||||
path: .next
|
||||
|
||||
- name: Run server
|
||||
run: yarn start:ci &
|
||||
env:
|
||||
NODE_ENV: test
|
||||
|
||||
- name: Wait for server
|
||||
run: "sleep 3 && curl --max-time 120 http://127.0.0.1:3001/"
|
||||
|
||||
- name: Run cypress
|
||||
run: "yarn cy:run:${{ matrix.browser }} --record true --parallel --group \"UI - ${{ matrix.browser }}\""
|
||||
env:
|
||||
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- uses: actions/upload-artifact@master
|
||||
if: always()
|
||||
with:
|
||||
name: screenshots
|
||||
path: cypress/screenshots
|
46
.github/workflows/frontend-lint.yml
vendored
Normal file
46
.github/workflows/frontend-lint.yml
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
name: lint
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
env:
|
||||
NODE_VERSION: 18
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
name: Lints all .ts and .tsx files
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache yarn cache
|
||||
uses: actions/cache@v3
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Set up NodeJS
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --immutable
|
||||
|
||||
- name: Lint code
|
||||
run: yarn lint
|
68
.github/workflows/frontend-netlify-deploy-main.yml
vendored
Normal file
68
.github/workflows/frontend-netlify-deploy-main.yml
vendored
Normal file
|
@ -0,0 +1,68 @@
|
|||
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
name: deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
|
||||
env:
|
||||
NETLIFY_VERSION: 12.0.11
|
||||
NODE_VERSION: 18
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
name: Deploys to netlify
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache yarn cache
|
||||
uses: actions/cache@v3
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Set up NodeJS
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Patch intro.md to include netlify banner.
|
||||
run: cp netlify/intro.md public/public/intro.md
|
||||
|
||||
- name: Patch motd.md to include privacy policy.
|
||||
run: cp netlify/motd.md public/public/motd.md
|
||||
|
||||
- name: Patch version.json to include git hash
|
||||
run: jq ".version = \"0.0.0+${GITHUB_SHA:0:8}\"" src/version.json > src/_version.json && mv src/_version.json src/version.json
|
||||
|
||||
- name: Patch base URL
|
||||
run: echo "HD_EDITOR_BASE_URL=\"https://hedgedoc.dev/\"" >> .env.production
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --immutable
|
||||
|
||||
- name: Build app
|
||||
run: yarn build:mock
|
||||
|
||||
- name: Remove Next.js cache to avoid it being deployed
|
||||
run: rm -r .next/cache
|
||||
|
||||
- name: Install netlify CLI
|
||||
run: "npm install -g netlify-cli@${{ env.NETLIFY_VERSION }}"
|
||||
|
||||
- name: Run netlify CLI deployment
|
||||
env:
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
run: "netlify deploy --build --prod --message \"${{ github.event.head_commit.id }}: ${{ github.event.head_commit.message }}\""
|
113
.github/workflows/frontend-netlify-deploy-pr.yml
vendored
Normal file
113
.github/workflows/frontend-netlify-deploy-pr.yml
vendored
Normal file
|
@ -0,0 +1,113 @@
|
|||
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
name: deploy
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
types:
|
||||
- labeled
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
pull_request_target:
|
||||
branches: [ main ]
|
||||
types:
|
||||
- labeled
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
deployments: write
|
||||
|
||||
env:
|
||||
NETLIFY_VERSION: 12.0.11
|
||||
NODE_VERSION: 18
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
if: (github.event.pull_request.draft == false || contains( github.event.pull_request.labels.*.name, 'FORCE DEPLOY')) && (github.event_name == 'pull_request_target') == github.event.pull_request.head.repo.fork
|
||||
runs-on: ubuntu-latest
|
||||
name: Deploys to netlify
|
||||
env:
|
||||
DEPLOY_URL: "https://${{ github.event.number }}--hedgedoc-ui-test.netlify.app/"
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache yarn cache
|
||||
uses: actions/cache@v3
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Set up NodeJS
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Patch intro.md to include netlify banner.
|
||||
run: cp netlify/intro.md public/public/intro.md
|
||||
|
||||
- name: Patch motd.md to include privacy policy.
|
||||
run: cp netlify/motd.md public/public/motd.md
|
||||
|
||||
- name: Patch version.json to include git hash
|
||||
run: jq ".version = \"0.0.0+${GITHUB_SHA:0:8}\"" src/version.json > src/_version.json && mv src/_version.json src/version.json
|
||||
|
||||
- name: Patch base URL
|
||||
run: echo "HD_EDITOR_BASE_URL=\"${{ env.DEPLOY_URL }}\"" >> .env.production
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --immutable
|
||||
|
||||
- name: Build app
|
||||
run: yarn build:mock
|
||||
|
||||
- name: Remove Next.js cache to avoid it being deployed
|
||||
run: rm -r .next/cache
|
||||
|
||||
- name: Mark GitHub deployment as started
|
||||
uses: bobheadxi/deployments@v1.3.0
|
||||
id: github-deployment
|
||||
with:
|
||||
step: start
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
env: "PR #${{ github.event.number }}"
|
||||
override: true
|
||||
ref: ${{ github.head_ref }}
|
||||
|
||||
- name: Install netlify CLI
|
||||
run: "npm install -g netlify-cli@${{ env.NETLIFY_VERSION }}"
|
||||
|
||||
- name: Run netlify CLI
|
||||
env:
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
run: "netlify deploy --build --context deploy-preview --alias \"${{ github.event.number }}\" --json --message \"PR #${{ github.event.number }}\""
|
||||
|
||||
- name: Mark GitHub deployment as finished
|
||||
if: always()
|
||||
uses: bobheadxi/deployments@v1.3.0
|
||||
with:
|
||||
step: finish
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
env_url: ${{ env.DEPLOY_URL }}
|
||||
env: ${{ steps.github-deployment.outputs.env }}
|
||||
status: ${{ job.status }}
|
||||
deployment_id: ${{ steps.github-deployment.outputs.deployment_id }}
|
||||
override: true
|
49
.github/workflows/frontend-test-and-build.yml
vendored
Normal file
49
.github/workflows/frontend-test-and-build.yml
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
name: test, build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node: [ '14', '16', '18' ]
|
||||
name: Test and build with NodeJS ${{ matrix.node }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache yarn cache
|
||||
uses: actions/cache@v3
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-${{ matrix.node }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-${{ matrix.node }}
|
||||
|
||||
- name: Set up NodeJS
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --immutable
|
||||
|
||||
- name: Test Project
|
||||
run: yarn test:ci
|
||||
|
||||
- name: Build project
|
||||
run: yarn build:mock
|
Loading…
Add table
Add a link
Reference in a new issue