Skip to content

Commit

Permalink
chore: configure unit tests and add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
tonai committed Jan 2, 2025
1 parent ff2b9c8 commit a4f9b8e
Show file tree
Hide file tree
Showing 8 changed files with 5,555 additions and 1,843 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Tests
on: push
jobs:
test:
name: Test
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Detect package manager
id: detect-package-manager
run: |
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install --frozen-lockfile" >> $GITHUB_OUTPUT
echo "runner=yarn" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/package.json" ]; then
echo "manager=npm" >> $GITHUB_OUTPUT
echo "command=ci" >> $GITHUB_OUTPUT
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
exit 0
else
echo "Unable to determine package manager"
exit 1
fi
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "20"
cache: ${{ steps.detect-package-manager.outputs.manager }}
- name: Install dependencies
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
- name: Lint
run: ${{ steps.detect-package-manager.outputs.manager }} run lint
- name: Test
run: ${{ steps.detect-package-manager.outputs.manager }} run test
- name: Test
run: ${{ steps.detect-package-manager.outputs.manager }} run build
- name: Test
run: ${{ steps.detect-package-manager.outputs.manager }} run build:examples
3 changes: 2 additions & 1 deletion examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"dev": "vite",
"prebuild": "react-dsfr update-icons",
"build": "tsc -b && vite build",
"preview": "vite preview"
"preview": "vite preview",
"check-types": "tsc --noEmit"
},
"dependencies": {
"@codegouvfr/react-dsfr": "^1.16.4",
Expand Down
2 changes: 1 addition & 1 deletion examples/src/TiptapCustomButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,5 @@ function CustomDialog() {
export const CustomControl3 = createDialogControl({
buttonProps: { children: "Insérer du contenu" },
DialogContent: CustomDialog,
onClick: (editor, ref) => ref.current?.open(),
onClick: (_editor, ref) => ref.current?.open(),
});
Loading

0 comments on commit a4f9b8e

Please sign in to comment.