Skip to content
Closed
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
42 changes: 0 additions & 42 deletions .github/workflows/bootstrap.yml

This file was deleted.

110 changes: 84 additions & 26 deletions .github/workflows/cloudflare.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,106 @@
name: CI

on:
workflow_call:
push:
branches: [main, develop, release, yeet, private, beard, juice, gome, neo, arkeo, jib]
pull_request:
branches: [main, develop, release, yeet, private]

jobs:
static:
name: Static
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: OpenJDK
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '11'

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'

- name: Cache node_modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-node-

- name: Yarn Install
run: yarn install --immutable

- name: Commitlint PR Title
if: ${{ github.event_name == 'pull_request' }}
env:
TITLE: ${{ github.event.pull_request.title }}
run: printf '%s' "$TITLE" | npx commitlint

- name: Build Packages
run: yarn build:packages

- name: Cache ESLint
uses: actions/cache@v4
with:
path: .eslintcache
key: ${{ runner.os }}-eslint-${{ hashFiles('**/yarn.lock') }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-eslint-${{ hashFiles('**/yarn.lock') }}-
${{ runner.os }}-eslint-

- name: Cache TypeScript Build Info
uses: actions/cache@v4
with:
path: tsconfig.tsbuildinfo
key: ${{ runner.os }}-tsbuildinfo-${{ hashFiles('src/**/*.ts', 'src/**/*.tsx') }}
restore-keys: ${{ runner.os }}-tsbuildinfo-

- name: Lint, Type Check & Test
run: yarn concurrently "yarn lint" "yarn type-check" "yarn test"

deploy:
name: Deploy
if: contains(fromJSON('["develop", "release", "yeet", "main", "private", "beard", "juice", "gome", "neo", "arkeo", "jib"]'), github.event_name == 'pull_request' && github.head_ref || github.ref_name)
runs-on: ubuntu-latest
env:
# https://docs.github.com/en/actions/learn-github-actions/contexts#example-contents-of-the-github-context
PROJECT_NAME: web # cloudflare bug? our project name/alias is web-29e but wrangler wants just "web"
PROJECT_NAME: web
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
FLEEK_TOKEN: ${{ secrets.FLEEK_TOKEN }}
FLEEK_PROJECT_ID: ${{ secrets.FLEEK_PROJECT_ID }}
# https://github.com/actions/runner/issues/409#issuecomment-752775072
# Github Actions DSL expression fuckery to make a ternary
# syntax is if condition && true || false
# i.e. if it's a pull request, use the head ref, otherwise use the ref name
# so ultimately we only run this workflow against the whitelisted branches
if: contains(fromJSON('["develop", "release", "yeet", "main", "private", "beard", "juice", "gome", "neo", "arkeo", "jib"]'), github.event_name == 'pull_request' && github.head_ref || github.ref_name)
runs-on: ubuntu-latest
name: Build
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Fetch all history and tags for version extraction via git describe
fetch-depth: 0

- name: Setup Environment (PR)
if: ${{ github.event_name == 'pull_request' }}
# github actions run in the context of a special magical merge commit between the head of the PR
# and the base branch. this means that the commit hash is not the same as the head of the PR.
# we have to conditionally grab the head of the PR and truncate it to 7 characters.
# in a `pull_request`` event trigger, base_ref is target branch name, head_ref is current
run: |
echo "COMMIT_SHORT_HASH=`echo ${{ github.event.pull_request.head.sha }} | cut -c1-7`" >> ${GITHUB_ENV}
echo "CURRENT_BRANCH_NAME=${{ github.head_ref }}" >> ${GITHUB_ENV}
# in a `pull` event trigger, e.g. yoloing to develop or main, GITHUB_SHA is the head commit
# of the branch and we can use that directly.
# ref_name is the name of the branch, e.g. develop, main, etc.

- name: Setup Environment (Push)
if: ${{ github.event_name == 'push' }}
run: |
echo "COMMIT_SHORT_HASH=`echo ${GITHUB_SHA} | cut -c1-7`" >> ${GITHUB_ENV}
echo "CURRENT_BRANCH_NAME=${{ github.ref_name }}" >> ${GITHUB_ENV}

- name: Extract Version
run: |
# Get version from the closest git tag (e.g., "v1.977.0" -> "1.977.0")
# Tags are created by release-please when PRs are merged to main
# Fallback to commit hash if no tags exist
TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [[ "$TAG" =~ ^v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
echo "version=${BASH_REMATCH[1]}" >> ${GITHUB_ENV}
else
echo "version=${{ env.COMMIT_SHORT_HASH }}" >> ${GITHUB_ENV}
fi

- name: Determine Build Mode
run: |
if [[ "${{ github.ref_name }}" == "main" || "${{ github.ref_name }}" == "release" || "${{ github.head_ref }}" == "main" || "${{ github.head_ref }}" == "release" ]]; then
Expand All @@ -61,30 +110,39 @@ jobs:
else
echo "BUILD_MODE=development" >> ${GITHUB_ENV}
fi

- name: Debug GitHub Context
env: { CONTENT : "${{ toJson(github) }}" }
run: "echo $CONTENT"

- name: OpenJDK
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '11'

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'

- name: Cache node_modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-node-

- name: Yarn Install
run: yarn install --immutable

- name: Build Web
run: MODE=${{ env.BUILD_MODE }} DEPLOY=true VITE_VERSION=${{ env.version }} yarn build:web
# a poor mans extension of cloudflare/pages-action@1 https://github.com/cloudflare/pages-action/blob/main/src/index.ts
# passing more params directly to wrangler to control commit hash and message
# https://developers.cloudflare.com/workers/wrangler/commands/#publish-1

- name: Deploy
run: npx -y wrangler@2 pages publish build --project-name="${{ env.PROJECT_NAME }}" --branch="${{ env.CURRENT_BRANCH_NAME }}" --commit-hash="${{ env.COMMIT_SHORT_HASH }}" --commit-message="${{ env.CURRENT_BRANCH_NAME }}-${{ env.COMMIT_SHORT_HASH }}"
# deploy main branch to fleek.xyz alpha environment

- name: Deploy to Fleek
if: contains(fromJSON('["main"]'), github.event_name == 'pull_request' && github.head_ref || github.ref_name)
run: npm i -g @fleek-platform/cli && fleek sites deploy
57 changes: 0 additions & 57 deletions .github/workflows/pr.yml

This file was deleted.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@
"postinstall": "git config --local include.path '.gitconfig'",
"release": "yarn tsx ./scripts/release.ts",
"scrape-walletconnect-dapps": "yarn tsx ./scripts/scrapeWalletConnectRegistry.ts",
"test": "yarn test:packages && yarn test:web",
"test:web": "yarn vitest run -c vitest-web.config.mts && yarn vitest run -c vitest-side-effects.config.mts",
"test": "yarn concurrently \"yarn test:packages\" \"yarn test:web:main\" \"yarn test:web:side-effects\"",
"test:web": "yarn test:web:main && yarn test:web:side-effects",
"test:web:main": "yarn vitest run -c vitest-web.config.mts",
"test:web:side-effects": "yarn vitest run -c vitest-side-effects.config.mts",
"test:packages": "yarn vitest run -c vitest-packages.config.mts",
"translations:count-words-invalidate-since": "yarn tsx ./scripts/translations/countWordsInvalidateSince.ts",
"translations:update-path": "yarn tsx ./scripts/translations/updateTranslationPath.ts",
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"lib": ["dom", "dom.iterable", "esnext"],
"types": ["vite/client"],
"skipLibCheck": true,
"incremental": true,
"noEmit": true,

/* Type Checking */
Expand Down
8 changes: 0 additions & 8 deletions vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ export default defineConfig(() => {
test: {
setupFiles: ['src/setupVitest'],
clearMocks: true,
poolOptions: {
threads: {
singleThread: true,
},
forks: {
isolate: false,
},
},
},
}
})