Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/lib gh ci #6

Merged
merged 48 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
9ace876
Adds cypress E2E tests and mocking
dylankelly Feb 9, 2023
0e8a9d9
adds example job content type based on boards.vic
dylankelly Feb 10, 2023
b1891c4
change text
dylankelly Feb 15, 2023
21ccb30
change apply text
dylankelly Feb 15, 2023
d6346e8
update to latest ripple 2
dylankelly Jul 18, 2023
e5a2f53
adds demo content type example
dylankelly Jul 24, 2023
9e6ed33
add ci test workflow
dylankelly Jul 24, 2023
c1e5122
rename workflow
dylankelly Jul 24, 2023
215c425
run CI on push and PR
dylankelly Jul 24, 2023
ca1204f
Merge branch 'main' of https://github.com/dpc-sdp/ripple-lib-starter …
dylankelly Jul 24, 2023
b353f9a
test ci
dylankelly Jul 24, 2023
2907a75
test CI
dylankelly Jul 24, 2023
47231d3
commit package lockfile
dylankelly Jul 25, 2023
89cdc16
Merge branch 'feature/lib-gh-ci' of https://github.com/dpc-sdp/ripple…
dylankelly Jul 25, 2023
20fa701
fix lint issues
dylankelly Jul 25, 2023
d479eab
add missing build step
dylankelly Jul 25, 2023
047a7ed
fix build cmd
dylankelly Jul 25, 2023
1282afd
test cypress ci
dylankelly Jul 25, 2023
25dc85d
cache all build artifacts
dylankelly Jul 25, 2023
51f8090
fix ci syntax
dylankelly Jul 25, 2023
015e4cd
update build key
dylankelly Jul 25, 2023
c3c0ad8
with cache restore
dylankelly Jul 25, 2023
216e5b9
remove credentials
dylankelly Jul 25, 2023
c8db336
update archive path
dylankelly Jul 25, 2023
7db5dcd
update package scripts
dylankelly Jul 26, 2023
1ee1592
remove unimplemented test
dylankelly Jul 26, 2023
6f9f26c
debug
dylankelly Jul 26, 2023
0dc1e8d
debug
dylankelly Jul 26, 2023
0d59b61
adds ssh debug
dylankelly Jul 26, 2023
3fa3c3d
debug
dylankelly Jul 26, 2023
d259146
debug
dylankelly Jul 26, 2023
6e9c7cd
debug
dylankelly Jul 26, 2023
22eb575
debug
dylankelly Jul 26, 2023
4972045
debug
dylankelly Jul 26, 2023
d8fa862
debug
dylankelly Jul 26, 2023
afbb944
using cypress action
dylankelly Jul 26, 2023
c1b148c
remove extra install and build
dylankelly Jul 26, 2023
82fe560
add env vars
dylankelly Jul 26, 2023
e746132
debug
dylankelly Jul 26, 2023
f3cb546
debug
dylankelly Jul 26, 2023
c3ce363
debug
dylankelly Jul 26, 2023
d07ea53
debug
dylankelly Jul 26, 2023
05e528d
debug
dylankelly Jul 26, 2023
b8e4d1b
debug
dylankelly Jul 26, 2023
ca4ceee
debug
dylankelly Jul 26, 2023
23966a4
debug
dylankelly Jul 26, 2023
dfec97b
add back build step
dylankelly Jul 26, 2023
a76e8f6
cleanup demo module
dylankelly Jul 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- Add link to JIRA eg: https://digital-vic.atlassian.net/browse/SDPAP- or GitHub Issue Number eg: #123 -->

**Issue**:

### What I did
<!-- Summary of changes made in the Pull Request -->
-
-

### How to test
<!-- Summary of how to test -->
-
-

### Checklist
<!-- Go over all the following points, and put an `x` in all the boxes that apply. -->

- [ ] I have read the [Ripple documentation](https://www.ripple.sdp.vic.gov.au/framework/) documentation around adding custom functionality.
- [ ] I have added Cypress integration tests for new content types or components
- [ ] I have added unit tests for helper functions
- [ ] This PR requires changes to environment variables which need to be added in https://github.com/dpc-sdp/sdp-cmdb


36 changes: 26 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
name: build and test

on:
push:
branches: [ $default-branch ]
pull_request:
branches: [ $default-branch ]

name: Build & Test
on: [push]
jobs:
build:
Build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm ci
- name: Install Dependencies
run: npm ci
- run: npm run build
- run: npm run lint
- run: npm run test:unit

Integration:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cypress run
uses: cypress-io/github-action@v5
env:
DEBUG: '@cypress/github-action'
NUXT_PUBLIC_TIDE_BASE_URL: 'https://develop.content.reference.sdp.vic.gov.au/'
NUXT_PUBLIC_TIDE_SITE: '8888'
NUXT_PUBLIC_API_URL: 'http://localhost:3001'
API_PORT: '3001'
with:
build: npm run build
start: npm start
wait-on: 'http://localhost:3000/api/tide/site?id=8888'

6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ node_modules
nuxt.d.ts
.output
.env
package-lock.json
framework
dist
.DS_Store
coverage

# Cypress
cypress/downloads
cypress/screenshots
cypress/videos

# Local History
.history

Expand Down
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"endOfLine": "lf",
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"jsxSingleQuote": true
}
22 changes: 22 additions & 0 deletions components/TideDemoHeader.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<template>
<RplHeroHeader
:behind-nav="true"
:breadcrumbs="hasBreadcrumbs"
:title="header.title"
>
<p class="rpl-type-p-large rpl-u-margin-b-4 rpl-u-margin-t-4">
{{ header.summary }}
</p>
</RplHeroHeader>
</template>

