Skip to content

Commit

Permalink
chore: GH workflows, turbo and other chores (#1073)
Browse files Browse the repository at this point in the history
* explicit prettierrc

* turbo

* format test

* pull-request workflow

* update actions

* bump to yarn 4

* build script
  • Loading branch information
krizzu committed Apr 5, 2024
1 parent 17e0e33 commit d4a3eee
Show file tree
Hide file tree
Showing 16 changed files with 8,133 additions and 9,863 deletions.
19 changes: 19 additions & 0 deletions .github/actions/setup-project/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Setup project
description: Install required tools
inputs:
node-version:
required: false
description: node version to install
default: 20.10.0 # is already cached in Ubuntu 22.04 runner
runs:
using: composite
steps:
- name: Enable corepack
shell: bash
run: |
corepack enable
yarn --version
- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: "yarn"
103 changes: 37 additions & 66 deletions .github/workflows/ci.yml → .github/workflows/default-storage.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,35 @@
name: CI
name: Default storage
on:
push:
branches:
- main
pull_request:
jobs:
format:
name: Format
changes:
name: report changed files
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.filter.outputs.storage }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3.6.0
with:
node-version: 18.16.1
cache: yarn
- name: Install JS dependencies
run: yarn
- name: Format
run: |
yarn format
git diff --exit-code
review:
name: Review
runs-on: ubuntu-latest
strategy:
matrix:
test-name: [lint, ts]
workspace: [default-storage, api]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3.6.0
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
node-version: 18.16.1
cache: yarn
- name: Install JS dependencies
run: yarn
- name: Run test ${{ matrix.test-name }}
run: yarn test:${{ matrix.test-name }}
working-directory: packages/${{ matrix.workspace }}
token: ${{ secrets.GH_RELEASE_TOKEN }}
filters: |
storage:
- 'packages/default-storage'
android:
name: Android
needs: changes
if: ${{ needs.changes.outputs.changed == 'true' }}
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3.6.0
with:
node-version: 18.16.1
cache: yarn
uses: actions/checkout@v4
- name: Setup project
uses: ./.github/actions/setup-project
- name: Install JS dependencies
run: |
yarn
Expand All @@ -69,21 +46,20 @@ jobs:

ios:
name: iOS
needs: changes
if: ${{ needs.changes.outputs.changed == 'true' }}
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup project
uses: ./.github/actions/setup-project
- name: Cache /.ccache
uses: actions/cache@v3
with:
path: packages/default-storage/.ccache
key: ccache-ios-${{ hashFiles('yarn.lock') }}
restore-keys: ccache-ios-
- name: Set up Node.js
uses: actions/setup-node@v3.6.0
with:
node-version: 18.16.1
cache: yarn
- name: Install JS dependencies
run: |
yarn
Expand All @@ -102,21 +78,20 @@ jobs:

macos:
name: macOS
needs: changes
if: ${{ needs.changes.outputs.changed == 'true' }}
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup project
uses: ./.github/actions/setup-project
- name: Cache /.ccache
uses: actions/cache@v3
with:
path: packages/default-storage/.ccache
key: ccache-macos-${{ hashFiles('yarn.lock') }}
restore-keys: ccache-macos-
- name: Set up Node.js
uses: actions/setup-node@v3.6.0
with:
node-version: 18.16.1
cache: yarn
- name: Install JS dependencies
run: |
yarn
Expand All @@ -140,19 +115,18 @@ jobs:

windows:
name: Windows
needs: changes
if: ${{ needs.changes.outputs.changed == 'true' }}
runs-on: windows-2022
steps:
- name: Set up MSBuild
uses: microsoft/setup-msbuild@v1.3
- name: Setup VSTest.console.exe
uses: darenm/Setup-VSTest@v1.2
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3.6.0
with:
node-version: 18.16.1
cache: yarn
uses: actions/checkout@v4
- name: Setup project
uses: ./.github/actions/setup-project
- name: Install JS dependencies
run: |
yarn
Expand All @@ -167,19 +141,16 @@ jobs:

release:
name: Release
needs: [format, review, android, ios, macos, windows]
needs: [android, ios, macos, windows]
if: github.event_name == 'push'
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Node.js
uses: actions/setup-node@v3.6.0
with:
node-version: 18.16.1
cache: yarn
- name: Setup project
uses: ./.github/actions/setup-project
- name: Install JS dependencies
run: |
yarn
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: PR review
on:
pull_request:
jobs:
code-quality:
name: Code quality
runs-on: ubuntu-latest
strategy:
matrix:
test-name: [lint, ts, format]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup project
uses: ./.github/actions/setup-project
- name: Install dependencies
run: yarn
- name: test ${{ matrix.test-name }}
run: yarn test:${{ matrix.test-name }}
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Mark stale issues and pull requests
name: Stale issue
on:
schedule:
- cron: "30 1 * * *"
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/website-deployment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Website Deployment
name: Website
on:
push:
branches:
Expand All @@ -13,12 +13,9 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache/restore dependencies
uses: actions/cache@v3
with:
path: .yarn
key: website-${{ hashFiles('yarn.lock') }}
uses: actions/checkout@v4
- name: Setup project
uses: ./.github/actions/setup-project
- name: Install dependencies
run: yarn
working-directory: ./packages/website
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
.idea
.yarn
.gradle
!.yarn/releases
node_modules/
npm-debug.log
yarn-error.log
Expand Down Expand Up @@ -31,3 +30,4 @@ local.properties

