Skip to content
Draft
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
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.github
.editorconfig
**/node_modules
.turbo
**/node_modules
6 changes: 3 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ noble-ed25519.js
hpke-core.js

# Built
dist/
**/dist/
build/
out/
*.min.js
*.min.css
*.bundle.js
bundle.*.js
coverage/
.next/
.cache/
node_modules/
**/node_modules/

19 changes: 0 additions & 19 deletions .github/actions/build-check/action.yml

This file was deleted.

22 changes: 22 additions & 0 deletions .github/scripts/get-turbo-affected.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

BASE=$1
COMPARE=$2

# If there is no base to compare against, we return an everything filter
#
# This is a scenario for on: push workflow triggers where github.base_ref is empty
if [[ -z "$BASE" ]]; then
echo "*"
exit 0
fi

# Empty compare means the tip of the current branch
if [[ -z "$COMPARE" ]]; then
COMPARE="HEAD"
fi

# We return a turbo filter for affected packages between the two branches
#
# See https://turborepo.dev/docs/reference/run#--filter-string for more info
echo "...[$BASE...$COMPARE]"
157 changes: 7 additions & 150 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,154 +8,11 @@ on:
workflow_dispatch: # Allows manual invocation

jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
directory:
[
'auth',
'export',
'import',
'export-and-sign',
'oauth-origin',
'oauth-redirect',
'shared',
]

steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3

# https://github.com/actions/setup-node
- name: Install Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: ".nvmrc"
package-manager-cache: false

# Some frames (like import/export-and-sign) depend on code in ./shared.
# Ensure shared's dependencies (including bech32) are installed before running their tests.
- name: Install Dependencies for shared (for dependent frames)
if: ${{ matrix.directory == 'import' || matrix.directory == 'export-and-sign' }}
working-directory: ./shared
run: npm install

- name: Install Dependencies for ${{ matrix.directory }}
working-directory: ./${{ matrix.directory }}
run: npm install

- name: Check Provenance Attestations for ${{ matrix.directory }}
working-directory: ./${{ matrix.directory }}
run: npm audit signatures

- name: Run Tests for ${{ matrix.directory }}
working-directory: ./${{ matrix.directory }}
run: npm test

format:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
directory:
[
'auth',
'export',
'import',
'export-and-sign',
'oauth-origin',
'oauth-redirect',
'shared',
]

steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3

# https://github.com/actions/setup-node
- name: Install Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: ".nvmrc"
package-manager-cache: false

- name: Install Dependencies for ${{ matrix.directory }}
working-directory: ./${{ matrix.directory }}
run: npm install

- name: Run Prettier Check for ${{ matrix.directory }}
working-directory: ./${{ matrix.directory }}
run: npm run prettier:check
build:
name: Build
uses: ./.github/workflows/reusable-build.yml

lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
directory:
[
'auth',
'export',
'import',
'export-and-sign',
'oauth-origin',
'oauth-redirect',
'shared',
]

steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3

# https://github.com/actions/setup-node
- name: Install Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: ".nvmrc"
package-manager-cache: false

- name: Install Dependencies for ${{ matrix.directory }}
working-directory: ./${{ matrix.directory }}
run: npm install

- name: Run ESLint for ${{ matrix.directory }}
working-directory: ./${{ matrix.directory }}
run: npm run lint

build-check:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
directory:
[
'import',
'export-and-sign',
]

steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3

# https://github.com/actions/setup-node
- name: Install Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: ".nvmrc"
package-manager-cache: false

- name: Install Dependencies for shared
working-directory: ./shared
run: npm install

- name: Install Dependencies for ${{ matrix.directory }}
working-directory: ./${{ matrix.directory }}
run: npm install

- name: Build ${{ matrix.directory }}
working-directory: ./${{ matrix.directory }}
run: npm run build

- name: Check dist folder matches committed version
uses: ./.github/actions/build-check
tests:
name: Test
needs: build
uses: ./.github/workflows/reusable-test.yml
43 changes: 43 additions & 0 deletions .github/workflows/reusable-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build

on:
workflow_call:

env:
NODE_ENV: production

jobs:
build:
runs-on: 16-core-runner-fren-1

steps:
# https://github.com/actions/checkout
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3

# Install and cache JS toolchain and dependencies (node_modules)
- name: Setup JS
uses: ./.github/actions/js-setup

# Just to stay on the safe side
- name: Clean
run: pnpm clean

# Build task depends on lint & prettier:write
- name: Build
run: pnpm build

- name: Check formatting
run: pnpm prettier:check

- name: Ensure git is clean
run: |
if [ -z "$( git status --porcelain )" ]; then
echo "Git is clean!"
exit 0
else
echo "Git is dirty!"
git add -A
git --no-pager diff HEAD
exit 1
fi
37 changes: 37 additions & 0 deletions .github/workflows/reusable-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Test

on:
workflow_call:

env:
NODE_ENV: production

jobs:
test:
runs-on: ubuntu-latest
steps:
# https://github.com/actions/checkout
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 0 # We need the full history to be able to calculate the affected packages with turbo

# Install and cache JS toolchain and dependencies (node_modules)
- name: Setup JS
uses: ./.github/actions/js-setup

- name: Build
run: pnpm build

- name: Fetch base branch
if: ${{ github.base_ref }}
run: git fetch origin ${{ github.base_ref }}

- name: Test
run: |
BASE_REF=${{ github.base_ref && format('origin/{0}', github.base_ref) }}
FILTER=$(./.github/scripts/get-turbo-affected.sh "$BASE_REF" HEAD)

pnpm test --concurrency=1 --filter="$FILTER"
env:
NODE_ENV: development
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
node_modules
.rollup.cache
.turbo
.DS_Store

.env.*
Loading
Loading