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

Call dev server for dev action runs #31

Merged
merged 13 commits into from
Dec 8, 2022
Merged

Call dev server for dev action runs #31

merged 13 commits into from
Dec 8, 2022

Conversation

tuliren
Copy link
Member

@tuliren tuliren commented Dec 7, 2022

Summary

TODOs

  • Write unit test.
  • Test if the dev server is up and running.

@tuliren tuliren marked this pull request as ready for review December 7, 2022 09:42
@stoat-app
Copy link

stoat-app bot commented Dec 7, 2022

Easy and customizable dashboards for your build system. Learn more about Stoat ↗︎

Static Hosting

Name Link Commit Status
CLI Test Coverage Visit 95e0edb
Action Test Coverage Visit 95e0edb

Job Runtime

debug

@tuliren tuliren changed the title Route to dev server Call dev server for dev action runs Dec 7, 2022
@vercel
Copy link

vercel bot commented Dec 7, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
docs ✅ Ready (Inspect) Visit Preview Dec 7, 2022 at 10:09AM (UTC)


core.warning(`Fall back from "${devApiUrlBase}" to ${PROD_API_URL_BASE}`);
return PROD_API_URL_BASE;
};

export async function waitForShaToMatch(repoSha: string) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be used for dev servers and prod tests on internal repos to make sure it's testing against the correct commit? It looks like its usage was removed at some point and PROD_API_URL_BASE doesn't cover all cases.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, waiting for SHA works for actions triggered by the stoat project. However, it does not work for actions triggered by the stoat-action project, and the action project has no idea what the dev SHA should be on the server, which is only available in the stoat project.

I will add the SHA waiting mechanism back.

Comment on lines +7 to +8
jest.mock('cross-fetch', () => jest.fn());
const mockFetch = fetch as jest.MockedFunction<typeof fetch>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL

Copy link
Member Author

@tuliren tuliren Dec 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured out that as long as the code and the jest test import fetch from the same module (cross-fetch here), the mock works. Previously it did not work because I was importing fetch from node-fetch.

@tuliren
Copy link
Member Author

tuliren commented Dec 8, 2022

I will merge the two PRs now, and add SHA waiting in a separate PR. The separate PR can be used as another production test and may reveal some bugs.

@tuliren tuliren merged commit ca69c27 into main Dec 8, 2022
@tuliren tuliren deleted the liren/dev-workflow branch December 8, 2022 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants