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

@W-14093557@: Better E2E, integration, and smoke tests #14

Merged
merged 2 commits into from
Sep 20, 2023

Conversation

jfeingold35
Copy link
Collaborator

@jfeingold35 jfeingold35 commented Sep 18, 2023

This PR does the following:

  • Adds some new E2E tests to cover more commands (still room for more in the future, but acceptable for now).
  • Adds a new workflow (build-scanner-tarball.yml) that can clone sfdx-scanner, check out a specified branch, build a tarball from that branch, and upload it as an artifact.
  • Changes the run-tests.yml workflow so it can install either the production version of sfdx-scanner or a tarball generated by a preceding invocation of build-scanner-tarball.
  • Adds a new workflow (daily-smoke-test.yml) that runs the unit tests every day at 13:30 UTC (i.e., 8:30AM CDT). This workflow uses a locally-built scanner tarball.
  • validate-pr.yml is now set to use the locally-built tarball for tests.
  • publishVSCode.yml has been changed to run the tests against the production scanner before publishing can proceed. This prevents us from accidentally publishing something incompatible with the currently-live version of the scanner.

@jfeingold35 jfeingold35 changed the title @W-14093557@: Moving tests into reusable composite action. @W-14093557@: Better E2E, integration, and smoke tests Sep 20, 2023
@jfeingold35 jfeingold35 marked this pull request as ready for review September 20, 2023 19:02
default: "dev"

jobs:
build-tarball:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This job is basically identical to the scanner repo's build-dependencies job.

shell: bash
run: |
# Determine the tarball's name.
TARBALL_NAME=$(ls ~/downloads/tarball/sfdx-scanner | grep salesforce-sfdx-scanner-[0-9]*\\.[0-9]*\\.[0-9]*\\.tgz)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The only key difference between this step and the equivalent step in sfdx-scanner is that we look for the tarball in ~/downloads/tarball/sfdx-scanner instead of ~/downloads/tarball. This extra folder is added as a consequence of having to clone the repo via git clone instead of just using the actions/checkout@v3 command.

DOWNLOAD_PATH=`[[ $DOWNLOAD_PATH = C* ]] && echo $DOWNLOAD_PATH | cut -d':' -f 2 || echo $DOWNLOAD_PATH`
echo $DOWNLOAD_PATH
# Pipe in a `y` to simulate agreeing to install an unsigned package. Use a URI of the file's full path.
echo y | sfdx plugins:install "file://${DOWNLOAD_PATH}/sfdx-scanner/${TARBALL_NAME}"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Again, we add sfdx-scanner to the path instead of just using the download path and tarball name, because of nuances related to git clone.

with:
# For daily builds, we want to make sure we haven't pushed a breaking change
# to the scanner's `dev` branch.
use-scanner-tarball: true
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Smoke tests use the local tarball.

with:
# We want to validate the extension against whatever version of the scanner we
# *plan* to publish, not what's *already* published.
use-scanner-tarball: true
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

PR validation uses the locally built tarball.

@jfeingold35 jfeingold35 merged commit 00c886c into main Sep 20, 2023
18 checks passed
@jfeingold35 jfeingold35 deleted the d/W-14093557 branch May 16, 2024 20:14
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