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

Re-add contracts/ to yarn workspace #547

Closed
bitbeckers opened this issue Apr 20, 2023 · 8 comments
Closed

Re-add contracts/ to yarn workspace #547

bitbeckers opened this issue Apr 20, 2023 · 8 comments
Assignees

Comments

@bitbeckers
Copy link
Contributor

bitbeckers commented Apr 20, 2023

Describe the feature you'd like to request

Build pipeline in GitHub Actions appears to be unstable. Kicking it again is a valid fix.

Describe the solution you'd like

Explore setting up concurrency for runs to make sure there are no overlapping build running, or that the build caches are influencing each other

Describe alternatives you've considered

Kicking it again.

Update: GitHub actions isn't flaky --- it's reliably failing. It does not affect local builds or Cloudflare.

@bitbeckers bitbeckers changed the title GitHub Actions concurrent builds GitHub Actions concurrent builds and cache management Apr 20, 2023
@ryscheng
Copy link
Member

the package.json dependencies already tell turbo what depends on what. but we do not properly tell turbo what outputs we need from each project
https://turbo.build/repo/docs/core-concepts/monorepos/configuring-workspaces#different-frameworks

I think this is worth trying when you get a chance, to specify the output directory of each project

@ryscheng
Copy link
Member

Just documenting some findings here

Cloudflare seems to build fine and if you look at the logs, it's properly managing dependencies:
build contracts/, then sdk/, then frontend/
https://dash.cloudflare.com/7945b7778b5bded36848bef067d27133/pages/view/hypercerts/786346ff-b590-4cb8-89cb-321e322b7cea

So that makes me feel like it may not be a turbo issue? Not sure...
But notice that turbo isn't even triggering a sdk or frontend build yet. This looks like it only gets to past yarn install, and is trying to do a yarn build in contracts/ and fails right then and there.
Weird

@ryscheng
Copy link
Member

Okay more findings.
When you dig into the logs for GitHub actions,
https://github.com/hypercerts-org/hypercerts/actions/runs/4770680000/jobs/8482098269?pr=559

Notice these logs:

@hypercerts-org/hypercerts-protocol:build: $ cross-env TS_NODE_TRANSPILE_ONLY=true hardhat compile && yarn build:ts && yarn build:declarations
@hypercerts-org/hypercerts-protocol:build: Downloading compiler 0.8.16
@hypercerts-org/hypercerts-protocol:build: $ npx tsc --build tsconfig.build.json

It appears to actually be skipping the hardhat compile step, which would explain the error, that Typescript cannot find the ABI files:

Error: @hypercerts-org/hypercerts-protocol:build: src/index.ts(10,47): error TS2307: Cannot find module '../abi/HypercertMinter.json' or its corresponding type declarations.

I think we're getting closer....

@ryscheng
Copy link
Member

Some verbose logging here:
https://github.com/hypercerts-org/hypercerts/actions/runs/4770769126/jobs/8482252948?pr=559

hypercerts-org/hypercerts-protocol:build: 2023-04-22T03:55:36.253Z hardhat:core:hre Running task compile:solidity:merge-compilation-jobs
@hypercerts-org/hypercerts-protocol:build: 2023-04-22T03:55:36.264Z hardhat:core:hre Running task compile:solidity:compile-jobs
@hypercerts-org/hypercerts-protocol:build: 2023-04-22T03:55:36.270Z hardhat:core:hre Running compile:solidity:compile-jobs's super
@hypercerts-org/hypercerts-protocol:build: 2023-04-22T03:55:36.270Z hardhat:core:tasks:compile Compiling 1 jobs
@hypercerts-org/hypercerts-protocol:build: 2023-04-22T03:55:36.271Z hardhat:core:hre Running task compile:solidity:compile-job
@hypercerts-org/hypercerts-protocol:build: 2023-04-22T03:55:36.271Z hardhat:core:tasks:compile Compiling job with version '0.8.16'
@hypercerts-org/hypercerts-protocol:build: 2023-04-22T03:55:36.271Z hardhat:core:hre Running task compile:solidity:get-compiler-input
@hypercerts-org/hypercerts-protocol:build: 2023-04-22T03:55:36.272Z hardhat:core:hre Running compile:solidity:get-compiler-input's super
@hypercerts-org/hypercerts-protocol:build: 2023-04-22T03:55:36.282Z hardhat:core:hre Running task compile:solidity:compile
@hypercerts-org/hypercerts-protocol:build: 2023-04-22T03:55:36.302Z hardhat:core:hre Running compile:solidity:compile's super
@hypercerts-org/hypercerts-protocol:build: 2023-04-22T03:55:36.303Z hardhat:core:hre Running task compile:solidity:solc:compile
@hypercerts-org/hypercerts-protocol:build: 2023-04-22T03:55:36.303Z hardhat:core:hre Running task compile:solidity:solc:get-build
@hypercerts-org/hypercerts-protocol:build: 2023-04-22T03:55:36.304Z hardhat:core:hre Running task compile:solidity:log:download-compiler-start
@hypercerts-org/hypercerts-protocol:build: Downloading compiler 0.8.16
@hypercerts-org/hypercerts-protocol:build: 2023-04-22T03:55:36.306Z hardhat:core:solidity:downloader Downloading compiler list for platform linux-amd64
@hypercerts-org/hypercerts-protocol:build: $ npx tsc --build tsconfig.build.json

I'm noticing that it fails silently after trying to download the compiler?
Very odd indeed.

@ryscheng
Copy link
Member

Filed a separate issue to talk about caching
#560

@ryscheng ryscheng changed the title GitHub Actions concurrent builds and cache management Re-add contracts/ to yarn workspace Apr 22, 2023
@ryscheng
Copy link
Member

ryscheng commented Apr 22, 2023

Okay, I think the initial issue was misdiagnosed.

There is something weird happening when we build contracts/ within a GitHub actions (see logs above), where there is a silent failure after trying to download the Solidity compiler. This doesn't seem to happen in local builds or even in Cloudflare. It does seem to also happen in Fleek builds.

As a temporary fix, I've removed contracts/ from the yarn workspace so it won't be built in the monorepo build (which is what runs in the GitHub action).
See #561

Going to re-scope this issue as trying to add contracts/ back into the monorepo build, by figuring out why the basic hardhat compile step silently fails when running in GitHub actions
CC @bitbeckers do you have any ideas? No need to spend a ton of time on this, just wanted to see if this rings a bell for you

@bitbeckers
Copy link
Contributor Author

The fix in #542 is to use rollup for the contracts dir and it's stable now. Hardhat now generates the typechain artifacts and ABI, those are used by rollup to build the package.

Not sure what was is but we at least identified the painpoint if it rises again

@ryscheng
Copy link
Member

ryscheng commented Apr 26, 2023

FYI @bitbeckers found the hardhat bug
NomicFoundation/hardhat#3877

The temporary fix is to fix our node version to 18.15.0 for now, which is annoying.
#595

I'm going to file another issue to go back to "lts" where we can in the future.
#596

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants