Skip to content

Commit

Permalink
bun & gha
Browse files Browse the repository at this point in the history
  • Loading branch information
boorad committed Aug 11, 2024
1 parent a3445e9 commit 94ca033
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 209 deletions.
28 changes: 7 additions & 21 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.1.21

- name: Setup JDK
uses: actions/setup-java@v4
with:
Expand All @@ -35,27 +39,9 @@ jobs:
- name: Setup Android SDK
uses: android-actions/setup-android@v3

- uses: actions/setup-node@v4
with:
node-version: 20
- run: corepack enable

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- name: Restore node_modules from cache
uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install node_modules
run: yarn install --frozen-lockfile
- name: Install node_modules for example/
run: yarn install --frozen-lockfile --cwd example
- name: Bootstrap JS
run: |
bun install_tsc
- name: Restore Gradle cache
uses: actions/cache@v4
Expand Down
28 changes: 11 additions & 17 deletions .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,9 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Restore node_modules from cache
uses: actions/cache@v4
id: yarn-cache
- uses: oven-sh/setup-bun@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install node_modules for example/
run: yarn install --frozen-lockfile --cwd ..

# - name: Restore buildcache
# uses: mikehardy/buildcache-action@v2
# continue-on-error: true
bun-version: 1.1.21

- name: Setup Ruby (bundle)
uses: ruby/setup-ruby@v1
Expand All @@ -51,6 +37,10 @@ jobs:
bundler-cache: true
working-directory: example/ios

- name: Bootstrap JS
run: |
bun install_tsc
- name: Restore Pods cache
uses: actions/cache@v4
with:
Expand All @@ -61,13 +51,17 @@ jobs:
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install Gems
working-directory: example
run: bundle config set deployment 'true' && bundle install

- name: Install Pods
run: yarn pods
run: bun pods

- name: Install xcpretty
run: gem install xcpretty

- name: Build App
run: "set -o pipefail && xcodebuild \
CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \
Expand Down
68 changes: 0 additions & 68 deletions .github/workflows/release-publish.yml

This file was deleted.

46 changes: 12 additions & 34 deletions .github/workflows/validate-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ on:
- main
paths:
- '.github/workflows/validate-android.yml'
- 'android/**'
- 'packages/react-native-quick-crypto/android/**'
- '.editorconfig'
pull_request:
paths:
- '.github/workflows/validate-android.yml'
- 'android/**'
- 'packages/react-native-quick-crypto/android/**'
- '.editorconfig'

jobs:
Expand All @@ -20,10 +20,14 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./android
working-directory: packages/react-native-quick-crypto/android
steps:
- uses: actions/checkout@v4

- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.1.21

- name: Setup JDK
uses: actions/setup-java@v4
with:
Expand All @@ -34,27 +38,9 @@ jobs:
- name: Setup Android SDK
uses: android-actions/setup-android@v3

- uses: actions/setup-node@v4
with:
node-version: 20
- run: corepack enable

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- name: Restore node_modules from cache
uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install node_modules
run: yarn install --frozen-lockfile --cwd ..
- name: Install node_modules for example/
run: yarn install --frozen-lockfile --cwd ../example
- name: Bootstrap JS
run: |
bun install_tsc
- name: Restore Gradle cache
uses: actions/cache@v4
Expand All @@ -67,19 +53,11 @@ jobs:
${{ runner.os }}-gradle-
- name: Run Gradle Lint
run: cd ../example/android && ./gradlew lint
run: cd ../../example/android && ./gradlew lint

