Skip to content

Commit

Permalink
Merge branch 'main' into e2e-nuxt
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasdiez committed Jul 6, 2024
2 parents 8981223 + 739b600 commit 88d08dc
Show file tree
Hide file tree
Showing 39 changed files with 21,933 additions and 26,842 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
"forwardPorts": [3000, 24678],
// Finalize container creation.
"onCreateCommand": "yarn install && yarn prisma:migrate:dev && yarn prisma:seed",
"onCreateCommand": "pnpm install && pnpm prisma:migrate:dev && pnpm prisma:seed",
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"
}
5 changes: 5 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ module.exports = {
'@typescript-eslint/no-unsafe-assignment': 'warn',
// TODO: Remove this once all errors are fixed
'@typescript-eslint/no-redundant-type-constituents': 'warn',
// Allow numbers in templates without explicit casting
'@typescript-eslint/restrict-template-expressions': [
'error',
{ allowNumber: true },
],
},
},
{
Expand Down
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ updates:
nuxt:
patterns:
- 'nuxt'
- 'vite'
- 'nuxt-*'
- '@nuxt/*'
- '@nuxtjs/*'
Expand All @@ -60,13 +61,17 @@ updates:
- '@vueuse/core'
- '@he-tree/vue'
- '@tailwindcss/forms'
- '@yaireo/tagify'
prisma:
patterns:
- 'prisma'
- '@prisma/*'
types:
patterns:
- '@types/*'
azure:
patterns:
- '@azure/*'

# Fetch and update latest `github-actions` pkgs
- package-ecosystem: github-actions
Expand Down
40 changes: 23 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,30 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4.1.1
uses: actions/checkout@v4.1.7
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4.0.2
with:
node-version: 20
cache: 'yarn'
cache: 'pnpm'

- name: Install dependencies
run: yarn install
run: pnpm install

- name: Run linter
run: yarn lint
run: pnpm lint

- name: Check types
run: yarn typecheck
run: pnpm typecheck

- name: Validate GraphQL operations
run: yarn validate
run: pnpm validate

test:
name: Build & Test
Expand Down Expand Up @@ -82,41 +85,44 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4.1.1
uses: actions/checkout@v4.1.7
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4.0.2
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
cache: 'pnpm'

- name: Install dependencies
run: yarn install
run: pnpm install

- name: Init database
run: yarn prisma:push
run: pnpm prisma:push

# Check that no schema changes have been done without corresponding migration files have been added
- name: Detect database schema drift
run: yarn prisma:migrate:diff $DATABASE_URL
run: pnpm prisma:migrate:diff $DATABASE_URL

- name: Build
run: yarn build
run: pnpm build

- name: Start server
run: yarn start &
run: pnpm start &

- name: Run tests
run: yarn test --coverage
run: pnpm run test --coverage
env:
TEST_URL: http://localhost:3000

- name: Build Storybook
run: |
yarn nuxi generate
yarn storybook:build
pnpm nuxi generate
pnpm storybook:build
cp .output/public/_storybook/external-iframe/index.html storybook-static/iframe.html
mkdir -p storybook-static/_storybook/external-iframe
cp -r .output/public/_nuxt storybook-static
Expand All @@ -131,6 +137,6 @@ jobs:
debug: true

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.1.0
uses: codecov/codecov-action@v4.5.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/deploy-preview-close.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
action: 'close'

- name: Login to Azure
uses: Azure/login@v1
uses: Azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand Down
21 changes: 12 additions & 9 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,26 @@ jobs:
run: exit 1

- name: Checkout
uses: actions/checkout@v4.1.1
uses: actions/checkout@v4.1.7
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4.0.2
with:
node-version: 20
cache: 'yarn'
cache: 'pnpm'

- name: Build
run: |
yarn install
yarn build:azure
pnpm install
pnpm build:azure
- name: Login to Azure
uses: Azure/login@v1
uses: Azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand All @@ -62,7 +65,7 @@ jobs:
# Delete old deployment (otherwise we get a spawn EBUSY error when running the workflow again)
az staticwebapp environment delete --name jabref-online --environment-name $env:PREVIEW_NAME --yes || true
# Workaround for https://github.com/Azure/static-web-apps-cli/issues/557 and https://github.com/Azure/static-web-apps-cli/issues/565
$output = yarn swa deploy .output\public --env $env:PREVIEW_NAME --verbose=silly 2>&1 | Out-String
$output = pnpm swa deploy .output\public --env $env:PREVIEW_NAME --verbose=silly 2>&1 | Out-String
Write-Host $output
$match = $output | Select-String -Pattern 'Project deployed to (?<url>.*) '
if ($match -eq $null) { exit 1 }
Expand Down Expand Up @@ -90,11 +93,11 @@ jobs:
# az postgres flexible-server execute --name jabrefdb -u "Github" -p "$pwd" --database-name $name -q "SELECT schema_name FROM information_schema.schemata;" --output table
# Login to the database using the Github user
$connection_string = "postgresql://Github:$pwd@$($env:DB_NAME).postgres.database.azure.com:5432/$($name)?sslmode=require"
echo "::add-mask::$connection_string"
echo "::add-mask::$connection_string"
echo "DATABASE_URL=$connection_string" >> $env:GITHUB_ENV
$Env:DATABASE_URL = $connection_string
# Finally, run the migrations (this also creates the db)
yarn prisma:migrate:reset --force
pnpm prisma:migrate:reset --force
env:
DB_NAME: ${{ secrets.AZURE_DATABASE_NAME }}

Expand Down Expand Up @@ -147,6 +150,6 @@ jobs:
Deployed ${{ github.sha }} to ${{ steps.deploy_web.outputs.url }}
- name: Run API tests
run: yarn test:api
run: pnpm test:api
env:
TEST_URL: ${{ steps.deploy_web.outputs.url }}
21 changes: 12 additions & 9 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,33 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4.1.1
uses: actions/checkout@v4.1.7

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4.0.2
with:
node-version: 20
cache: 'yarn'
cache: 'pnpm'

- name: Install dependencies
run: yarn install
run: pnpm install

- name: Reset Test database on Azure
if: matrix.environment == 'Test'
run: yarn prisma:migrate:reset --force
run: pnpm prisma:migrate:reset --force

- name: Update Production database on Azure
if: matrix.environment == 'Staging'
run: yarn prisma:migrate:deploy
run: pnpm prisma:migrate:deploy

- name: Build
run: yarn build:azure
run: pnpm build:azure

- name: Login to Azure
uses: Azure/login@v1
uses: Azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand All @@ -73,7 +76,7 @@ jobs:
# Delete old deployment (otherwise we get a spawn EBUSY error when running the workflow again)
az staticwebapp environment delete --name jabref-online --environment-name ${{ matrix.deployment_environment }} --yes || true
yarn swa deploy .output\public --env ${{ matrix.deployment_environment }}
pnpm swa deploy .output\public --env ${{ matrix.deployment_environment }}
env:
SWA_CLI_DEPLOYMENT_TOKEN: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_MANGO_PEBBLE_0224C3803 }}

