-
Notifications
You must be signed in to change notification settings - Fork 241
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
Fix for flaky Windows tests preventing deployment #2647
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8e75033
Only build once per test run via `pretest`
colinrotherham 2a0ab61
Run GitHub tasks in parallel
colinrotherham 74a6b8c
Run GitHub tasks in Linux by default
colinrotherham 31678e3
Add (optional) GitHub Action input for runner
colinrotherham 2474a14
Skip build when cached against commit SHA
colinrotherham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
const configPaths = require('./lib/paths.js') | ||
|
||
const PORT = configPaths.testPort | ||
|
||
module.exports = { | ||
browserContext: 'incognito', | ||
server: { | ||
command: 'node tasks/test-serve.js', | ||
launchTimeout: 30000, | ||
port: PORT | ||
command: 'npm run serve', | ||
port: configPaths.testPort | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,14 @@ | ||
const path = require('path') | ||
const { createServer } = require('http') | ||
|
||
const browsersync = require('../lib/metalsmith-browser-sync') // setup synchronised browser testing | ||
const metalsmith = require('../lib/metalsmith') // configured static site generator | ||
const connect = require('connect') | ||
const serveStatic = require('serve-static') | ||
|
||
const paths = require('../lib/paths.js') // specify paths to main working directories | ||
const paths = require('../lib/paths.js') | ||
|
||
// setup synchronised browser testing | ||
metalsmith.use(browsersync({ | ||
ghostMode: false, // Ghost mode tries to check the same input across examples. | ||
open: false, // When making changes to the server, we don't want multiple windows opening. | ||
server: paths.public, // server directory | ||
files: [ | ||
path.join(paths.source, '**/*'), | ||
path.join(paths.views, '**/*'), | ||
path.normalize('node_modules/govuk-frontend/**/*') | ||
] // files to watch | ||
})) | ||
// Create a simple server for serving static files | ||
const app = connect().use(serveStatic(paths.public)) | ||
const server = createServer(app) | ||
|
||
// build to destination directory | ||
metalsmith.build(function (err, files) { | ||
if (err) { throw err } | ||
server.listen(paths.testPort, () => { | ||
console.log(`Server started at http://localhost:${paths.testPort}`) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const path = require('path') | ||
|
||
const browsersync = require('../lib/metalsmith-browser-sync') // setup synchronised browser testing | ||
const metalsmith = require('../lib/metalsmith') // configured static site generator | ||
|
||
const paths = require('../lib/paths.js') // specify paths to main working directories | ||
|
||
// setup synchronised browser testing | ||
metalsmith.use(browsersync({ | ||
ghostMode: false, // Ghost mode tries to check the same input across examples. | ||
open: false, // When making changes to the server, we don't want multiple windows opening. | ||
server: paths.public, // server directory | ||
files: [ | ||
path.join(paths.source, '**/*'), | ||
path.join(paths.views, '**/*'), | ||
path.normalize('node_modules/govuk-frontend/**/*') | ||
] // files to watch | ||
})) | ||
|
||
// build to destination directory | ||
metalsmith.build(function (err, files) { | ||
if (err) { throw err } | ||
}) |
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When running the "All in one" task
npm test
we have already built the site usingpretest
So I've added
--ignore-scripts
to skipprelint:html
to avoid a double buildThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question If we're doing this to avoid the double build when running
test
, because bothpretest
andprelint:html
run a build, would this addition be better suited to thetest
command? Can it runnpm run lint -- --ignore-scripts
to appendignore-scripts
to thelint
command (and as such to its lastlint:html
command)? No worries if it can't though.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it work? Happy to switch it
Only worry is
"lint"
being reordered in future and the flag goes to the wrong scriptThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work, yup (🤯), but good shout on the reordering. Feels odd that, when run through
lint
,lint:html
won't build, but when run on its own it will. If it becomes an issue we can always adjust then.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah maybe aligning it with
govuk-frontend
was the wrong move?Where only
"test"
runs a build via"pretest"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand your last answer, sorry 😔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry. I mean the linting tasks on
govuk-frontend
don't run a build, so I copied that hereMight be worth trying to tighten up what runs when