- name: Parse Gradle Lint Report
uses: yutailang0119/action-android-lint@v4
with:
# ignore-warnings: true
report-path: example/android/app/build/reports/*.xml
# ktlint:
# name: Kotlin Lint
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Run KTLint
# uses: mrousavy/[email protected]
# with:
# github_token: ${{ secrets.github_token }}

12 changes: 7 additions & 5 deletions .github/workflows/validate-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ on:
- main
paths:
- '.github/workflows/validate-cpp.yml'
- 'cpp/**'
- 'android/src/main/cpp/**'
- 'packages/react-native-quick-crypto/android/src/main/cpp/**'
- 'packages/react-native-quick-crypto/cpp/**'
- 'packages/react-native-quick-crypto/nitrogen/generated/shared/c++/**'
pull_request:
paths:
- '.github/workflows/validate-cpp.yml'
- 'cpp/**'
- 'android/src/main/cpp/**'
- 'packages/react-native-quick-crypto/android/src/main/cpp/**'
- 'packages/react-native-quick-crypto/cpp/**'
- 'packages/react-native-quick-crypto/nitrogen/generated/shared/c++/**'

jobs:
validate_cpp:
Expand All @@ -25,7 +27,7 @@ jobs:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
flags: --linelength=230
targets: --recursive cpp android/src/main/cpp
targets: --recursive packages/react-native-quick-crypto/cpp packages/react-native-quick-crypto/android/src/main/cpp packages/react-native-quick-crypto/nitrogen/generated/shared/c++
filter: "-legal/copyright\
,-readability/todo\
,-build/namespaces\
Expand Down
70 changes: 13 additions & 57 deletions .github/workflows/validate-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,42 +35,20 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
- uses: oven-sh/setup-bun@v2
with:
node-version: 20
- run: corepack enable
bun-version: 1.1.21

- name: Install reviewdog
uses: reviewdog/action-setup@v1

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- name: Restore node_modules from cache
uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install node_modules
run: yarn install --frozen-lockfile

- name: Install node_modules (example/)
run: yarn install --frozen-lockfile --cwd example

- name: Run TypeScript # Reviewdog tsc errorformat: %f:%l:%c - error TS%n: %m
- name: Bootstrap JS
run: |
yarn typescript | reviewdog -name="tsc" -efm="%f(%l,%c): error TS%n: %m" -reporter="github-pr-review" -filter-mode="nofilter" -fail-on-error -tee
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
bun install_tsc
- name: Run TypeScript in example/ # Reviewdog tsc errorformat: %f:%l:%c - error TS%n: %m
- name: Run TypeScript # Reviewdog tsc errorformat: %f:%l:%c - error TS%n: %m
run: |
cd example && yarn typescript | reviewdog -name="tsc" -efm="%f(%l,%c): error TS%n: %m" -reporter="github-pr-review" -filter-mode="nofilter" -fail-on-error -tee && cd ..
bun tsc | reviewdog -name="tsc" -efm="%f(%l,%c): error TS%n: %m" -reporter="github-pr-review" -filter-mode="nofilter" -fail-on-error -tee
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -80,41 +58,19 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20
- run: corepack enable

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- name: Restore node_modules from cache
uses: actions/cache@v4
id: yarn-cache
- uses: oven-sh/setup-bun@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
bun-version: 1.1.21

- name: Install node_modules
run: yarn install --frozen-lockfile

- name: Install node_modules (example/)
run: yarn install --frozen-lockfile --cwd example
- name: Bootstrap JS
run: |
bun install_tsc
- name: Run ESLint
run: yarn lint -f @jamesacarr/github-actions
run: bun lint -f @jamesacarr/github-actions

- name: Run ESLint with auto-fix
run: yarn lint --fix

- name: Run ESLint in example/
run: cd example && yarn lint -f @jamesacarr/github-actions && cd ..

- name: Run ESLint in example/ with auto-fix
run: cd example && yarn lint --fix && cd ..
run: bun lint --fix

- name: Verify no files have changed after auto-fix
run: git diff --exit-code HEAD
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"react": "^18.3.1",
"react-native": "^0.74.5",
"react-native-bouncy-checkbox": "4.0.1",
"react-native-nitro-modules": "0.2.0",
"react-native-nitro-modules": "0.3.0",
"react-native-quick-base64": "2.1.2",
"react-native-quick-crypto": "workspace:^",
"react-native-safe-area-context": "4.10.8",
Expand Down
3 changes: 0 additions & 3 deletions example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"extends": "@react-native/typescript-config/tsconfig.json",
// "compilerOptions": {
// "module": "esnext",
// },
}
Loading

0 comments on commit 94ca033

Please sign in to comment.