From 8c06ee1759442d441e9d014da6264f7701b7db00 Mon Sep 17 00:00:00 2001 From: James Acklin Date: Fri, 27 Sep 2024 12:43:51 -0700 Subject: [PATCH] Revert "remove local git + postinstall hooks (#3957)" This reverts commit 2c5d73c34d519e31504f59a418de73b15d85d5e7. --- .github/workflows/ci.yml | 3 -- .github/workflows/deploy-canary.yml | 2 - .github/workflows/deploy-ephemeral.yml | 61 ++++++++++++-------------- .github/workflows/deploy.yml | 2 - .github/workflows/mobile-build.yml | 2 - .github/workflows/mobile-update.yml | 14 ++---- .husky/pre-commit | 4 ++ .husky/pre-push | 2 + package.json | 3 ++ pnpm-lock.yaml | 12 ++++- 10 files changed, 52 insertions(+), 53 deletions(-) create mode 100755 .husky/pre-commit create mode 100644 .husky/pre-push diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1b095bd36..9c4535f61e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,9 +19,6 @@ jobs: - recursive: true args: [--frozen-lockfile] - - name: Build packages - run: pnpm build:all - - name: Run Lint run: pnpm -r lint diff --git a/.github/workflows/deploy-canary.yml b/.github/workflows/deploy-canary.yml index 07cb4e315f..290f64d8ca 100644 --- a/.github/workflows/deploy-canary.yml +++ b/.github/workflows/deploy-canary.yml @@ -29,8 +29,6 @@ jobs: run_install: | - recursive: true args: [--frozen-lockfile] - - name: Build packages - run: pnpm build:all - working-directory: ./apps/tlon-web run: pnpm build - uses: actions/upload-artifact@v3 diff --git a/.github/workflows/deploy-ephemeral.yml b/.github/workflows/deploy-ephemeral.yml index be00b5998d..9f98d11ac0 100644 --- a/.github/workflows/deploy-ephemeral.yml +++ b/.github/workflows/deploy-ephemeral.yml @@ -2,14 +2,14 @@ name: Deploy Groups (ephemeral) on: push: branches: - - "do/ephemeral-moons" + - 'do/ephemeral-moons' #pull_request: jobs: build-frontend: runs-on: ubuntu-latest - name: "Build Frontend" + name: 'Build Frontend' steps: - name: Checkout uses: actions/checkout@v4 @@ -26,39 +26,37 @@ jobs: - recursive: true args: [--frozen-lockfile] - - name: Build packages - run: pnpm build:all - - working-directory: ./apps/tlon-web - run: pnpm build + run: + pnpm build - uses: actions/upload-artifact@v4 with: - name: "ui-dist" - path: apps/tlon-web/dist + name: 'ui-dist' + path: apps/tlon-web/dist glob: runs-on: ubuntu-latest - name: "Make a glob" + name: 'Make a glob' needs: build-frontend steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 with: - name: "ui-dist" + name: 'ui-dist' path: apps/tlon-web/dist - - id: "auth" - uses: "google-github-actions/auth@v1" + - id: 'auth' + uses: 'google-github-actions/auth@v1' with: - credentials_json: "${{ secrets.GCP_SERVICE_KEY }}" - - name: "Set up Cloud SDK" - uses: "google-github-actions/setup-gcloud@v1" - - name: "glob" + credentials_json: '${{ secrets.GCP_SERVICE_KEY }}' + - name: 'Set up Cloud SDK' + uses: 'google-github-actions/setup-gcloud@v1' + - name: 'glob' uses: ./.github/actions/glob with: - folder: "apps/tlon-web/dist/*" - docket: "desk/desk.docket-0" + folder: 'apps/tlon-web/dist/*' + docket: 'desk/desk.docket-0' - name: Commit and Push Glob run: | git config --global user.name github-actions @@ -76,12 +74,12 @@ jobs: needs: glob steps: - uses: actions/checkout@v4 - - id: "auth" - uses: "google-github-actions/auth@v1" + - id: 'auth' + uses: 'google-github-actions/auth@v1' with: - credentials_json: "${{ secrets.GCP_SERVICE_KEY }}" - - name: "Set up Cloud SDK" - uses: "google-github-actions/setup-gcloud@v1" + credentials_json: '${{ secrets.GCP_SERVICE_KEY }}' + - name: 'Set up Cloud SDK' + uses: 'google-github-actions/setup-gcloud@v1' - id: create_moon name: Create Moon run: | @@ -90,25 +88,24 @@ jobs: SSH_SEC_KEY: ${{ secrets.GCP_SSH_SEC_KEY }} SSH_PUB_KEY: ${{ secrets.GCP_SSH_PUB_KEY }} + deploy: needs: create_moon runs-on: ubuntu-latest name: "Release to ~binnec-dozzod-marnus (canary)" steps: - uses: actions/checkout@v4 - - id: "auth" - uses: "google-github-actions/auth@v1" + - id: 'auth' + uses: 'google-github-actions/auth@v1' with: - credentials_json: "${{ secrets.GCP_SERVICE_KEY }}" - - name: "Set up Cloud SDK" - uses: "google-github-actions/setup-gcloud@v1" + credentials_json: '${{ secrets.GCP_SERVICE_KEY }}' + - name: 'Set up Cloud SDK' + uses: 'google-github-actions/setup-gcloud@v1' - id: deploy name: Deploy run: - ./.github/helpers/deploy.sh tloncorp/tlon-apps groups ${{ - needs.build_test_images.outputs.moon_name }} us-central1-a - mainnet-tlon-other-2d + ./.github/helpers/deploy.sh tloncorp/tlon-apps groups ${{ needs.build_test_images.outputs.moon_name }} us-central1-a mainnet-tlon-other-2d env: SSH_SEC_KEY: ${{ secrets.GCP_SSH_SEC_KEY }} SSH_PUB_KEY: ${{ secrets.GCP_SSH_PUB_KEY }} - URBIT_REPO_TAG: ${{ vars.URBIT_REPO_TAG }} + URBIT_REPO_TAG: ${{ vars.URBIT_REPO_TAG }} \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 805cc66113..d2801ee227 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -33,8 +33,6 @@ jobs: run_install: | - recursive: true args: [--frozen-lockfile] - - name: Build packages - run: pnpm build:all - working-directory: ./apps/tlon-web run: pnpm build - uses: actions/upload-artifact@v3 diff --git a/.github/workflows/mobile-build.yml b/.github/workflows/mobile-build.yml index a6091ac4c3..b9ef62a811 100644 --- a/.github/workflows/mobile-build.yml +++ b/.github/workflows/mobile-build.yml @@ -35,8 +35,6 @@ jobs: uses: pnpm/action-setup@v3 - name: Install dependencies run: pnpm install --frozen-lockfile - - name: Build packages - run: pnpm build:all - name: Create build vars id: vars run: | diff --git a/.github/workflows/mobile-update.yml b/.github/workflows/mobile-update.yml index e48097dc37..704a7add61 100644 --- a/.github/workflows/mobile-update.yml +++ b/.github/workflows/mobile-update.yml @@ -33,21 +33,13 @@ jobs: token: ${{ secrets.EXPO_TOKEN }} - name: Install dependencies run: pnpm install - - name: Build packages - run: pnpm build:all - name: Create build vars id: vars run: | echo "profile=${{ inputs.profile || 'preview' }}" >> $GITHUB_OUTPUT - name: Push update for selected platforms working-directory: ./apps/tlon-mobile - run: - eas update --auto --profile ${{ steps.vars.outputs.profile }} - --platform ${{ inputs.platform || 'all' }} --non-interactive + run: eas update --auto --profile ${{ steps.vars.outputs.profile }} --platform ${{ inputs.platform || 'all' }} --non-interactive env: - NOTIFY_PROVIDER: - "${{ steps.vars.outputs.profile == 'preview' && - 'binnec-dozzod-marnus' || 'rivfur-livmet' }}" - NOTIFY_SERVICE: - "${{ steps.vars.outputs.profile == 'preview' && - 'tlon-preview-release' || 'groups-native' }}" + NOTIFY_PROVIDER: "${{ steps.vars.outputs.profile == 'preview' && 'binnec-dozzod-marnus' || 'rivfur-livmet' }}" + NOTIFY_SERVICE: "${{ steps.vars.outputs.profile == 'preview' && 'tlon-preview-release' || 'groups-native' }}" diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000000..3abfb0062a --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +git add ./apps/tlon-web/src/\*.snap + +pnpm exec lint-staged diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100644 index 0000000000..6d908db9f7 --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1,2 @@ +pnpm test +pnpm -r tsc diff --git a/package.json b/package.json index 6566d07a81..15d5da947d 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,8 @@ "dev:ios": "concurrently \"pnpm run dev:shared\" \"pnpm --filter 'tlon-mobile' dev\" \"pnpm --filter 'tlon-mobile' ios\" \"pnpm --filter '@tloncorp/ui' watch\"", "dev:web": "concurrently \"pnpm run dev:shared\" \"pnpm --filter 'tlon-web' dev-no-ssl\"", "test": "pnpm run -r test run -u", + "prepare": "husky", + "postinstall": "pnpm run build:all", "lint:all": "pnpm -r lint" }, "dependencies": { @@ -29,6 +31,7 @@ "eslint": "8.57.0", "eslint-plugin-react": "^7.34.1", "eslint-plugin-react-hooks": "^4.6.0", + "husky": "^9.0.10", "lint-staged": "^15.0.0", "tsup": "^8.0.1", "vitest": "^1.2.2" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 46cdb1febb..0ab90bf07b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -87,6 +87,9 @@ importers: eslint-plugin-react-hooks: specifier: ^4.6.0 version: 4.6.0(eslint@8.57.0) + husky: + specifier: ^9.0.10 + version: 9.0.10 lint-staged: specifier: ^15.0.0 version: 15.2.0 @@ -3891,7 +3894,7 @@ packages: react: '>=16.x.x' react-native: '>=0.62.x' react-native-gesture-handler: '>=2.x.x' - react-native-reanimated: 3.10.1 + react-native-reanimated: '>=2.x.x' '@microsoft/applicationinsights-web-snippet@1.1.2': resolution: {integrity: sha512-qPoOk3MmEx3gS6hTc1/x8JWQG5g4BvRdH7iqZMENBsKCL927b7D7Mvl19bh3sW9Ucrg1fVrF+4hqShwQNdqLxQ==} @@ -8806,6 +8809,11 @@ packages: resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==} engines: {node: '>=16.17.0'} + husky@9.0.10: + resolution: {integrity: sha512-TQGNknoiy6bURzIO77pPRu+XHi6zI7T93rX+QnJsoYFf3xdjKOur+IlfqzJGMHIK/wXrLg+GsvMs8Op7vI2jVA==} + engines: {node: '>=18'} + hasBin: true + hyphenate-style-name@1.0.4: resolution: {integrity: sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ==} @@ -22707,6 +22715,8 @@ snapshots: human-signals@5.0.0: {} + husky@9.0.10: {} + hyphenate-style-name@1.0.4: {} iconv-lite@0.4.24: