diff --git a/.github/workflows/build_and_check.yml b/.github/workflows/build_and_check.yml index 9c7a098..1a72a26 100644 --- a/.github/workflows/build_and_check.yml +++ b/.github/workflows/build_and_check.yml @@ -1,10 +1,6 @@ name: Build, check & Test -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] +on: push jobs: run: diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml index 8a44150..4d76f0c 100644 --- a/.github/workflows/build_docker.yml +++ b/.github/workflows/build_docker.yml @@ -1,14 +1,7 @@ name: Build Docker Image -on: - push: - branches: - - '*' - tags: - - v* - pull_request: - branches: - - master + +on: push env: IMAGE_NAME: ${{ github.repository }} diff --git a/.github/workflows/delete_packages.yml b/.github/workflows/delete_packages.yml index f578146..4cf343c 100644 --- a/.github/workflows/delete_packages.yml +++ b/.github/workflows/delete_packages.yml @@ -7,14 +7,13 @@ on: - closed # Run when a branch is deleted delete: - + # Config env: TOKEN: ${{ secrets.GIT_TOKEN }} GROUP: avior TYPE: container PACKAGE: ifremer-loop - jobs: pull_request: @@ -24,9 +23,9 @@ jobs: steps: - name: Delete package run: | - curl --fail -X 'DELETE' "https://git.dzeio.com/api/v1/packages/${GROUP}/${TYPE}/${PACKAGE}/${VERSION}" -H 'accept: application/json' -H "Authorization: token ${TOKEN}" + curl --fail -X 'DELETE' "https://git.dzeio.com/api/v1/packages/${GROUP}/${TYPE}/${PACKAGE}/${VERSION}" -H 'accept: application/json' -H "Authorization: token ${TOKEN}" env: - VERSION: pr-${{ github.event.number }}-head + VERSION: pr-${{ github.event.number }}-head branch: runs-on: ubuntu-latest name: Delete the package on a deleted branch @@ -34,11 +33,10 @@ jobs: steps: - name: Delete package run: | - curl --fail -X 'DELETE' "https://git.dzeio.com/api/v1/packages/${GROUP}/${TYPE}/${PACKAGE}/${VERSION}" -H 'accept: application/json' -H "Authorization: token ${TOKEN}" + curl --fail -X 'DELETE' "https://git.dzeio.com/api/v1/packages/${GROUP}/${TYPE}/${PACKAGE}/${VERSION}" -H 'accept: application/json' -H "Authorization: token ${TOKEN}" env: TOKEN: ${{ secrets.GIT_TOKEN }} GROUP: avior TYPE: container PACKAGE: ifremer-loop VERSION: branch-${{ github.event.ref }} - \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..c64ce5c --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,28 @@ +name: Lint + +on: push + +jobs: + run: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Use Node.js 20 + uses: actions/setup-node@v3 + with: + node-version: 20 + + - name: Install dependencies + run: npm ci + + - name: Run BiomeJS + run: npm run lint + # - uses: mongolyy/reviewdog-action-biome@v1 + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # reporter: gitea-pr-review + # filter_mode: diff_context + # fail_on_error: true diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..39e53e9 --- /dev/null +++ b/biome.json @@ -0,0 +1,81 @@ +{ + "$schema": "./node_modules/@biomejs/biome/configuration_schema.json", + "organizeImports": { + "enabled": true + }, + "vcs": { + "enabled": true, + "clientKind": "git", + "useIgnoreFile": true, + "defaultBranch": "master" + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true, + "complexity": { + "noBannedTypes": "warn", + "noExcessiveCognitiveComplexity": { + "level": "warn", + "options": { + "maxAllowedComplexity": 20 + } + }, + "noStaticOnlyClass": "warn", + "noUselessTypeConstraint": "warn", + "noVoid": "error", + "useSimplifiedLogicExpression": "warn" + }, + "performance": { + "noBarrelFile": "error", + "noReExportAll": "warn" + }, + "style": { + "noNonNullAssertion": "warn", + "noParameterAssign": "warn", + "useCollapsedElseIf": "warn", + "useConsistentArrayType": { + "level": "error", + "options": { + "syntax": "generic" + } + }, + "useEnumInitializers": "off", + "useFilenamingConvention": { + "level": "error", + "options": { + "strictCase": true, + "requireAscii": true, + "filenameCases": ["camelCase", "export"] + } + }, + "useForOf": "error", + "useNamingConvention": { + "level": "error", + "options": { + "enumMemberCase": "CONSTANT_CASE", + "strictCase": false, + "requireAscii": true + } + }, + "useNodeAssertStrict": "warn", + "useNumberNamespace": "warn", + "useSingleCaseStatement": "warn" + } + } + }, + "formatter": { + "enabled": true, + "indentStyle": "tab" + }, + "javascript": { + "globals": ["Astro"], + "formatter": { + "semicolons": "asNeeded", + "quoteStyle": "single", + "trailingComma": "none", + "lineWidth": 200, + "bracketSameLine": true + } + } +} diff --git a/package-lock.json b/package-lock.json index a58fed6..f36b64d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ }, "devDependencies": { "@astrojs/check": "^0", + "@biomejs/biome": "^1.7.3", "@playwright/test": "^1", "@types/node": "^20", "@vitest/coverage-v8": "^1", @@ -548,6 +549,161 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, + "node_modules/@biomejs/biome": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.7.3.tgz", + "integrity": "sha512-ogFQI+fpXftr+tiahA6bIXwZ7CSikygASdqMtH07J2cUzrpjyTMVc9Y97v23c7/tL1xCZhM+W9k4hYIBm7Q6cQ==", + "dev": true, + "hasInstallScript": true, + "bin": { + "biome": "bin/biome" + }, + "engines": { + "node": ">=14.21.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/biome" + }, + "optionalDependencies": { + "@biomejs/cli-darwin-arm64": "1.7.3", + "@biomejs/cli-darwin-x64": "1.7.3", + "@biomejs/cli-linux-arm64": "1.7.3", + "@biomejs/cli-linux-arm64-musl": "1.7.3", + "@biomejs/cli-linux-x64": "1.7.3", + "@biomejs/cli-linux-x64-musl": "1.7.3", + "@biomejs/cli-win32-arm64": "1.7.3", + "@biomejs/cli-win32-x64": "1.7.3" + } + }, + "node_modules/@biomejs/cli-darwin-arm64": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.7.3.tgz", + "integrity": "sha512-eDvLQWmGRqrPIRY7AIrkPHkQ3visEItJKkPYSHCscSDdGvKzYjmBJwG1Gu8+QC5ed6R7eiU63LEC0APFBobmfQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-darwin-x64": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.7.3.tgz", + "integrity": "sha512-JXCaIseKRER7dIURsVlAJacnm8SG5I0RpxZ4ya3dudASYUc68WGl4+FEN03ABY3KMIq7hcK1tzsJiWlmXyosZg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.7.3.tgz", + "integrity": "sha512-phNTBpo7joDFastnmZsFjYcDYobLTx4qR4oPvc9tJ486Bd1SfEVPHEvJdNJrMwUQK56T+TRClOQd/8X1nnjA9w==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64-musl": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.7.3.tgz", + "integrity": "sha512-c8AlO45PNFZ1BYcwaKzdt46kYbuP6xPGuGQ6h4j3XiEDpyseRRUy/h+6gxj07XovmyxKnSX9GSZ6nVbZvcVUAw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.7.3.tgz", + "integrity": "sha512-vnedYcd5p4keT3iD48oSKjOIRPYcjSNNbd8MO1bKo9ajg3GwQXZLAH+0Cvlr+eMsO67/HddWmscSQwTFrC/uPA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64-musl": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.7.3.tgz", + "integrity": "sha512-UdEHKtYGWEX3eDmVWvQeT+z05T9/Sdt2+F/7zmMOFQ7boANeX8pcO6EkJPK3wxMudrApsNEKT26rzqK6sZRTRA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-arm64": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.7.3.tgz", + "integrity": "sha512-unNCDqUKjujYkkSxs7gFIfdasttbDC4+z0kYmcqzRk6yWVoQBL4dNLcCbdnJS+qvVDNdI9rHp2NwpQ0WAdla4Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-x64": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.7.3.tgz", + "integrity": "sha512-ZmByhbrnmz/UUFYB622CECwhKIPjJLLPr5zr3edhu04LzbfcOrz16VYeNq5dpO1ADG70FORhAJkaIGdaVBG00w==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, "node_modules/@dzeio/logger": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/@dzeio/logger/-/logger-3.2.1.tgz", diff --git a/package.json b/package.json index ca40287..608bc6b 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "test": "npm run test:unit && npm run test:e2e", "test:unit": "vitest --coverage --run", "test:e2e": "playwright test", - "install:test": "playwright install --with-deps" + "install:test": "playwright install --with-deps", + "lint": "biome check ." }, "dependencies": { "@astrojs/node": "^7", @@ -28,6 +29,7 @@ }, "devDependencies": { "@astrojs/check": "^0", + "@biomejs/biome": "^1.7.3", "@playwright/test": "^1", "@types/node": "^20", "@vitest/coverage-v8": "^1",