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

Use consistent CI tooling. Include recent local single-repo feature. #1

Merged
merged 35 commits into from
Aug 21, 2023

Conversation

joewagner
Copy link
Contributor

@joewagner joewagner commented Jul 18, 2023

Overview

This PR brings this repo up to date with the recent singular package repo feature additions, and also includes changes to linting and testing.

Details

The linting and testing changes are significant because each of the packages had slight variations on how that tooling was setup. The majority of the changes were bringing local and cli up to date with sdk

@joewagner
Copy link
Contributor Author

@carsonfarmer There's a ton of changes here, as such it's potentially better to just look at the state of the branch then look at the diff.
Everything works as expected for me locally, but unfortunately the test check just hangs forever. I'm going to try to setup a local github action runner and see if I can gain some insight into why the tests are hanging.
If you get a free cycle, it would be great to get feedback on how all of this is setup.

@joewagner
Copy link
Contributor Author

UPDATE:
I had to remove the SDK's playwright browser tests, but all tests are now passing (and even running in parallel). I'll take this out of draft aand if everything looks good we can start using this repo for releases.

@joewagner joewagner marked this pull request as ready for review August 8, 2023 00:08
@joewagner joewagner changed the title Working on cleaning up and re-using CI and tooling Use consistent CI tooling. Include recent local single-repo feature. Aug 8, 2023
export const TEST_TIMEOUT_FACTOR = getTimeoutFactor();
export const TEST_PROVIDER_URL = `http://127.0.0.1:${registryPort}`;
export const TEST_VALIDATOR_URL = "http://localhost:8082/api/v1";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using custom ports for each package so tests can run in parallel


const accounts = getAccounts();
const db = getDatabase(accounts[1]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because of the use of custom ports we can't use the default database connection anymore.

TEST_PROVIDER_URL,
"--chain",
"local-tableland",
];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The --chain flag was getting repeated for most of the tests, plus we need a way to specify the provider url that includes the custom port.

{
"Impl": "mesa",
"HTTP": {
"Port": "8082",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Each package's tests have their own validator config, which enables Lerna to run in parallel.


equal(resolverMock.calledOnce, true);
});

test("passes with GRANT statement", async function () {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These tests are an update that came from change to the singular repo in the last few weeks.

@@ -175,67 +220,97 @@ class LocalTableland {
console.log("\n\n*************************************\n");
}

async #_setReady() {
async #_setReady(): Promise<void> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The local tests were not written in typescript. As such there are a lot of changes that get typescript linting passing.

description: "Path the the Tableland Registry contract repository.",
},
docker: {
type: "boolean",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

"prepublishOnly": "npm run build",
"test": "mocha",
"test:browser": "PW_TS_ESM_ON=true playwright test",
"test": "npm run test:browser && mocha --exit",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not entirely sure why, but the github test workflow hangs forever if playwright tests are included. It may have to do with the custom ports for test networks, or some issue downloading the playwright test browsers. Either way, I wanted to get the transition to a monorepo done before looking into it anymore, so I've removed the requirement for browser tests from CI.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, yeh good idea. We can sort that out later.

// re-normalize so we can be sure we've isolated each statement and its tableId
const norm = await normalize(stmt);

if (norm.tables.length > 1) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I know this is from a previous PR, but we might want to explore handling more of this in the parser?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call!


export function jsonFileAliases(filepath: string): AliasesNameMap {
return {
read: async function (): Promise<NameMapping> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@joewagner joewagner requested a review from asutula August 11, 2023 16:41
@joewagner
Copy link
Contributor Author

@asutula I tagged you as a reviewer here. @carsonfarmer probably has the most context to do a review, but if this kind of setup works well I'd suggest that we setup studio in a similar way. Specifically, the app could be a package and the cli could be a package.

@joewagner
Copy link
Contributor Author

@carsonfarmer This PR is kind of a lot of changes, is there anything I can do to make it easier to review?

carsonfarmer
carsonfarmer previously approved these changes Aug 21, 2023
Copy link
Member

@carsonfarmer carsonfarmer left a comment

Choose a reason for hiding this comment

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

Ok, wow. This was a lot of work @joewagner! Really great stuff. Let's get this merged in, and we'll move forward from a unified point.

Really great work here, just a few tiny nits. We'll likely fine a few issues once we get this merged as well... so we can create separate issues for this as they crop up.

@@ -2,4 +2,7 @@
# the repo. Unless a later match takes precedence.
# By convention in @tablelandnetwork repos, the first listed
# CODEOWNER is the repo DRI (directly responsible individual)
* @joewagner @carsonfarmer @awmuncy
* @carsonfarmer @joewagner
* /packages/sdk/ @carsonfarmer @joewagner
Copy link
Member

Choose a reason for hiding this comment

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

Remove the *s on these lines

// process was already killed—it *is* possible with the validator process
// but doesn't seem to happen with the Registry
try {
// @ts-expect-error pic is possibly undefined, which is fine
Copy link
Member

Choose a reason for hiding this comment

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

should say pid

"prepublishOnly": "npm run build",
"test": "mocha",
"test:browser": "PW_TS_ESM_ON=true playwright test",
"test": "npm run test:browser && mocha --exit",
Copy link
Member

Choose a reason for hiding this comment

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

Ok, yeh good idea. We can sort that out later.

// re-normalize so we can be sure we've isolated each statement and its tableId
const norm = await normalize(stmt);

if (norm.tables.length > 1) {
Copy link
Member

Choose a reason for hiding this comment

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

I know this is from a previous PR, but we might want to explore handling more of this in the parser?

Copy link
Member

@carsonfarmer carsonfarmer left a comment

Choose a reason for hiding this comment

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

👍

@joewagner joewagner merged commit f123ece into main Aug 21, 2023
4 checks passed
@joewagner joewagner deleted the joe/init-setup branch August 21, 2023 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants