Skip to content

Commit

Permalink
refactor: update workflows and repository to use Bun (#241)
Browse files Browse the repository at this point in the history
* ci(test): test bun as setup packager in e2e

* ci(test): use bun in e2e tests to create projects

* ci(test): move `node` and `bun` to dedicated environment action

* ci(test): prevent installing bun on windows

* ci(test): simplify matrix setup

* ci: update other workflows to use bun

* ci: fully move over to bun

* refactor: upgrade eslint and prettier packages

* fix: resolve all linting issues

* fix: add `sqlite3` as trusted dependency

* chore: rebuild files

* chore: upgrade typescript to `5.3.2`

* docs: add `bun` as `packager` option to readme

This is now tested in our e2e tests as well, and seems to work nicely

* chore: update build script and built files

* ci(test): update matrix to ignore cache on windows
  • Loading branch information
byCedric authored Nov 24, 2023
1 parent 57dcabe commit 7f1c170
Show file tree
Hide file tree
Showing 30 changed files with 424,489 additions and 309,332 deletions.
25 changes: 25 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Setup Runtime
description: Prepare Runtime in GitHub Actions

inputs:
bun-version:
description: Version of Bun to use
default: latest # TODO(cedric): replace with fixed major version after fixing https://github.com/oven-sh/setup-bun/issues/37

node-version:
description: Version of Node to use
default: 18.x

runs:
using: composite
steps:
- name: 🏗 Setup Bun
if: ${{ runner.os != 'Windows' }}
uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ inputs.bun-version }}

- name: 🏗 Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
35 changes: 13 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

concurrency:
group: release
cancel-in-progress: true
cancel-in-progress: false

jobs:
dryrun:
Expand All @@ -21,17 +21,14 @@ jobs:
- name: 🏗 Setup repo
uses: actions/checkout@v4

- name: 🏗 Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: yarn
- name: 🏗 Setup runner
uses: ./.github/actions/setup

- name: 📦 Install dependencies
run: yarn install --frozen-lockfile
run: bun install

- name: 📋 Dry-running release
run: yarn semantic-release --dry-run
run: bun semantic-release --dry-run
env:
GITHUB_TOKEN: ${{ github.token }}

Expand All @@ -42,17 +39,14 @@ jobs:
- name: 🏗 Setup repo
uses: actions/checkout@v4

- name: 🏗 Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: yarn
- name: 🏗 Setup runner
uses: ./.github/actions/setup

- name: 📦 Install dependencies
run: yarn install --frozen-lockfile
run: bun install

- name: 📋 Release code
run: yarn semantic-release
run: bun semantic-release
env:
GITHUB_TOKEN: ${{ secrets.EXPOBOT_GITHUB_TOKEN }}
GIT_AUTHOR_NAME: Expo CI
Expand All @@ -69,20 +63,17 @@ jobs:
with:
token: ${{ secrets.EXPOBOT_GITHUB_TOKEN }}

- name: 🏗 Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: yarn
- name: 🏗 Setup runner
uses: ./.github/actions/setup

- name: 👷 Force repo to latest
run: git fetch --all && git pull

- name: 📦 Install dependencies
run: yarn install --frozen-lockfile
run: bun install

- name: 📦 Install semver
run: yarn add --dev semver
run: bun add --dev semver

- name: 🕵️ Resolve major version
uses: actions/github-script@v7
Expand Down
22 changes: 8 additions & 14 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,37 @@ on:
types: [opened, synchronize]

concurrency:
group: review-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
strategy:
matrix:
node: [18.x]
runs-on: ubuntu-latest
steps:
- name: 🏗 Setup repo
uses: actions/checkout@v4

- name: 🏗 Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: yarn
- name: 🏗 Setup runner
uses: ./.github/actions/setup

- name: 📦 Install dependencies
run: yarn install --frozen-lockfile --check-files
run: bun install

