Skip to content

Commit

Permalink
➖ (chore) [DSDK-256]: Remove husky dependency (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
aussedatlo authored Apr 4, 2024
2 parents d1adf36 + 77ce8ef commit d100f8f
Show file tree
Hide file tree
Showing 12 changed files with 123 additions and 52 deletions.
27 changes: 27 additions & 0 deletions .github/actions/danger-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
set -e

is_running_on_github_actions() {
[ -n "$CI" ] && [ -n "$GITHUB_ACTIONS" ]
}

run_danger_on_github_actions() {
echo "Script is running within GitHub Actions workflow."
pnpm danger ci --dangerfile danger/dangerfile.ts --failOnErrors
}

run_danger_on_local() {
echo "Script is running locally."
pnpm danger pr --dangerfile danger/dangerfile.ts https://github.com/LedgerHQ/device-sdk-ts/pull/${1}
}

if is_running_on_github_actions; then
run_danger_on_github_actions
else
if [ -z "$1" ]; then
echo "Argument PR number is missing"
exit 1
fi
run_danger_on_local "$1"
fi

30 changes: 19 additions & 11 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,48 @@ concurrency:
cancel-in-progress: true

jobs:
auto-assign:
name: Auto assign
runs-on: [ubuntu-latest]
steps:
- uses: toshimaru/[email protected]

danger:
name: Pass Danger check
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v4

- uses: ./actions/setup-toolchain-composite

- uses: toshimaru/[email protected]
- uses: ./.github/actions/setup-toolchain-composite

- name: Danger
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Workaround when using custom runners
# https://github.com/danger/danger-js/issues/1374
DANGER_GITHUB_API_BASE_URL: "https://api.github.com"
run: pnpm danger ci --dangerfile danger/dangerfile.ts --failOnErrors
run: ./.github/actions/danger-check.sh

health-check:
name: Pass health check
needs: [danger]
runs-on: [device-sdk-4xlarge-linux]
steps:
- uses: actions/checkout@v4

- uses: ./actions/setup-toolchain-composite
- uses: ./.github/actions/setup-toolchain-composite

- name: Lint
run: pnpm lint
- name: health check
run: pnpm health-check

- name: Prettier
run: pnpm prettier
unit-tests:
name: Launch unit tests
needs: [danger]
runs-on: [device-sdk-4xlarge-linux]
steps:
- uses: actions/checkout@v4

- name: Typecheck
run: pnpm typecheck
- uses: ./.github/actions/setup-toolchain-composite

- name: Test
run: pnpm test:coverage -- --max-warnings=0
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./actions/setup-toolchain-composite

- uses: ./.github/actions/setup-toolchain-composite

- name: install dependencies
run: pnpm install

- name: create release pull request
uses: changesets/action@v1
with:
Expand Down
1 change: 0 additions & 1 deletion .husky/pre-push

This file was deleted.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
"test": "turbo run test --log-order=grouped",
"test:coverage": "turbo run test:coverage --log-order=grouped",
"typecheck": "turbo run typecheck --log-order=grouped",
"health-check": "turbo run health-check --log-order=grouped --output-logs=errors-only --continue",
"core": "pnpm --filter @ledgerhq/device-sdk-core",
"signer": "pnpm --filter @ledgerhq/device-sdk-signer",
"trusted-apps": "pnpm --filter @ledgerhq/device-sdk-trusted-apps",
"ui": "pnpm --filter @ledgerhq/device-sdk-ui",
"sample": "pnpm --filter @ledgerhq/device-sdk-sample",
"prepare": "husky",
"bump": "changeset version",
"release": "changeset publish",
"changelog": "changeset add",
Expand All @@ -37,15 +37,14 @@
"danger": "^11.3.1",
"eslint": "^8.56.0",
"gitmoji-cli": "^9.1.0",
"husky": "^9.0.10",
"hygen": "^6.2.11",
"jest": "^29.7.0",
"lint-staged": "^15.2.0",
"prettier": "^3.1.1",
"rimraf": "^5.0.5",
"ts-jest": "^29.1.1",
"turbo": "^1.12.3",
"typescript": "^5.3.3",
"ts-jest": "^29.1.1",
"zx": "^7.2.3"
},
"lint-staged": {
Expand Down
3 changes: 2 additions & 1 deletion packages/core/.prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
lib/*
lib/*
coverage/*
3 changes: 2 additions & 1 deletion packages/signer/.prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
lib/*
lib/*
coverage/*
3 changes: 2 additions & 1 deletion packages/trusted-apps/.prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
lib/*
lib/*
coverage/*
3 changes: 2 additions & 1 deletion packages/ui/.prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
lib/*
lib/*
coverage/*
Loading

0 comments on commit d100f8f

Please sign in to comment.