Skip to content

Commit

Permalink
ci: add CD
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakeii committed Jun 19, 2022
1 parent 94c2e9b commit b058100
Show file tree
Hide file tree
Showing 6 changed files with 2,708 additions and 68 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Test, Release, Publish

on:
push:
branches: [main]

jobs:
test:
name: Release
runs-on: ubuntu-20.04
container:
image: mcr.microsoft.com/playwright:v1.20.0-focal
options: --user 1001
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 18

- name: Install dependencies
run: yarn --frozen-lockfile

- name: Package module
run: yarn package

- name: Release
uses: cycjimmy/semantic-release-action@v2
with:
extra_plugins: |
@semantic-release/changelog
env:
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
23 changes: 21 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"devDependencies": {
"@playwright/test": "^1.19.1",
"@semantic-release/changelog": "^6.0.1",
"@sveltejs/adapter-auto": "next",
"@sveltejs/kit": "next",
"@typescript-eslint/eslint-plugin": "^5.10.1",
Expand All @@ -24,6 +25,7 @@
"prettier": "^2.5.1",
"prettier-plugin-svelte": "^2.5.0",
"sass": "^1.52.3",
"semantic-release": "^19.0.3",
"svelte": "^3.44.0",
"svelte-check": "^2.2.6",
"svelte-portal": "^2.2.0",
Expand All @@ -32,5 +34,22 @@
"tslib": "^2.3.1",
"typescript": "^4.7.4"
},
"type": "module"
}
"type": "module",
"release": {
"branches": [
"main"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
[
"@semantic-release/npm",
{
"pkgRoot": "package"
}
],
"@semantic-release/github"
]
}
}
9 changes: 0 additions & 9 deletions playwright.config.js

This file was deleted.

9 changes: 9 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
webServer: {
command: 'npm run build && npm run preview',
port: 3000,
},
};

export default config;
4 changes: 2 additions & 2 deletions tests/test.js → tests/test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, test } from '@playwright/test';

test('index page has expected h1', async ({ page }) => {
await page.goto('/');
expect(await page.textContent('h1')).toBe('Welcome to SvelteKit');
await page.goto('/');
expect(await page.textContent('h1')).toBe('Popdown Demo');
});
Loading

0 comments on commit b058100

Please sign in to comment.