#workspaces
/packages/*/lib
.turbo
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"trailingComma": "es5"
}
873 changes: 0 additions & 873 deletions .yarn/releases/yarn-3.4.1.cjs

This file was deleted.

27 changes: 14 additions & 13 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
enableGlobalCache: false
enableTelemetry: false
nodeLinker: node-modules
npmRegistryServer: "https://registry.npmjs.org"
logFilters:
- code: YN0007 # X must be built because it never has been before or the last one failed
- code: YN0007
level: discard
- code: YN0008 # X must be rebuilt because its dependency tree changed
- code: YN0008
level: discard
- code: YN0013 # X can't be found in the cache and will be fetched from the remote registry
- code: YN0013
level: discard
nodeLinker: node-modules
npmRegistryServer: "https://registry.npmjs.org"

packageExtensions:
"@expo/cli@*":
peerDependencies:
"expo-modules-autolinking": "*"
"babel-preset-expo@*":
expo-modules-autolinking: "*"
babel-preset-expo@*:
peerDependencies:
"@babel/core": "^7.0.0-0"
"expo@*":
"@babel/core": ^7.0.0-0
expo-asset@*:
peerDependencies:
"@babel/core": "^7.0.0-0"
"expo-asset@*":
expo: "*"
expo@*:
peerDependencies:
"expo": "*"
yarnPath: .yarn/releases/yarn-3.4.1.cjs
"@babel/core": ^7.0.0-0
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,24 @@
"workspaces": [
"packages/*"
],
"packageManager": "yarn@3.4.1",
"packageManager": "yarn@4.1.1",
"engines": {
"node": "v20.11.1"
},
"scripts": {
"build": "turbo run build",
"format": "concurrently 'yarn:format:*'",
"format:c": "clang-format -i $(git ls-files '*.cpp' '*.h' '*.m' '*.mm') --style file:.config/.clang-format",
"format:js": "prettier --write --loglevel error $(git ls-files '*.js' '*.json' '*.ts' '*.tsx' '*.yml' 'README.md')"
"format:js": "prettier --write $(git ls-files '*.js' '*.json' '*.ts' '*.tsx' '*.yml' 'README.md')",
"test:lint": "turbo run test:lint",
"test:ts": "turbo run test:ts",
"test:format": "prettier --check --loglevel warn $(git ls-files '*.js' '*.json' '*.ts' '*.tsx' '*.yml' 'README.md')"
},
"devDependencies": {
"concurrently": "^8.2.2",
"eslint": "^8.54.0",
"prettier": "^2.8.8",
"turbo": "^1.12.5",
"typescript": "^5.3.0"
},
"resolutions": {
Expand Down
5 changes: 0 additions & 5 deletions packages/api/jest.config.js

This file was deleted.

6 changes: 1 addition & 5 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"prepack": "yarn build",
"build": "bob build",
"test:lint": "eslint $(git ls-files '*.js' '*.ts' '*.tsx')",
"test:ts": "tsc --noEmit",
"test:jest": "jest"
"test:ts": "tsc --noEmit"
},
"keywords": [
"react-native",
Expand All @@ -31,12 +30,9 @@
"author": "Krzysztof Borowy <contact@kborowy.com>",
"license": "MIT",
"devDependencies": {
"@types/jest": "29.5.4",
"eslint": "^8.54.0",
"jest": "29.5.0",
"prettier": "^2.8.8",
"react-native-builder-bob": "0.20.0",
"ts-jest": "29.1.1",
"typescript": "^5.3.0"
},
"react-native-builder-bob": {
Expand Down
3 changes: 0 additions & 3 deletions packages/api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"extends": "../../.config/tsconfig.base.json",
"compilerOptions": {
"types": ["jest"]
},
"include": ["example", "src"]
}
3 changes: 2 additions & 1 deletion packages/default-storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"directory": "packages/default-storage-backend"
},
"scripts": {
"prepare": "bob build",
"prepack": "yarn build",
"build": "bob build",
"start": "react-native start",
"start:android": "react-native run-android",
"start:ios": "react-native run-ios",
Expand Down
13 changes: 13 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"test:lint": {},
"test:ts": {},
"build": {
"outputs": ["lib/**"]
},
"async-storage-website#build": {
"outputs": ["build/**"]
}
}
}

0 comments on commit d4a3eee

Please sign in to comment.