Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,55 @@ permissions:
actions: read

jobs:
# Lets docs-only PRs skip e2e. Pushes to main and manual runs always run it.
changes:
name: Detect changes
runs-on: ubuntu-latest
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- name: Check for changes outside docs
id: filter
if: github.event_name == 'pull_request'
uses: dorny/paths-filter@v4
with:
predicate-quantifier: every
filters: |
code:
- "**"
- "!**/*.md"
- "!docs/**"

ci:
uses: ./.github/workflows/ci.yml
secrets: inherit

e2e:
needs: [changes]
if: github.event_name != 'pull_request' || needs.changes.outputs.code == 'true'
uses: ./.github/workflows/e2e.yml
secrets: inherit

all-checks:
name: All checks passed
runs-on: ubuntu-latest
needs: [ci, e2e]
needs: [changes, ci, e2e]
if: always()
steps:
- name: Verify all required jobs succeeded
env:
CHANGES_RESULT: ${{ needs.changes.result }}
CI_RESULT: ${{ needs.ci.result }}
E2E_RESULT: ${{ needs.e2e.result }}
E2E_SKIPPABLE: ${{ github.event_name == 'pull_request' && needs.changes.outputs.code != 'true' }}
run: |
set -euo pipefail
if [ "${{ needs.ci.result }}" != "success" ] || [ "${{ needs.e2e.result }}" != "success" ]; then
echo "ci=${{ needs.ci.result }} e2e=${{ needs.e2e.result }}"
echo "changes=$CHANGES_RESULT ci=$CI_RESULT e2e=$E2E_RESULT e2e_skippable=$E2E_SKIPPABLE"
if [ "$CHANGES_RESULT" != "success" ] || [ "$CI_RESULT" != "success" ]; then
exit 1
fi
# e2e may only be skipped when the PR touches docs alone
if [ "$E2E_RESULT" != "success" ] && ! { [ "$E2E_RESULT" = "skipped" ] && [ "$E2E_SKIPPABLE" = "true" ]; }; then
exit 1
fi

Expand Down
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm exec lint-staged
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,10 @@ and commit your changes.

This project is designed to work both with and without Docker. Please don't
break this!

## Pre-commit hook

`pnpm install` sets up a git pre-commit hook (husky + lint-staged) that runs
`eslint --fix` and `prettier --write` on the files you have staged. Type
checking and tests still run in CI. Skip the hook with `git commit --no-verify`
if you need to.
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"lib": "pnpm --filter @app/lib",
"server": "pnpm --filter @app/server",
"worker": "pnpm --filter @app/worker",
"postinstall": "npx next telemetry disable"
"postinstall": "npx next telemetry disable",
"prepare": "husky || true"
},
"packageManager": "pnpm@10.34.5",
"author": "Prodeko webbitiimi <cto@prodeko.org>",
Expand Down Expand Up @@ -78,9 +79,11 @@
"globals": "^15.14.0",
"graphql": "^16.5.0",
"graphql-config": "^4.3.3",
"husky": "^9.1.7",
"inquirer": "^9.1.0",
"jest": "^29.7.0",
"json-sort-cli": "^2.0.15",
"lint-staged": "^17.6.0",
"nodemon": "^2.0.19",
"npm-check-updates": "^16.0.5",
"prettier": "3.4.2",
Expand All @@ -92,6 +95,13 @@
"type-fest": "^2.18.0",
"typescript": "5.7.3"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"eslint --fix --no-warn-ignored",
"prettier --write"
],
"*.{graphql,md}": "prettier --write"
},
"pnpm": {
"overrides": {
"dayjs": "^1.11.20",
Expand Down
62 changes: 59 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading