generated from acdh-oeaw/template-app-nuxt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 892ae95
Showing
59 changed files
with
12,410 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
## .gitignore ## | ||
|
||
# dependencies | ||
node_modules/ | ||
.pnpm-store/ | ||
|
||
# logs | ||
*.log | ||
|
||
# non-public environment variables | ||
.env.local | ||
.env.*.local | ||
|
||
# caches | ||
.eslintcache | ||
.stylelintcache | ||
*.tsbuildinfo | ||
|
||
# vercel | ||
.vercel | ||
|
||
# misc | ||
.DS_Store | ||
.idea/ | ||
|
||
# nuxt.js | ||
dist | ||
.nuxt/ | ||
.nitro/ | ||
.output/ | ||
|
||
# playwright | ||
/test-results/ | ||
/playwright-report/ | ||
/playwright/.cache/ | ||
|
||
|
||
## .dockerignore ## | ||
|
||
# git | ||
.git/ | ||
.gitignore | ||
|
||
# github | ||
.github/ | ||
|
||
# vscode settings | ||
.vscode/ | ||
|
||
# environment variables | ||
.env | ||
.env.* | ||
|
||
# tests | ||
/e2e/ | ||
/test/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = tab | ||
insert_final_newline = true | ||
max_line_length = 100 | ||
trim_trailing_whitespace = true | ||
|
||
[*.{yaml,yml}] | ||
indent_style = space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# ------------------------------------------------------------------------------------------------- | ||
# app | ||
# ------------------------------------------------------------------------------------------------- | ||
NUXT_PUBLIC_APP_BASE_URL="http://localhost:3000" | ||
# imprint service | ||
NUXT_PUBLIC_REDMINE_ID= | ||
# web crawlers | ||
BOTS="disabled" | ||
|
||
# ------------------------------------------------------------------------------------------------- | ||
# analytics | ||
# ------------------------------------------------------------------------------------------------- | ||
NUXT_PUBLIC_MATOMO_BASE_URL="https://matomo.acdh.oeaw.ac.at" | ||
# NUXT_PUBLIC_MATOMO_ID= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
name: Build and deploy | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
env: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Derive environment from git ref | ||
id: environment | ||
run: | | ||
if [ "${{ github.ref }}" = "refs/heads/main" ]; then | ||
ENVIRONMENT="production" | ||
APP_NAME_SUFFIX="" | ||
elif [ "${{ github.ref }}" = "refs/heads/develop" ]; then | ||
ENVIRONMENT="development" | ||
APP_NAME_SUFFIX="-development" | ||
elif [ "${{github.event_name}}" = "pull_request"]; then | ||
ENVIRONMENT="pr/${{ github.event.pull_request.number }}" | ||
APP_NAME_SUFFIX="-pr-${{ github.event.pull_request.number }}" | ||
else | ||
exit 1 | ||
fi | ||
echo "ENVIRONMENT=$ENVIRONMENT" >> $GITHUB_OUTPUT | ||
echo "APP_NAME_SUFFIX=$APP_NAME_SUFFIX" >> $GITHUB_OUTPUT | ||
outputs: | ||
environment: "${{ steps.environment.outputs.ENVIRONMENT }}" | ||
app_name_suffix: "${{ steps.environment.outputs.APP_NAME_SUFFIX }}" | ||
registry: ghcr.io | ||
image: ${{ github.repository }} | ||
|
||
vars: | ||
needs: [env] | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: ${{ needs.env.outputs.environment }} | ||
steps: | ||
- name: Generate public URL | ||
id: public_url | ||
run: | | ||
if [[ -z "${{ vars.PUBLIC_URL }}" ]]; then | ||
PUBLIC_URL=https://${{ needs.env.outputs.app_name_suffix }}.${{ vars.KUBE_INGRESS_BASE_DOMAIN }} | ||
else | ||
PUBLIC_URL="${{ vars.PUBLIC_URL }}" | ||
fi | ||
echo "PUBLIC_URL=$PUBLIC_URL" >> $GITHUB_OUTPUT | ||
outputs: | ||
public_url: ${{ steps.public_url.outputs.PUBLIC_URL }} | ||
|
||
build: | ||
needs: [env, vars] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ needs.env.outputs.registry }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ needs.env.outputs.registry }}/${{ needs.env.outputs.image }} | ||
tags: | | ||
type=raw,value={{sha}} | ||
type=ref,event=branch | ||
# type=ref,event=pr | ||
# type=semver,pattern={{version}} | ||
# type=semver,pattern={{major}}.{{minor}} | ||
# type=raw,value=latest | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
build-args: | | ||
NUXT_PUBLIC_APP_BASE_URL="${{ needs.vars.outputs.public_url }}" | ||
NUXT_PUBLIC_MATOMO_BASE_URL="${{ vars.NUXT_PUBLIC_MATOMO_BASE_URL }}" | ||
NUXT_PUBLIC_MATOMO_ID="${{ vars.NUXT_PUBLIC_MATOMO_ID }}" | ||
NUXT_PUBLIC_REDMINE_ID="${{ vars.SERVICE_ID }}" | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
deploy: | ||
needs: [env, vars, build] | ||
uses: acdh-oeaw/gl-autodevops-minimal-port/.github/workflows/deploy-cluster-2.yml@main | ||
secrets: inherit | ||
with: | ||
environment: ${{ needs.env.outputs.environment }} | ||
DOCKER_TAG: ${{ needs.env.outputs.registry }}/${{ needs.env.outputs.image }} | ||
APP_NAME: "frontend${{ needs.env.outputs.app_name_suffix }}" | ||
APP_ROOT: "/" | ||
SERVICE_ID: "${{ vars.SERVICE_ID }}" | ||
PUBLIC_URL: "${{ needs.vars.outputs.public_url }}" | ||
default_port: "3000" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
name: Validate | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
validate: | ||
name: Validate | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 60 | ||
|
||
strategy: | ||
fail-fast: true | ||
matrix: | ||
node-version: [20.x] | ||
os: [ubuntu-latest] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Enable corepack | ||
run: corepack enable | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: "pnpm" | ||
|
||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: Commit message | ||
if: github.event_name == 'push' | ||
run: | | ||
pnpm exec commitlint \ | ||
--from ${{ github.event.before }} \ | ||
--to ${{ github.event.after }} \ | ||
--verbose | ||
- name: Commit messages | ||
if: github.event_name == 'pull_request' | ||
run: | | ||
pnpm exec commitlint \ | ||
--from ${{ github.event.pull_request.base.sha }} \ | ||
--to ${{ github.event.pull_request.head.sha }} \ | ||
--verbose | ||
- name: Format | ||
run: pnpm run format:check | ||
|
||
- name: Lint | ||
run: pnpm run lint:check | ||
|
||
- name: Typecheck | ||
run: pnpm run types:check | ||
|
||
- name: Test | ||
run: pnpm run test | ||
|
||
- name: Get playwright version | ||
run: | | ||
PLAYWRIGHT_VERSION=$(pnpm ls @playwright/test --json | jq --raw-output '.[0].devDependencies["@playwright/test"].version') | ||
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV | ||
- name: Cache playwright browsers | ||
uses: actions/cache@v3 | ||
id: cache-playwright-browsers | ||
with: | ||
path: "~/.cache/ms-playwright" | ||
key: ${{ matrix.os }}-playwright-browsers-${{ env.PLAYWRIGHT_VERSION }} | ||
|
||
# TODO: might need https://github.com/microsoft/playwright/issues/7249#issuecomment-1597663397 | ||
- name: Install playwright browsers | ||
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true' | ||
run: pnpm exec playwright install --with-deps | ||
|
||
- name: Cache Next.js build output | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ github.workspace }}/.next/cache | ||
key: ${{ matrix.os }}-nextjs-${{ hashFiles('pnpm-lock.yaml') }} | ||
|
||
- name: Build app | ||
run: pnpm run build | ||
env: | ||
NUXT_PUBLIC_APP_BASE_URL: "http://localhost:3000" | ||
NUXT_PUBLIC_REDMINE_ID: "${{ vars.SERVICE_ID }}" | ||
|
||
- name: Run e2e tests | ||
run: pnpm run test:e2e | ||
|
||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 | ||
|
||
build-deploy: | ||
if: ${{ github.event_name == 'push' }} | ||
needs: [validate] | ||
uses: ./.github/workflows/build-deploy.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# dependencies | ||
node_modules/ | ||
.pnpm-store/ | ||
|
||
# logs | ||
*.log | ||
|
||
# non-public environment variables | ||
.env.local | ||
.env.*.local | ||
|
||
# caches | ||
.eslintcache | ||
.stylelintcache | ||
*.tsbuildinfo | ||
|
||
# vercel | ||
.vercel | ||
|
||
# misc | ||
.DS_Store | ||
.idea/ | ||
|
||
# nuxt.js | ||
dist | ||
.nuxt/ | ||
.nitro/ | ||
.output/ | ||
|
||
# playwright | ||
/test-results/ | ||
/playwright-report/ | ||
/playwright/.cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
engine-strict=true | ||
# still necessary for nuxt 3 | ||
# @see https://github.com/nuxt/nuxt/issues/14146 | ||
shamefully-hoist=true | ||
shell-emulator=true | ||
use-node-version=20.8.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"recommendations": [ | ||
"bradlc.vscode-tailwindcss", | ||
"dbaeumer.vscode-eslint", | ||
"editorconfig.editorconfig", | ||
"esbenp.prettier-vscode", | ||
"lokalise.i18n-ally", | ||
"mikestead.dotenv", | ||
"ms-playwright.playwright", | ||
"stylelint.vscode-stylelint", | ||
"vue.volar", | ||
"vue.vscode-typescript-vue-plugin", | ||
"zixuanchen.vitest-explorer" | ||
] | ||
} |
Oops, something went wrong.