From 5b9d8c24b988819846d7a1413a95d27bb70846b1 Mon Sep 17 00:00:00 2001 From: Timothy Miller Date: Sat, 28 Oct 2023 14:46:13 -0700 Subject: [PATCH] Migrated package install scripts in CI/CD to bun --- .github/actions/bun-install/action.yml | 86 -------------------------- .github/script/submit-android | 4 -- .github/workflows/backend.yml | 12 ++-- .github/workflows/docs.yml | 10 +-- .github/workflows/expo.yml | 10 +-- .github/workflows/next.yml | 10 +-- 6 files changed, 21 insertions(+), 111 deletions(-) delete mode 100644 .github/actions/bun-install/action.yml delete mode 100755 .github/script/submit-android diff --git a/.github/actions/bun-install/action.yml b/.github/actions/bun-install/action.yml deleted file mode 100644 index 471e599d1..000000000 --- a/.github/actions/bun-install/action.yml +++ /dev/null @@ -1,86 +0,0 @@ -######################################################################################## -# "bun install" composite action for bun 7/8+ # -#--------------------------------------------------------------------------------------# -# Requirement: @setup/node should be run before # -# # -# Usage in workflows steps: # -# # -# - name: 📥 Monorepo install # -# uses: ./.github/actions/bun-install # -# with: # -# enable-corepack: false # (default) # -# cwd: ${{ github.workspace }}/apps/my-app # (default = '.') # -# # -# Reference: # -# - latest: https://gist.github.com/belgattitude/838b2eba30c324f1f0033a797bab2e31 # -# # -# Versions: # -# - 1.1.0 - 15-07-2023 - Add project custom directory support. # -######################################################################################## - -name: 'bun install' -description: 'Run bun install with cache enabled' - -inputs: - enable-corepack: - description: 'Enable corepack' - required: false - default: 'false' - cwd: - description: "Changes node's process.cwd() if the project is not located on the root. Default to process.cwd()" - required: false - default: '.' - -runs: - using: 'composite' - - steps: - - name: ⚙️ Enable Corepack - if: ${{ inputs.enable-corepack == 'true' }} - shell: bash - working-directory: ${{ inputs.cwd }} - run: | - corepack enable - echo "corepack enabled" - - - uses: bun/action-setup@v2.2.4 - if: ${{ inputs.enable-corepack == 'false' }} - with: - run_install: false - # If you're not setting the packageManager field in package.json, add the version here - # version: 8.6.0 - - - name: Expose bun config(s) through "$GITHUB_OUTPUT" - id: bun-config - shell: bash - run: | - echo "STORE_PATH=$(bun store path)" >> $GITHUB_OUTPUT - - - name: Cache rotation keys - id: cache-rotation - shell: bash - run: | - echo "YEAR_MONTH=$(/bin/date -u "+%Y%m")" >> $GITHUB_OUTPUT - - - uses: actions/cache@v3 - name: Setup bun cache - with: - path: ${{ steps.bun-config.outputs.STORE_PATH }} - key: ${{ runner.os }}-bun-store-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}-${{ hashFiles('**/bun-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-bun-store-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}- - - # Prevent store to grow over time (not needed with yarn) - # Note: not perfect as it prune too much in monorepos so the idea - # is to use cache-rotation as above. In the future this might work better. - #- name: Prune bun store - # shell: bash - # run: bun prune store - - - name: Install dependencies - shell: bash - working-directory: ${{ inputs.cwd }} - run: bun install --frozen-lockfile --prefer-offline - env: - # Other environment variables - HUSKY: '0' # By default do not run HUSKY install diff --git a/.github/script/submit-android b/.github/script/submit-android deleted file mode 100755 index 402a4d329..000000000 --- a/.github/script/submit-android +++ /dev/null @@ -1,4 +0,0 @@ -cd apps/expo -eas build --platform android --profile production --local -export filename=$(find . -type f -name "*.aab" -print -quit) -eas submit --platform android --path $filename \ No newline at end of file diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml index 13fa5c54e..a20938e14 100644 --- a/.github/workflows/backend.yml +++ b/.github/workflows/backend.yml @@ -22,16 +22,16 @@ jobs: with: fetch-depth: 1 - - name: Setup Node.js environment - uses: actions/setup-node@v3 + - name: 'Bun setup' + uses: oven-sh/setup-bun@v1 with: - node-version: 18 + bun-version: latest - - name: 📥 Monorepo install - uses: ./.github/actions/bun-install + - name: 'Bun install' + run: bun install - name: Migrate database - run: bun --filter @t4/api migrate + run: cd packages/api && bun run migrate env: NO_D1_WARNING: true CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index f01f3d322..ff9cbe706 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -25,13 +25,13 @@ jobs: with: fetch-depth: 1 - - name: Setup Node.js environment - uses: actions/setup-node@v3 + - name: 'Bun setup' + uses: oven-sh/setup-bun@v1 with: - node-version: 18 + bun-version: latest - - name: 📥 Monorepo install - uses: ./.github/actions/bun-install + - name: 'Bun install' + run: bun install - name: Build run: | diff --git a/.github/workflows/expo.yml b/.github/workflows/expo.yml index 9e77f1974..33b88c797 100644 --- a/.github/workflows/expo.yml +++ b/.github/workflows/expo.yml @@ -26,13 +26,13 @@ jobs: with: fetch-depth: 1 - - name: Setup Node.js environment - uses: actions/setup-node@v3 + - name: 'Bun setup' + uses: oven-sh/setup-bun@v1 with: - node-version: 18 + bun-version: latest - - name: 📥 Monorepo install - uses: ./.github/actions/bun-install + - name: 'Bun install' + run: bun install - name: Setup EAS uses: expo/expo-github-action@v8 diff --git a/.github/workflows/next.yml b/.github/workflows/next.yml index 02e25bd5b..fecead9a8 100644 --- a/.github/workflows/next.yml +++ b/.github/workflows/next.yml @@ -27,13 +27,13 @@ jobs: with: fetch-depth: 1 - - name: Setup Node.js environment - uses: actions/setup-node@v3 + - name: 'Bun setup' + uses: oven-sh/setup-bun@v1 with: - node-version: 18 + bun-version: latest - - name: 📥 Monorepo install - uses: ./.github/actions/bun-install + - name: 'Bun install' + run: bun install - name: Build run: |