<script setup lang="ts">
import type { TideDemoHeader } from '../types'

interface Props {
header: TideDemoHeader
hasBreadcrumbs: boolean
}

defineProps<Props>()
</script>
52 changes: 52 additions & 0 deletions components/global/TideDemo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<template>
<TideBaseLayout
:site="site"
:page="page"
:site-section="page?.siteSection"
:page-title="page.title"
:page-language="page.lang"
:updated-date="page?.changed || page.created"
:show-content-rating="page?.showContentRating"
>
<template #aboveHeader>
<slot name="aboveHeader" />
</template>
<template #primaryNav>
<slot name="primaryNav" />
</template>
<template #breadcrumbs>
<slot name="breadcrumbs" />
</template>
<template #aboveBody="{ hasBreadcrumbs }">
<TideDemoHeader :header="{ title: page.title }" :has-breadcrumbs="hasBreadcrumbs" />
</template>
<template #body>
<h3 class="rpl-type-h3 rpl-u-margin-b-4 rpl-u-margin-t-4">
Overview
</h3>
<TideDynamicComponents
v-if="page.bodyComponents?.length > 0"
:components="page.bodyComponents"
/>
</template>
<template #sidebar>
<slot name="sidebar" />
</template>
<template #footer>
<slot name="footer" />
</template>
</TideBaseLayout>
</template>

<script setup lang="ts">
import { TideSiteData } from '@dpc-sdp/ripple-tide-api/types'
import type { TideDemoPage } from '../../types'

interface Props {
site: TideSiteData
page: TideDemoPage
}

defineProps<Props>()

</script>
41 changes: 41 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import 'dotenv/config'
import { defineConfig } from 'cypress'
import cucumberPreprocessor from '@badeball/cypress-cucumber-preprocessor'
import cucumberPreprocessorEsBuild from '@badeball/cypress-cucumber-preprocessor/esbuild'
import * as createBundlerDefault from '@bahmutov/cypress-esbuild-preprocessor'
import apiMocking from './cypress/support/mockttp'
const testFolder = './cypress'
const { addCucumberPreprocessorPlugin } = cucumberPreprocessor

export default defineConfig({
env: {
searchIndex: process.env.NUXT_PUBLIC_TIDE_APP_SEARCH_ENGINE_NAME
},
e2e: {
baseUrl: 'http://localhost:3000',
specPattern: '**/*.{feature,feature.ts}',
supportFile: `${testFolder}/support/index.ts`,
supportFolder: testFolder,
downloadsFolder: `${testFolder}/downloads`,
fixturesFolder: `${testFolder}/fixtures`,
videosFolder: `${testFolder}/videos`,
screenshotsFolder: `${testFolder}/screenshots`,
async setupNodeEvents (
on: Cypress.PluginEvents,
config: Cypress.PluginConfigOptions
): Promise<Cypress.PluginConfigOptions> {
await addCucumberPreprocessorPlugin(on, config)
const createBundler = createBundlerDefault.default
on(
'file:preprocessor',
createBundler({
plugins: [cucumberPreprocessorEsBuild.createEsbuildPlugin(config)]
})
)
on('task', { ...apiMocking })

return config
}
},
blockHosts: ['*youtube.com', '*doubleclick.net']
})
12 changes: 12 additions & 0 deletions cypress/e2e/demo/demo.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Feature: Demo test

Example test - update as required or delete.

Background:
Given the endpoint "/api/tide/page" with query "?path=/test-content-type&site=8888" returns fixture "/demo/demo" with status 200
And the endpoint "/api/tide/site" with query "?id=8888" returns fixture "/site/reference" with status 200
When I visit the page "/test-content-type"

@mockserver
Scenario: On load
Then the title should be "Demo page"
38 changes: 38 additions & 0 deletions cypress/fixtures/demo/demo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"title": "Demo page",
"changed": "2023-06-26T13:00:03+00:00",
"created": "2023-05-29T05:00:04+00:00",
"type": "demo",
"nid": "fd6a7e29-8afa-467f-9a17-7d2572c6e7ea",
"sidebar": {},
"status": null,
"topicTags": [],
"siteSection": null,
"showContentRating": true,
"header": {
"title": "Demo page",
"summary": "Nulla ultricies dignissim leo, posuere vestibulum erat cursus vitae"
},
"bodyComponents": [
{
"uuid": "a99aa287-7fac-430b-864e-3a1b044460b1",
"component": "TideLandingPageContent",
"id": "969",
"internalAnchors": [
{
"text": "Content Anchor 1",
"id": "content-anchor-1",
"type": "h2"
},
{
"text": "Content Anchor 2",
"id": "content-anchor-2",
"type": "h3"
}
],
"props": {
"html": "<p>Here is <em>some</em> sample <strong>rich</strong> text content</p>"
}
}
]
}
Loading