Skip to content

Commit

Permalink
chore(ci): clean workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysztofMoch committed Nov 10, 2023
1 parent cc7a67f commit 4615fec
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 38 deletions.
34 changes: 34 additions & 0 deletions .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Setup node_modules
description: Setup Node.js and install dependencies

inputs:
working-directory:
description: 'working directory for yarn install'
default: ./
required: false

runs:
using: composite
steps:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Cache dependencies
id: yarn-cache
uses: actions/cache@v3
with:
path: |
**/node_modules
.yarn/install-state.gz
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
${{ runner.os }}-yarn-
- name: Install dependencies
working-directory: ${{ inputs.working-directory }}
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --immutable --ignore-scripts
shell: bash

2 changes: 1 addition & 1 deletion .github/workflows/check-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
- uses: actions/upload-artifact@v3
with:
name: ktlint-report
path: ./android/build/*.xml
path: ./android/build/*.xml
10 changes: 7 additions & 3 deletions .github/workflows/check-clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ jobs:
- uses: actions/checkout@v4
- name: Install clang-format
run: sudo apt-get install clang-format
- name: Check formatting
- name: Check ios clang formatting
run: |
git diff --name-only --diff-filter=d origin/main...HEAD | grep -E '\.(h|m|mm)$' | xargs clang-format -i -style=file:./ios/.clang-format
git diff --exit-code HEAD
find ios -type f \( -name "*.h" -o -name "*.cpp" -o -name "*.m" -o -name "*.mm" \) -print0 | while read -d $'\0' file; do
clang-format -style=file:./ios/.clang-format -i "$file"
done
shell: bash
- name: Check for changes
run: git diff --exit-code HEAD
2 changes: 1 addition & 1 deletion .github/workflows/check-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ jobs:
run: swiftformat --verbose .

- name: Verify formatted code is unchanged
run: git diff --exit-code HEAD
run: git diff --exit-code HEAD
44 changes: 11 additions & 33 deletions .github/workflows/check-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,49 +30,27 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore node_modules from cache
uses: actions/cache@v3
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
uses: ./.github/actions/setup-node

- uses: EPMatt/reviewdog-action-tsc@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
level: warning
fail_on_error: true

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

- name: Check TypeScript
run: |
yarn 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 }}

JS-Lint:
name: Lint JS (eslint, prettier)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore node_modules from cache
uses: actions/cache@v3
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
uses: ./.github/actions/setup-node

- name: Run ESLint
run: yarn lint -f @jamesacarr/github-actions
Expand All @@ -81,4 +59,4 @@ jobs:
run: yarn lint --fix

- name: Verify no files have changed after auto-fix
run: git diff --exit-code HEAD
run: git diff --exit-code HEAD
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@types/react": "~18.0.0",
"@types/react-native": "0.72.3",
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@jamesacarr/eslint-formatter-github-actions": "^0.2.0",
"eslint": "^8.19.0",
"eslint-plugin-jest": "^27.4.2",
"jest": "^29.7.0",
Expand Down

0 comments on commit 4615fec

Please sign in to comment.