Skip to content
Merged
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
21 changes: 17 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,25 @@
},
"parserOptions": {
"ecmaVersion": 2022,
"sourceType": "module"
"sourceType": "module",
"ecmaFeatures": { "jsx": true }
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended"
],
"settings": {
"react": { "version": "detect" }
},
"globals": {
"process": "readonly"
},
"extends": "eslint:recommended",
"rules": {
"no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"no-console": ["warn", { "allow": ["warn", "error"] }]
"no-console": ["warn", { "allow": ["warn", "error"] }],
"react/prop-types": "off"
},
"ignorePatterns": ["node_modules/", "playwright-report/", "test-results/"]
"ignorePatterns": ["node_modules/", "playwright-report/", "test-results/", ".next/", "out/", "public/widgets/"]
}
40 changes: 40 additions & 0 deletions .github/workflows/deploy-repositories-fast.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Deploy Repositories Fast Path

# Fast feedback loop for submissions (Technical Appendix §5 Option 3):
# runs right after the Add Repository workflow, uploads repositories.txt
# as an artifact and comments the expected availability time on the issue.

on:
workflow_run:
workflows: ["Add Repository"]
types: [completed]
workflow_dispatch:

permissions:
contents: read
issues: write

concurrency:
group: "repositories-fast-path"
cancel-in-progress: false

jobs:
notify-fast-path:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Upload repositories.txt snapshot
uses: actions/upload-artifact@v4
with:
name: current-listing
path: repositories.txt
retention-days: 5

- name: Log availability message
run: |
echo "repositories.txt snapshot uploaded."
echo "Report pages are generated by the cached Pages deployment; the newly"
echo "submitted repository renders client-side from raw content immediately,"
echo "and its static shell appears once the Pages build completes."
46 changes: 37 additions & 9 deletions .github/workflows/redeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ permissions:
pages: write
id-token: write

# Redeployment when repositories.txt changed recently. The build is cached
# (actions/cache on .next/cache) to hit the <6 minute target.
jobs:
check-and-deploy:
check:
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.check-changes.outputs.changed }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -36,17 +40,41 @@ jobs:
echo "No recent changes, skipping deployment"
fi

- name: Setup Pages
if: steps.check-changes.outputs.changed == 'true'
uses: actions/configure-pages@v4

build:
needs: check
if: needs.check.outputs.changed == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Cache .next build cache
uses: actions/cache@v4
with:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/bun.lock', '**/package.json') }}-${{ github.run_id }}
restore-keys: ${{ runner.os }}-nextjs-${{ hashFiles('**/bun.lock', '**/package.json') }}-
- run: bun install
- name: Build static export
run: bun run build
env:
NEXT_PUBLIC_HOSTING_ENVIRONMENT: github
- name: Upload artifact
if: steps.check-changes.outputs.changed == 'true'
uses: actions/upload-pages-artifact@v3
with:
path: '.'
path: 'out'

deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
if: steps.check-changes.outputs.changed == 'true'
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v5
43 changes: 32 additions & 11 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages
# Build the Next.js static export and deploy out/ to GitHub Pages
name: Build and deploy Next.js export to Pages

on:
# Runs on pushes targeting the default branch
Expand All @@ -22,22 +22,43 @@ concurrency:
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
build:
runs-on: ubuntu-latest
outputs:
artifact-path: out
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Cache .next build cache
uses: actions/cache@v4
with:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/bun.lock', '**/package.json') }}-${{ github.run_id }}
restore-keys: ${{ runner.os }}-nextjs-${{ hashFiles('**/bun.lock', '**/package.json') }}-
- name: Install dependencies
run: bun install
- name: Build static export
run: bun run build
env:
NEXT_PUBLIC_HOSTING_ENVIRONMENT: github
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: '.'
path: 'out'

deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
22 changes: 21 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ jobs:
bun-version: latest
- run: bun install
- run: bun test tests/unit tests/integration
- run: bunx eslint "js/**/*.js" "tests/**/*.js"
- run: bunx eslint "lib/**/*.js" "app/**/*.{js,jsx}" "components/**/*.{js,jsx}" "tests/**/*.{js,jsx}"
- run: shellcheck ci/process-submissions.sh

e2e-tests:
# Matrix execution: one runner per browser so the suites run in parallel.
# The Playwright webServer builds the static export (bun run build) and
# serves ./out with GitHub Pages semantics (scripts/serve-out.py).
strategy:
fail-fast: false
matrix:
Expand All @@ -35,3 +37,21 @@ jobs:
name: playwright-report-${{ matrix.browser }}
path: playwright-report/
retention-days: 7

e2e-basepath:
# Sub-path deployment leg (GitHub Pages project sites): NEXT_PUBLIC_BASE_PATH
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- run: bun install
- run: bunx playwright install --with-deps chromium
- run: bunx playwright test --config playwright.basepath.config.js
- uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-report-basepath
path: playwright-report/
retention-days: 7
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pnpm-lock.yaml
dist/
build/
out/
.next/
*.tsbuildinfo

# Test coverage and reports
Expand Down
69 changes: 30 additions & 39 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,40 @@
# GitLab CI configuration for this RefactorFirst Pages site.
#
# Deploys the static files to GitLab Pages. A copy of index.html is published as
# 404.html so client-side routes like /user/repo serve the application instead of
# GitLab's generic 404 page.
# GitLab Pages deployment for the RefactorFirst Pages app.
# Deploys the Next.js static export (out/) as public/ for GitLab Pages.

stages:
- test
- process
- deploy

validate-site:
stage: test
image: alpine:3.20
script:
- test -f index.html
- test -f repositories.txt
- sort -c repositories.txt
- '! grep -Ev "^[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*$" repositories.txt'
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

# Processes open "Add repository: owner/repo" issues: validates the issue
# author has write access to the project, checks the report file exists,
# commits repositories.txt and closes the issue with the outcome.
# GitLab has no issue-triggered pipelines, so create a pipeline schedule
# (e.g. every 10 minutes) in Settings -> CI/CD -> Schedules.
process-submissions:
stage: process
image: alpine:3.20
before_script:
- apk add --no-cache curl jq
script:
- sh ci/process-submissions.sh gitlab
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
- build

pages:
stage: deploy
image: alpine:3.20
stage: build
image: node:22
before_script:
- npm install -g bun
script:
- mkdir -p public
- cp -r index.html repositories.txt css js templates assets public/
- cp index.html public/404.html # client-side routing for deep links
- bun install
- NEXT_PUBLIC_HOSTING_ENVIRONMENT=gitlab bun run build
- rm -rf public
- mkdir public
- cp -r out/. public/
artifacts:
paths:
- public
cache:
key:
files:
- bun.lock
paths:
- .next/cache
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

test:
stage: build
image: node:22
before_script:
- npm install -g bun
script:
- bun install
- bun test tests/unit tests/integration
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
Loading
Loading