Expand Down Expand Up @@ -123,6 +126,6 @@ jobs:
# interval: 30

- name: Run API tests
run: yarn test:api
run: pnpm test:api
env:
TEST_URL: ${{ matrix.url }}
14 changes: 7 additions & 7 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,33 @@ image: gitpod/workspace-postgres
# Start up tasks: https://www.gitpod.io/docs/config-start-tasks/
tasks:
- name: Setup
init: yarn install
init: pnpm install
command: |
yarn prisma:migrate:dev
yarn prisma:seed
yarn docker:redis
pnpm prisma:migrate:dev
pnpm prisma:seed
pnpm docker:redis
gp sync-done setup
env:
DATABASE_URL: postgresql://gitpod@localhost/jabrefonline
NUXT_TELEMETRY_DISABLED: 1
- name: Dev Server
command: |
gp sync-await setup
yarn dev
pnpm dev
env:
DATABASE_URL: postgresql://gitpod@localhost/jabrefonline
NUXT_TELEMETRY_DISABLED: 1
- name: Generate
command: |
gp sync-await setup
yarn generate:watch
pnpm generate:watch
env:
DATABASE_URL: postgresql://gitpod@localhost/jabrefonline
NUXT_TELEMETRY_DISABLED: 1
- name: Prisma Studio
command: |
gp sync-await setup
yarn prisma:studio
pnpm prisma:studio
env:
DATABASE_URL: postgresql://gitpod@localhost/jabrefonline

Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm-lock.yaml
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"files.exclude": {
"coverage": true
},
"vitest.commandLine": "yarn test --",
"vitest.commandLine": "pnpm test --",
"eslint.validate": ["javascript", "typescript", "graphql", "vue"],
"search.exclude": {
"**/node_modules": true,
Expand Down
8 changes: 4 additions & 4 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@
{
"label": "Ensure dependencies",
"type": "shell",
"command": "yarn docker:redis",
"command": "pnpm docker:redis",
"problemMatcher": []
},
{
"label": "Generate code",
"type": "shell",
"command": "yarn generate:watch",
"command": "pnpm generate:watch",
"problemMatcher": [],
// Mark as a background task to avoid the spinner animation on the terminal tab
"isBackground": true
},
{
"label": "Run dev server",
"type": "shell",
"command": "yarn dev",
"command": "pnpm dev",
"problemMatcher": [],
// Mark as a background task to avoid the spinner animation on the terminal tab
"isBackground": true
},
{
"label": "Prisma Studio",
"type": "shell",
"command": "yarn prisma:studio",
"command": "pnpm prisma:studio",
"problemMatcher": [],
// Mark as a background task to avoid the spinner animation on the terminal tab
"isBackground": true
Expand Down
Loading

0 comments on commit 88d08dc

Please sign in to comment.