Skip to content

Conversation

@klewis-sfdc
Copy link
Contributor

@klewis-sfdc klewis-sfdc commented Nov 11, 2022

What does this PR do?

Adds Github Actions workflows to this repo, which were done using CircleCI when this project lived at forcedotcom/salesforcedx-apex.

What issues does this PR fix or reference?

Implements CI using Github Actions. Directory initially copied from salesforcecli/plugin-template.

This PR also updates the versions of @salesforce/core and @salesforce/apex-node used by the plugin.

@W-11309523@

@randi274
Copy link
Collaborator

@klewis-sfdc I actually don't think we want to manage the plugin github actions ourselves. I would recommend a PR adding this instead to the Leif repo, so this can be added to the list of centrally managed repos that the CLI team manages: https://github.com/salesforcecli/leif/blob/main/weekly-leif.yml

@klewis-sfdc
Copy link
Contributor Author

Thanks for reviewing the PR @randi274. It looks to me like leif used to sync github actions, but no longer does: https://github.com/salesforcecli/leif/pull/53/files

@klewis-sfdc klewis-sfdc marked this pull request as draft November 17, 2022 00:11
@klewis-sfdc klewis-sfdc marked this pull request as ready for review December 7, 2022 23:04
expect(ctx.stderr).to.include(messages.getMessage('warningMessage'));
}
);
.command(['force:apex:test:run', '--tests', 'MyApexClass.testInsertTrigger', '--outputdir', outDir, '-r', 'human'])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Replacing 'my/path/to/dir' with outDir here is the change that was made to get the Windows unit tests passing. This is changed in 3 places. The rest of the changes in this file are prettier formatting changes.

} from './testData';
import { tmpdir } from 'os';

const outDir = tmpdir();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Importing tmpdir and using it as the --outputdir value in the three tests below that were using 'my/path/to/dir' got the Windows unit tests passing on the GHA build.

"name": "Attach to Remote",
"address": "127.0.0.1",
"port": 9229,
"skipFiles": ["<node_internals>/**"]
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know enough about this file's config. Is there a reason you removed skipFiles?

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 must have added skip files while copying from elsewhere during dev. In the launch.json in the old monorepo, this configuration did not have the skipFiles property present: https://github.com/forcedotcom/salesforcedx-apex/blob/be31310f9ad92e8a13e876ad98efbab65b68463f/.vscode/launch.json#L10

@iowillhoit
Copy link
Contributor

Could you please do a code search locally for salesforcedx and clean up those references.
Here is our "bugs" repo for the package.json: "bugs": "https://github.com/forcedotcom/cli/issues",

@iowillhoit
Copy link
Contributor

You've got some failing actions because the compile scripts is not in your package.json. Here is a good list of default scripts for a plugin: https://github.com/salesforcecli/plugin-template-sf/blob/main/package.json#L84

package.json Outdated
"@salesforce/command": "^5.1.0",
"@salesforce/core": "^3.23.3",
"chalk": "^4.1.0",
"tslib": "^1"
Copy link
Contributor

Choose a reason for hiding this comment

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

Update to tslib ^2 please

@klewis-sfdc
Copy link
Contributor Author

I did some QA on this branch today:

  • Installed and built the apex-node library (after bumping the @salesforce/core dependency to "^3.32.12"
  • Linked the local apex-node lib to the plugin-apex lib locally (using the same version of core in the package.json of the plugin ("^3.32.12")
  • Linked the locally built plugin to the cli globally using sfdx plugins:link
  • Turned on logs, ran a deployment to the default scratch org, then ran sfdx force:apex:log:get -n 2, saw the logs get printed in the output ✅
  • Ran sfdx force:apex:log:list, saw the list of logs get printed in the output ✅
  • Ran sfdx force:apex:test:run ✅
    • Then ran sfdx force:apex:test:report -i, saw Test Results reported in the output ✅
  • Ran sfdx force:apex:execute, saw the anonymous Apex get executed and the log get printed to the output ✅

@klewis-sfdc klewis-sfdc changed the title chore: add github actions feat: Add Github Actions and Update Dependency Versions Jan 12, 2023
@klewis-sfdc
Copy link
Contributor Author

I bumped the version of @salesforce/core in the apex-node library so that it uses the same version as this library. I then updated this library to use the new version of apex-node, which is 1.6. This PR now builds successfully after a yarn install and yarn compile. I tested with these versions installed yesterday, and everything was looking good.

@iowillhoit Let me know if you see anything else that needs to be done before merging this PR and completing the handoff. Thanks for all of your help with this!

Copy link
Contributor

@iowillhoit iowillhoit left a comment

Choose a reason for hiding this comment

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

Thanks Kenneth! I ran some QA too and things are looking great. Approving the PR, merge when you are are ready 🎉

@klewis-sfdc klewis-sfdc merged commit 9f27d5f into main Jan 17, 2023
@iowillhoit iowillhoit deleted the ken/github-actions branch January 17, 2023 19:10
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.

4 participants