From 5a55a362073c58078708310a598f1cbf09d8c3a4 Mon Sep 17 00:00:00 2001 From: Juri Date: Tue, 17 Sep 2024 17:32:22 +0200 Subject: [PATCH] configure CI --- .github/workflows/__ci.backup | 42 +++++++++++++++ .github/workflows/verify.yml | 7 ++- e2e/web/playwright.config.ts | 3 +- nx.json | 18 +++++-- package.json | 5 +- pnpm-lock.yaml | 99 +++++++++++++++++++++++++++++++++++ 6 files changed, 163 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/__ci.backup diff --git a/.github/workflows/__ci.backup b/.github/workflows/__ci.backup new file mode 100644 index 0000000..28031f1 --- /dev/null +++ b/.github/workflows/__ci.backup @@ -0,0 +1,42 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + +permissions: + actions: read + contents: read + +jobs: + main: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: pnpm/action-setup@v4 + with: + version: 9 + + # This enables task distribution via Nx Cloud + # Run this command as early as possible, before dependencies are installed + # Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun + - run: pnpm dlx nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="build" + + # Cache node_modules + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'pnpm' + + - run: pnpm install --frozen-lockfile + - uses: nrwl/nx-set-shas@v4 + + # Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud + # - run: pnpm exec nx-cloud record -- echo Hello World + # Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected + - run: pnpm exec nx affected -t lint test build diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 4fe2d50..ea5bf94 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -28,10 +28,9 @@ jobs: run: | pnpm format:check pnpm lint - pnpm --filter "@tasker/web" build - pnpm --filter "@tasker/*" test - - name: Run Playwright tests - run: pnpm --filter "@tasker/e2e-web" e2e + pnpm exec nx run-many -t test build e2e + # - name: Run Playwright tests + # run: pnpm --filter "@tasker/e2e-web" e2e - uses: actions/upload-artifact@v4 if: always() with: diff --git a/e2e/web/playwright.config.ts b/e2e/web/playwright.config.ts index 85ef727..ccfbcdc 100644 --- a/e2e/web/playwright.config.ts +++ b/e2e/web/playwright.config.ts @@ -33,7 +33,8 @@ export default defineConfig({ webServer: { timeout: 30_000, - command: 'pnpm --filter "@tasker/web" start', + // command: 'pnpm --filter "@tasker/web" start', + command: 'pnpm nx start @tasker/web', url: 'http://localhost:3000', reuseExistingServer: true, }, diff --git a/nx.json b/nx.json index 0bd2217..5785f61 100644 --- a/nx.json +++ b/nx.json @@ -6,10 +6,20 @@ "outputs": ["{projectRoot}/.next"], "cache": true }, - "e2e": { "cache": true }, - "lint": { "cache": true }, - "test": { "cache": true } + "e2e": { + "cache": true + }, + "lint": { + "cache": true + }, + "test": { + "cache": true + } }, "defaultBase": "main", - "nxCloudId": "66e99dcf5d41efe7b0c5dc21" + "nxCloudId": "66e99dcf5d41efe7b0c5dc21", + "namedInputs": { + "sharedGlobals": ["{workspaceRoot}/.github/workflows/verify.yml"], + "default": ["sharedGlobals"] + } } diff --git a/package.json b/package.json index d460e68..b7910f0 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "typescript-eslint": "^7.9.0", "vitest": "^1.6.0", "@playwright/test": "^1.44.0", - "nx": "19.7.3" + "nx": "19.7.3", + "@nx/workspace": "19.7.3" } -} \ No newline at end of file +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0814851..8aa9d23 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,6 +11,9 @@ importers: '@eslint/js': specifier: ^9.2.0 version: 9.10.0 + '@nx/workspace': + specifier: 19.7.3 + version: 19.7.3 '@playwright/test': specifier: ^1.44.0 version: 1.47.0 @@ -698,10 +701,21 @@ packages: engines: {node: '>=10'} deprecated: This functionality has been moved to @npmcli/fs + '@nrwl/devkit@19.7.3': + resolution: {integrity: sha512-g9vANTuxgHan6uAkI6M6tkfLjHECLmbZ4A80UqpxJNQJsCJFEHkzIC9oxhf8bWV3PjgCH6Xm4VyQ2GHwb3sgWw==} + '@nrwl/tao@19.7.3': resolution: {integrity: sha512-cIGhnSFPZdVTp4bI0fqwFoE9i7ToPg5jXz+hNMl/MTwcOQfKQ1JJY/ZPLM3aBUPORFIZ/GECQEycUb6+xCB56g==} hasBin: true + '@nrwl/workspace@19.7.3': + resolution: {integrity: sha512-2ffUbLzBYGQte6zQ6dDLefgU9X812Uh7v61yTV7z4zfYbUtjwInkWqlkTvRuK08DRhD5vWo9xyUDp7acAdZaxw==} + + '@nx/devkit@19.7.3': + resolution: {integrity: sha512-dIavuzfcMLCTa5uhd4R7HsxcFO0w9fHwG4wDg76wyBAbPGJlrR+9zg359hZ/SkXdguO6bMVmmQg/EXIvo6g69A==} + peerDependencies: + nx: '>= 17 <= 20' + '@nx/nx-darwin-arm64@19.7.3': resolution: {integrity: sha512-0dDK0UkMR0vBv4AP/48Q9A+OC2dvpivdt8su/4W/CPADy69M9B5O3jPiK+jTRsLshQG/soC9JG0Rll1BNWymPg==} engines: {node: '>= 10'} @@ -762,6 +776,9 @@ packages: cpu: [x64] os: [win32] + '@nx/workspace@19.7.3': + resolution: {integrity: sha512-FUHeOLCXdHEB1b6FiNU9swCZIKXbsGWRDfgHpHGeiZHp7uhH41W/EKTVukRxnQ+HXhE7zfxhn8KkllfaXIifPg==} + '@pkgjs/parseargs@0.11.0': resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} @@ -1262,6 +1279,9 @@ packages: assertion-error@1.1.0: resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==} + async@3.2.6: + resolution: {integrity: sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==} + asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} @@ -1612,6 +1632,11 @@ packages: eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} + ejs@3.1.10: + resolution: {integrity: sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==} + engines: {node: '>=0.10.0'} + hasBin: true + emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} @@ -1769,6 +1794,9 @@ packages: file-uri-to-path@1.0.0: resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==} + filelist@1.0.4: + resolution: {integrity: sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==} + fill-range@7.1.1: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} engines: {node: '>=8'} @@ -2175,6 +2203,11 @@ packages: jackspeak@3.4.3: resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==} + jake@10.9.2: + resolution: {integrity: sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA==} + engines: {node: '>=10'} + hasBin: true + jest-diff@29.7.0: resolution: {integrity: sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -2342,6 +2375,10 @@ packages: minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} + minimatch@5.1.6: + resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==} + engines: {node: '>=10'} + minimatch@9.0.3: resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} engines: {node: '>=16 || 14 >=14.17'} @@ -3984,6 +4021,12 @@ snapshots: rimraf: 3.0.2 optional: true + '@nrwl/devkit@19.7.3(nx@19.7.3)': + dependencies: + '@nx/devkit': 19.7.3(nx@19.7.3) + transitivePeerDependencies: + - nx + '@nrwl/tao@19.7.3': dependencies: nx: 19.7.3 @@ -3993,6 +4036,27 @@ snapshots: - '@swc/core' - debug + '@nrwl/workspace@19.7.3': + dependencies: + '@nx/workspace': 19.7.3 + transitivePeerDependencies: + - '@swc-node/register' + - '@swc/core' + - debug + + '@nx/devkit@19.7.3(nx@19.7.3)': + dependencies: + '@nrwl/devkit': 19.7.3(nx@19.7.3) + ejs: 3.1.10 + enquirer: 2.3.6 + ignore: 5.3.2 + minimatch: 9.0.3 + nx: 19.7.3 + semver: 7.6.3 + tmp: 0.2.3 + tslib: 2.7.0 + yargs-parser: 21.1.1 + '@nx/nx-darwin-arm64@19.7.3': optional: true @@ -4023,6 +4087,20 @@ snapshots: '@nx/nx-win32-x64-msvc@19.7.3': optional: true + '@nx/workspace@19.7.3': + dependencies: + '@nrwl/workspace': 19.7.3 + '@nx/devkit': 19.7.3(nx@19.7.3) + chalk: 4.1.2 + enquirer: 2.3.6 + nx: 19.7.3 + tslib: 2.7.0 + yargs-parser: 21.1.1 + transitivePeerDependencies: + - '@swc-node/register' + - '@swc/core' + - debug + '@pkgjs/parseargs@0.11.0': optional: true @@ -4560,6 +4638,8 @@ snapshots: assertion-error@1.1.0: {} + async@3.2.6: {} + asynckit@0.4.0: {} available-typed-arrays@1.0.7: @@ -4921,6 +5001,10 @@ snapshots: eastasianwidth@0.2.0: {} + ejs@3.1.10: + dependencies: + jake: 10.9.2 + emoji-regex@8.0.0: {} emoji-regex@9.2.2: {} @@ -5208,6 +5292,10 @@ snapshots: file-uri-to-path@1.0.0: {} + filelist@1.0.4: + dependencies: + minimatch: 5.1.6 + fill-range@7.1.1: dependencies: to-regex-range: 5.0.1 @@ -5616,6 +5704,13 @@ snapshots: optionalDependencies: '@pkgjs/parseargs': 0.11.0 + jake@10.9.2: + dependencies: + async: 3.2.6 + chalk: 4.1.2 + filelist: 1.0.4 + minimatch: 3.1.2 + jest-diff@29.7.0: dependencies: chalk: 4.1.2 @@ -5802,6 +5897,10 @@ snapshots: dependencies: brace-expansion: 1.1.11 + minimatch@5.1.6: + dependencies: + brace-expansion: 2.0.1 + minimatch@9.0.3: dependencies: brace-expansion: 2.0.1