- name: ✅ Lint code
run: yarn lint --max-warnings=0
run: bun run lint --max-warnings=0

- name: 🧪 Test code
run: yarn test
run: bun run test

- name: 👷 Build code
run: yarn clean && yarn build
run: bun run clean && bun run build

- name: 🕵️ Validate build
id: diff
run: |
if [ "$(git diff --ignore-space-at-eol build/ | wc -l)" -gt "0" ]; then
echo "⚠️ Build is outdated"
echo " > run 'yarn clean', 'yarn build', and commit changes"
echo " > run 'bun run clean', 'bun run build', and commit changes"
git diff
exit 1
fi
Expand Down
51 changes: 25 additions & 26 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
workflow_dispatch:

concurrency:
group: test-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true

env:
Expand All @@ -20,30 +20,27 @@ jobs:
setup:
strategy:
matrix:
os:
- ubuntu
- windows
- macos
cache:
- cache
- no-cache
packager:
- yarn
include:
- os: ubuntu
cache: no-cache
packager: npm
- os: windows
cache: no-cache
packager: npm
os: [ubuntu, windows, macos]
cache: [cache, no-cache]
packager: [bun, npm, yarn]
exclude:
# Mac can't unpack caches that fast
- os: macos
cache: no-cache
packager: npm
cache: cache
# Windows can't unpack caches that fast
- os: windows
cache: cache
# Bun isn't supported on Windows (yet)
- os: windows
packager: bun
runs-on: ${{ matrix.os }}-latest
steps:
- name: 🏗 Setup repo
uses: actions/checkout@v4

- name: 🏗 Setup runner
uses: ./.github/actions/setup

- name: 🏗 Setup Expo
uses: ./
with:
Expand Down Expand Up @@ -74,20 +71,18 @@ jobs:
- name: 🏗 Setup repo
uses: actions/checkout@v4

- name: 🏗 Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: yarn
- name: 🏗 Setup runner
uses: ./.github/actions/setup

- name: 🏗 Setup EAS
uses: ./
with:
eas-version: latest
packager: bun
token: ${{ secrets.EXPO_TOKEN }}

- name: 🏗 Setup project
run: yarn create expo-app ./temp
run: bun create expo ./temp --template blank

- name: 👷 Configure project
working-directory: ./temp
Expand Down Expand Up @@ -175,15 +170,19 @@ jobs:
- name: 🏗 Setup repo
uses: actions/checkout@v4

- name: 🏗 Setup runner
uses: ./.github/actions/setup

- name: 🏗 Setup Expo
uses: ./
with:
eas-version: latest
expo-version: latest
packager: bun
token: ${{ secrets.EXPO_TOKEN }}

- name: 🏗 Setup project
run: expo init -t blank ./temp
run: bun create expo ./temp --template blank

- name: 🧪 Without commenting
if: ${{ env.hasAuth == 'true' }}
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
# Node
node_modules
npm-debug.log
yarn-error.log
package-lock.json
yarn-error.log
yarn.lock

# Ruby
.direnv
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Here is a summary of all the input options you can use.
| **expo-cache** | `true` | If it should use the GitHub actions cache ([read more](#using-the-built-in-cache)) |
| **eas-version** | - | EAS CLI version to install _(skips when omitted)_ |
| **eas-cache** | `true` | If it should use the GitHub actions cache ([read more](#using-the-built-in-cache)) |
| **packager** | `yarn` | Package manager to use _(e.g. `yarn` or `npm`)_ |
| **packager** | `yarn` | Package manager to use _(e.g. `bun`, `yarn`, or `npm`)_ |
| **token** | - | Token of your Expo account - [get your token][link-expo-token] _(use with [secrets][link-actions-secrets])_ |
| **patch-watchers** | `true` | If it should patch the `fs.inotify.*` limits on Ubuntu ([read more](#enospc-errors-on-linux)) |

Expand Down
Loading

0 comments on commit 7f1c170

Please sign in to comment.