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

Fail build process properly when PR's portion of the build fails #22

Merged
merged 4 commits into from
Oct 21, 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
11 changes: 11 additions & 0 deletions .github/workflows/deploy-github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ jobs:
# Done manually so we can checkout submodule
checkout: false

- name: Fail if PR portion of build failed
if: ${{ github.event_name == 'pull_request_target' }}
shell: bash
env:
DIRECTORY: dist/storybook-bundle/PR-${{ github.event.number }}
run: |
if [ ! -d "$DIRECTORY" ]; then
echo Pull Request build directory "$DIRECTORY does not exist."
exit 1
fi

# See: https://github.com/ouzi-dev/commit-status-updater/pull/533
- uses: patcon/commit-status-updater@patch-1
if: ${{ github.event_name == 'pull_request_target' }}
Expand Down
24 changes: 24 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
/** @type { import('@storybook/react').Preview } */
import "./style.css"
import { getMath, getComments } from "./utils";

// Needed at the very least for Graph component stories of UT-HAI client-deliberation.
import jquery from 'jquery';
global.$ = jquery;
global.jQuery = jquery;

// This is where we mock responses for PolisNet endpoints.
// TODO: Create a storybook plugin to do this dynamically.
function ajax_responses(responses) {
return function (params) {
const mockedPathname = new URL(params.url).pathname
const mockResponse = responses[mockedPathname]
var deferred = global.$.Deferred().resolve(mockResponse)
return deferred
};
}

global.$.ajax = ajax_responses({
'/api/v3/math/pca2': getMath(),
'/api/v3/comments': [getComments()],
'/api/v3/votes': [],
'/api/v3/votes/famous': [],
})

const isGithubBuild = !!process.env["GITHUB_REPOSITORY"]
const preview = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ export default {
}

// TODO: Need to mock PolisNet API calls.
const Template = (args) => <div>Not Yet Implemented</div>
const Template = (args) => <VisualisationTutorial {...args} />

export const Default = Template.bind({})
Default.args = {}
Default.args = {
// In theory, something happens at 15, but doesn't seem to work.
currentIndex: 14,
}
8 changes: 6 additions & 2 deletions stories/UT-HAI/client-deliberation/Visualization.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ import React from 'react'
import Visualization from '../../../codebases/UT-HAI/client-deliberation/src/components/Visualization'
import { withDelibThemeUi } from '../../../.storybook/decorators'



export default {
component: Visualization,
decorators: [withDelibThemeUi],
}

// TODO: Need to mock PolisNet API calls.
const Template = (args) => <div>Not Yet Implemented</div>
const Template = (args) => <Visualization {...args} />

export const Default = Template.bind({})
// No props on this component.
// We pass in all data by mocking jQuery $.ajax calls made by PolisNet.
// See: .storybook/preview.js
Default.args = {}