Skip to content

Commit d4a3eee

Browse files
authored
chore: GH workflows, turbo and other chores (#1073)
* explicit prettierrc * turbo * format test * pull-request workflow * update actions * bump to yarn 4 * build script
1 parent 17e0e33 commit d4a3eee

File tree

16 files changed

+8133
-9863
lines changed

16 files changed

+8133
-9863
lines changed

Diff for: .github/actions/setup-project/action.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Setup project
2+
description: Install required tools
3+
inputs:
4+
node-version:
5+
required: false
6+
description: node version to install
7+
default: 20.10.0 # is already cached in Ubuntu 22.04 runner
8+
runs:
9+
using: composite
10+
steps:
11+
- name: Enable corepack
12+
shell: bash
13+
run: |
14+
corepack enable
15+
yarn --version
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: ${{ inputs.node-version }}
19+
cache: "yarn"

Diff for: .github/workflows/ci.yml renamed to .github/workflows/default-storage.yml

+37-66
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,35 @@
1-
name: CI
1+
name: Default storage
22
on:
33
push:
44
branches:
55
- main
66
pull_request:
77
jobs:
8-
format:
9-
name: Format
8+
changes:
9+
name: report changed files
1010
runs-on: ubuntu-latest
11+
outputs:
12+
changed: ${{ steps.filter.outputs.storage }}
1113
steps:
12-
- name: Checkout
13-
uses: actions/checkout@v3
14-
- name: Set up Node.js
15-
uses: actions/[email protected]
16-
with:
17-
node-version: 18.16.1
18-
cache: yarn
19-
- name: Install JS dependencies
20-
run: yarn
21-
- name: Format
22-
run: |
23-
yarn format
24-
git diff --exit-code
25-
review:
26-
name: Review
27-
runs-on: ubuntu-latest
28-
strategy:
29-
matrix:
30-
test-name: [lint, ts]
31-
workspace: [default-storage, api]
32-
steps:
33-
- name: Checkout
34-
uses: actions/checkout@v3
35-
- name: Set up Node.js
36-
uses: actions/[email protected]
14+
- uses: actions/checkout@v4
15+
- uses: dorny/paths-filter@v3
16+
id: filter
3717
with:
38-
node-version: 18.16.1
39-
cache: yarn
40-
- name: Install JS dependencies
41-
run: yarn
42-
- name: Run test ${{ matrix.test-name }}
43-
run: yarn test:${{ matrix.test-name }}
44-
working-directory: packages/${{ matrix.workspace }}
18+
token: ${{ secrets.GH_RELEASE_TOKEN }}
19+
filters: |
20+
storage:
21+
- 'packages/default-storage'
22+
4523
android:
4624
name: Android
25+
needs: changes
26+
if: ${{ needs.changes.outputs.changed == 'true' }}
4727
runs-on: ubuntu-22.04
4828
steps:
4929
- name: Checkout
50-
uses: actions/checkout@v3
51-
- name: Set up Node.js
52-
uses: actions/[email protected]
53-
with:
54-
node-version: 18.16.1
55-
cache: yarn
30+
uses: actions/checkout@v4
31+
- name: Setup project
32+
uses: ./.github/actions/setup-project
5633
- name: Install JS dependencies
5734
run: |
5835
yarn
@@ -69,21 +46,20 @@ jobs:
6946

7047
ios:
7148
name: iOS
49+
needs: changes
50+
if: ${{ needs.changes.outputs.changed == 'true' }}
7251
runs-on: macos-latest
7352
steps:
7453
- name: Checkout
75-
uses: actions/checkout@v3
54+
uses: actions/checkout@v4
55+
- name: Setup project
56+
uses: ./.github/actions/setup-project
7657
- name: Cache /.ccache
7758
uses: actions/cache@v3
7859
with:
7960
path: packages/default-storage/.ccache
8061
key: ccache-ios-${{ hashFiles('yarn.lock') }}
8162
restore-keys: ccache-ios-
82-
- name: Set up Node.js
83-
uses: actions/[email protected]
84-
with:
85-
node-version: 18.16.1
86-
cache: yarn
8763
- name: Install JS dependencies
8864
run: |
8965
yarn
@@ -102,21 +78,20 @@ jobs:
10278

10379
macos:
10480
name: macOS
81+
needs: changes
82+
if: ${{ needs.changes.outputs.changed == 'true' }}
10583
runs-on: macos-latest
10684
steps:
10785
- name: Checkout
108-
uses: actions/checkout@v3
86+
uses: actions/checkout@v4
87+
- name: Setup project
88+
uses: ./.github/actions/setup-project
10989
- name: Cache /.ccache
11090
uses: actions/cache@v3
11191
with:
11292
path: packages/default-storage/.ccache
11393
key: ccache-macos-${{ hashFiles('yarn.lock') }}
11494
restore-keys: ccache-macos-
115-
- name: Set up Node.js
116-
uses: actions/[email protected]
117-
with:
118-
node-version: 18.16.1
119-
cache: yarn
12095
- name: Install JS dependencies
12196
run: |
12297
yarn
@@ -140,19 +115,18 @@ jobs:
140115

141116
windows:
142117
name: Windows
118+
needs: changes
119+
if: ${{ needs.changes.outputs.changed == 'true' }}
143120
runs-on: windows-2022
144121
steps:
145122
- name: Set up MSBuild
146123
uses: microsoft/[email protected]
147124
- name: Setup VSTest.console.exe
148125
uses: darenm/[email protected]
149126
- name: Checkout
150-
uses: actions/checkout@v3
151-
- name: Set up Node.js
152-
uses: actions/[email protected]
153-
with:
154-
node-version: 18.16.1
155-
cache: yarn
127+
uses: actions/checkout@v4
128+
- name: Setup project
129+
uses: ./.github/actions/setup-project
156130
- name: Install JS dependencies
157131
run: |
158132
yarn
@@ -167,19 +141,16 @@ jobs:
167141

168142
release:
169143
name: Release
170-
needs: [format, review, android, ios, macos, windows]
144+
needs: [android, ios, macos, windows]
171145
if: github.event_name == 'push'
172146
runs-on: ubuntu-22.04
173147
steps:
174148
- name: Checkout
175-
uses: actions/checkout@v3
149+
uses: actions/checkout@v4
176150
with:
177151
persist-credentials: false
178-
- name: Set up Node.js
179-
uses: actions/[email protected]
180-
with:
181-
node-version: 18.16.1
182-
cache: yarn
152+
- name: Setup project
153+
uses: ./.github/actions/setup-project
183154
- name: Install JS dependencies
184155
run: |
185156
yarn

Diff for: .github/workflows/pull-request.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: PR review
2+
on:
3+
pull_request:
4+
jobs:
5+
code-quality:
6+
name: Code quality
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
test-name: [lint, ts, format]
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
- name: Setup project
15+
uses: ./.github/actions/setup-project
16+
- name: Install dependencies
17+
run: yarn
18+
- name: test ${{ matrix.test-name }}
19+
run: yarn test:${{ matrix.test-name }}

Diff for: .github/workflows/stale.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Mark stale issues and pull requests
1+
name: Stale issue
22
on:
33
schedule:
44
- cron: "30 1 * * *"

Diff for: .github/workflows/website-deployment.yml

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Website Deployment
1+
name: Website
22
on:
33
push:
44
branches:
@@ -13,12 +13,9 @@ jobs:
1313

1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@v3
17-
- name: Cache/restore dependencies
18-
uses: actions/cache@v3
19-
with:
20-
path: .yarn
21-
key: website-${{ hashFiles('yarn.lock') }}
16+
uses: actions/checkout@v4
17+
- name: Setup project
18+
uses: ./.github/actions/setup-project
2219
- name: Install dependencies
2320
run: yarn
2421
working-directory: ./packages/website

Diff for: .gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
.idea
33
.yarn
44
.gradle
5-
!.yarn/releases
65
node_modules/
76
npm-debug.log
87
yarn-error.log
@@ -31,3 +30,4 @@ local.properties
3130

3231
#workspaces
3332
/packages/*/lib
33+
.turbo

Diff for: .prettierrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"trailingComma": "es5"
3+
}

Diff for: .yarn/releases/yarn-3.4.1.cjs

-873
This file was deleted.

Diff for: .yarnrc.yml

+14-13
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
1+
enableGlobalCache: false
12
enableTelemetry: false
3+
nodeLinker: node-modules
4+
npmRegistryServer: "https://registry.npmjs.org"
25
logFilters:
3-
- code: YN0007 # X must be built because it never has been before or the last one failed
6+
- code: YN0007
47
level: discard
5-
- code: YN0008 # X must be rebuilt because its dependency tree changed
8+
- code: YN0008
69
level: discard
7-
- code: YN0013 # X can't be found in the cache and will be fetched from the remote registry
10+
- code: YN0013
811
level: discard
9-
nodeLinker: node-modules
10-
npmRegistryServer: "https://registry.npmjs.org"
12+
1113
packageExtensions:
1214
"@expo/cli@*":
1315
peerDependencies:
14-
"expo-modules-autolinking": "*"
15-
"babel-preset-expo@*":
16+
expo-modules-autolinking: "*"
17+
babel-preset-expo@*:
1618
peerDependencies:
17-
"@babel/core": "^7.0.0-0"
18-
"expo@*":
19+
"@babel/core": ^7.0.0-0
20+
expo-asset@*:
1921
peerDependencies:
20-
"@babel/core": "^7.0.0-0"
21-
"expo-asset@*":
22+
expo: "*"
23+
expo@*:
2224
peerDependencies:
23-
"expo": "*"
24-
yarnPath: .yarn/releases/yarn-3.4.1.cjs
25+
"@babel/core": ^7.0.0-0

Diff for: package.json

+10-2
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,24 @@
44
"workspaces": [
55
"packages/*"
66
],
7-
"packageManager": "[email protected]",
7+
"packageManager": "[email protected]",
8+
"engines": {
9+
"node": "v20.11.1"
10+
},
811
"scripts": {
12+
"build": "turbo run build",
913
"format": "concurrently 'yarn:format:*'",
1014
"format:c": "clang-format -i $(git ls-files '*.cpp' '*.h' '*.m' '*.mm') --style file:.config/.clang-format",
11-
"format:js": "prettier --write --loglevel error $(git ls-files '*.js' '*.json' '*.ts' '*.tsx' '*.yml' 'README.md')"
15+
"format:js": "prettier --write $(git ls-files '*.js' '*.json' '*.ts' '*.tsx' '*.yml' 'README.md')",
16+
"test:lint": "turbo run test:lint",
17+
"test:ts": "turbo run test:ts",
18+
"test:format": "prettier --check --loglevel warn $(git ls-files '*.js' '*.json' '*.ts' '*.tsx' '*.yml' 'README.md')"
1219
},
1320
"devDependencies": {
1421
"concurrently": "^8.2.2",
1522
"eslint": "^8.54.0",
1623
"prettier": "^2.8.8",
24+
"turbo": "^1.12.5",
1725
"typescript": "^5.3.0"
1826
},
1927
"resolutions": {

Diff for: packages/api/jest.config.js

-5
This file was deleted.

Diff for: packages/api/package.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
"prepack": "yarn build",
1818
"build": "bob build",
1919
"test:lint": "eslint $(git ls-files '*.js' '*.ts' '*.tsx')",
20-
"test:ts": "tsc --noEmit",
21-
"test:jest": "jest"
20+
"test:ts": "tsc --noEmit"
2221
},
2322
"keywords": [
2423
"react-native",
@@ -31,12 +30,9 @@
3130
"author": "Krzysztof Borowy <[email protected]>",
3231
"license": "MIT",
3332
"devDependencies": {
34-
"@types/jest": "29.5.4",
3533
"eslint": "^8.54.0",
36-
"jest": "29.5.0",
3734
"prettier": "^2.8.8",
3835
"react-native-builder-bob": "0.20.0",
39-
"ts-jest": "29.1.1",
4036
"typescript": "^5.3.0"
4137
},
4238
"react-native-builder-bob": {

Diff for: packages/api/tsconfig.json

-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
22
"extends": "../../.config/tsconfig.base.json",
3-
"compilerOptions": {
4-
"types": ["jest"]
5-
},
63
"include": ["example", "src"]
74
}

Diff for: packages/default-storage/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"directory": "packages/default-storage-backend"
3939
},
4040
"scripts": {
41-
"prepare": "bob build",
41+
"prepack": "yarn build",
42+
"build": "bob build",
4243
"start": "react-native start",
4344
"start:android": "react-native run-android",
4445
"start:ios": "react-native run-ios",

Diff for: turbo.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$schema": "https://turbo.build/schema.json",
3+
"pipeline": {
4+
"test:lint": {},
5+
"test:ts": {},
6+
"build": {
7+
"outputs": ["lib/**"]
8+
},
9+
"async-storage-website#build": {
10+
"outputs": ["build/**"]
11+
}
12+
}
13+
}

0 commit comments

Comments
 (0)