Skip to content

Commit

Permalink
ci: add validation GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
gsong committed Aug 20, 2024
1 parent 8ab85fa commit a13c9f3
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .github/.lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
"*.js": ["eslint --no-ignore --fix", "prettier --write"],
"!(*dependabot).y?(a)ml": (filenames) =>
filenames.flatMap((filename) => [
`action-validator ${filename}`,
`prettier --write ${filename}`,
]),
};
25 changes: 25 additions & 0 deletions .github/actions/validate-setup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Setup for validate workflow
description: Reusable steps for validation jobs
runs:
using: composite
steps:
- uses: actions/setup-node@v4
with:
node-version: lts/iron
- uses: pnpm/action-setup@v4

- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: |
pnpm i --frozen-lockfile
shell: bash
10 changes: 10 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
33 changes: 33 additions & 0 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Validate pushes to main and all PRs
on:
push:
branches: [main]
pull_request:
types: [opened, ready_for_review, reopened, synchronize]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
validate:
timeout-minutes: 10
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/validate-setup
- name: Setup e2e tests
run: pnpm --filter=remix-testing-lab exec playwright install --with-deps

- name: Validate project
run: pnpm exec turbo run build lint typecheck e2e --no-cache

- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: remix-testing-lab/playwright-report/
retention-days: 30
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"prepare": "is-ci || husky"
},
"devDependencies": {
"@action-validator/cli": "^0.6.0",
"@action-validator/core": "^0.6.0",
"@eslint/compat": "^1.1.1",
"@types/eslint-plugin-jsx-a11y": "^6.9.0",
"@types/is-ci": "^3.0.4",
Expand Down
28 changes: 28 additions & 0 deletions pnpm-lock.yaml

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

1 change: 0 additions & 1 deletion turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
},

"e2e": { "dependsOn": ["build"] },
"test": { "dependsOn": ["^build"] },

"lint": { "dependsOn": ["^build", "topo"] },
"typecheck": { "dependsOn": ["^build", "topo"] },
Expand Down

0 comments on commit a13c9f3

Please sign in to comment.