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

chore: Switch to Lost Pixel OSS to allow smoke testing #75

Merged
merged 9 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 19 additions & 9 deletions .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,18 @@ jobs:
run: npm test
- name: Start server (in background)
run: npm run start &
# Within a PR, Lost Pixel Platform generates separate GitHub Status Checks (which are set to 'required' in the Branch protection rule),
# so we don't need to also fail the build. For a build on the master branch, we do want to fail the build if there are differences.
- name: ${{ github.event_name != 'pull_request' && 'Test with' || 'Capture images for' }} Lost Pixel

- name: Check for unintentional UI changes with Lost Pixel
id: lp
uses: lost-pixel/lost-pixel@v3.16.0
env:
LOST_PIXEL_API_KEY: ${{ secrets.LOST_PIXEL_API_KEY }}
LOST_PIXEL_FAIL_ON_DIFFERENCE: ${{ github.event_name != 'pull_request' }}


- name: Upload Lost Pixel artefacts
uses: actions/upload-artifact@v3
if: ${{ failure() && steps.lp.conclusion == 'failure' }}
with:
name: lost-pixel-artefacts
path: .lostpixel

deploy-site:
needs: [test-site, test-models, test-data-model-validator, test-rpde-validator]
if: ${{ github.ref == 'refs/heads/master' }}
Expand Down Expand Up @@ -112,11 +116,17 @@ jobs:
git push heroku master -f

- name: Smoke test with Lost Pixel
id: lp
uses: lost-pixel/lost-pixel@v3.16.0
env:
LOST_PIXEL_API_KEY: ${{ secrets.LOST_PIXEL_API_KEY }}
LOST_PIXEL_BASE_URL: https://validator-staging.openactive.io
LOST_PIXEL_FAIL_ON_DIFFERENCE: true

- name: Upload Lost Pixel artefacts
uses: actions/upload-artifact@v3
if: ${{ failure() && steps.lp.conclusion == 'failure' }}
with:
name: lost-pixel-artefacts
path: .lostpixel

promote-site:
needs: deploy-site
Expand Down
23 changes: 19 additions & 4 deletions .github/workflows/update-lost-pixel-baseline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,22 @@ jobs:
- name: Start server (in background)
run: npm run start &

- name: Create .lostpixel directory if it doesn't exist
# This is a workaround for https://github.com/lost-pixel/lost-pixel/issues/344
run: mkdir -p .lostpixel/baseline

- name: Lost Pixel
id: lp
uses: lost-pixel/lost-pixel@v3.8.0
uses: lost-pixel/lost-pixel@v3.16.0
env:
LOST_PIXEL_MODE: update

- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
id: cpr
uses: peter-evans/create-pull-request@v6
if: ${{ failure() && steps.lp.conclusion == 'failure' }}
with:
path: ./
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
commit-message: Update lost-pixel baselines
committer: openactive-bot <openactive-bot@users.noreply.github.com>
Expand All @@ -41,7 +48,15 @@ jobs:
branch: 'lost-pixel-update/${{ github.ref_name }}'
delete-branch: true
title: 'Lost Pixel update - ${{ github.ref_name }}'
body: Automated baseline update PR created by Lost Pixel
body: |
Automated baseline update PR created by Lost Pixel

Please check the updated baseline images are as expected before merging this PR.
labels: |
automated pr
draft: false
draft: false

- name: Check outputs
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
2 changes: 2 additions & 0 deletions .lostpixel/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
current
difference
Binary file added .lostpixel/baseline/model-validator-home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .lostpixel/baseline/rpde-validator-home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .lostpixel/baseline/scheduledsession.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .lostpixel/baseline/sessionseries.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 2 additions & 4 deletions lostpixel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ module.exports = {
],
baseUrl: process.env.LOST_PIXEL_BASE_URL || 'http://172.17.0.1:8080',
},
lostPixelProjectId: 'clzitt4s52b6dlcoguswodrsj',
failOnDifference: process.env.LOST_PIXEL_FAIL_ON_DIFFERENCE === 'true' || false,
generateOnly: true, // OSS mode
failOnDifference: true,
threshold: 0,
setPendingStatusCheck: process.env.LOST_PIXEL_FAIL_ON_DIFFERENCE !== 'true',
apiKey: process.env.LOST_PIXEL_API_KEY,
};
Loading