Skip to content

Commit

Permalink
fix: add build-gh-pages target
Browse files Browse the repository at this point in the history
  • Loading branch information
MishaZhem committed Jul 11, 2024
1 parent 351f3bb commit 92f8097
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: taiga-family/ci/actions/setup/[email protected]
- uses: taiga-family/ci/actions/setup/[email protected]
- uses: taiga-family/ci/actions/setup/[email protected]
- run: npm run build
- run: npx nx build-gh-pages taiga-lumbermill

deploy:
runs-on: ubuntu-latest
Expand All @@ -23,7 +23,7 @@ jobs:
- run: npx run build-gh-pages
- uses: JamesIves/[email protected]
with:
# branch: gh-pages
branch: gh-pages
folder: dist/apps/taiga-lumbermill/browser
silent: false
clean: true
Expand Down
70 changes: 70 additions & 0 deletions apps/taiga-lumbermill-e2e/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/* eslint-disable */
import {defineConfig, devices} from '@playwright/test';
import {nxE2EPreset} from '@nx/playwright/preset';

import {workspaceRoot} from '@nx/devkit';

// For CI, you may want to set BASE_URL to the deployed application.
const baseURL = process.env['BASE_URL'] || 'http://localhost:4200';

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
...nxE2EPreset(__filename, {testDir: './src'}),
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
baseURL,
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},
/* Run your local dev server before starting the tests */
webServer: {
command: 'npx nx serve taiga-lumbermill',
url: 'http://localhost:4200',
reuseExistingServer: !process.env.CI,
cwd: workspaceRoot,
},
projects: [
{
name: 'chromium',
use: {...devices['Desktop Chrome']},
},

{
name: 'firefox',
use: {...devices['Desktop Firefox']},
},

{
name: 'webkit',
use: {...devices['Desktop Safari']},
},

// Uncomment for mobile browsers support
/* {
name: 'Mobile Chrome',
use: { ...devices['Pixel 5'] },
},
{
name: 'Mobile Safari',
use: { ...devices['iPhone 12'] },
}, */

// Uncomment for branded browsers
/* {
name: 'Microsoft Edge',
use: { ...devices['Desktop Edge'], channel: 'msedge' },
},
{
name: 'Google Chrome',
use: { ...devices['Desktop Chrome'], channel: 'chrome' },
} */
],
});
9 changes: 9 additions & 0 deletions apps/taiga-lumbermill-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "taiga-lumbermill-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "apps/taiga-lumbermill-e2e/src",
"implicitDependencies": ["taiga-lumbermill"],
"// targets": "to see all targets run: nx show project taiga-lumbermill-e2e --web",
"targets": {}
}
8 changes: 8 additions & 0 deletions apps/taiga-lumbermill-e2e/src/example.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {expect, test} from '@playwright/test';

test('has title', async ({page}) => {
await page.goto('/');

// Expect h1 to contain a substring.
expect(await page.locator('h1').innerText()).toContain('Welcome');
});
25 changes: 25 additions & 0 deletions apps/taiga-lumbermill-e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"allowJs": true,
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"sourceMap": false,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"include": [
"**/*.ts",
"**/*.js",
"playwright.config.ts",
"src/**/*.spec.ts",
"src/**/*.spec.js",
"src/**/*.test.ts",
"src/**/*.test.js",
"src/**/*.d.ts"
]
}
13 changes: 13 additions & 0 deletions apps/taiga-lumbermill/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@
},
"defaultConfiguration": "production"
},
"build-gh-pages": {
"executor": "nx:run-commands",
"options": {
"parallel": false,
"commands": [
"echo 'Github pages require special 404.html'",
"echo 'Read more: https://angular.io/guide/deployment#deploy-to-github-pages'",
"echo ------",
"nx build taiga-lumbermill -c production",
"cp dist/apps/taiga-lumbermill/browser/index.html dist/apps/taiga-lumbermill/browser/404.html"
]
}
},
"serve": {
"executor": "@angular-devkit/build-angular:dev-server",
"configurations": {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,6 @@
"ts-jest": "^29.1.0",
"ts-node": "10.9.1",
"typescript": "~5.4.2"
}
},
"nx": {}
}

0 comments on commit 92f8097

Please sign in to comment.