Skip to content

Conversation

@himanshusinghs
Copy link
Contributor

Description

Earlier we were running check, build and tests on each OS in our matrix which did not allow us to test whether a build on ubuntu would work fine on Windows / MacOS or not.

With this commit we are re-organising to check and build once on ubuntu and use the final artifact later in the test job to run tests against.

Accordingly the test-and-build-from-fork and draft-release workflows have been modified to adapt the same change.

This PR simply re-organise the existing actions and does not introduce any install tests just yet. That will come in a different PR.

Checklist

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

Earlier snyk was never scanning the vscode project because of the
combination of project auto-detection and the presence of .vscode-test
folder which contains several directories with package.json files.

This commit disables the auto-detection so that snyk run tests on the
current project.

Additionally the current project was having a problem
with a package declaring optional dependencies. These optional
dependencies were platform specific so for any platform, all the
optional dependencies will never be installed, only the ones that are
platform compatible. Snyk requires what is declared in package-lock.json
to be also present in node_modules folder which is why it would've
failed. In the same commit, we added a pre and post test hook to remove
the identified problematic optional dependencies from package-lock file
before running the test and then restore it when the test is finished.
Earlier we were running check, build and tests on each OS in our matrix
which did not allow us to test whether a build on ubuntu would work fine
on Windows / MacOS or not.

With this commit we are re-organising to check and build once on ubuntu
and use the final artifact later in the test job to run tests against.

Accordingly the test-and-build-from-fork and draft-release workflows
have been modified to adapt the same change.
@himanshusinghs himanshusinghs force-pushed the chore/gh-actions-reorg-for-install-tests branch from dedcaad to de36329 Compare October 2, 2025 09:40
@tculig tculig marked this pull request as ready for review November 20, 2025 11:58
@tculig tculig requested a review from a team as a code owner November 20, 2025 11:58
@tculig tculig marked this pull request as draft November 20, 2025 12:00
@tculig tculig marked this pull request as ready for review November 20, 2025 14:03
Copy link
Contributor Author

@himanshusinghs himanshusinghs left a comment

Choose a reason for hiding this comment

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

I am unable to approve (as author) but looks good to me 👍. I added a small question for clarification.

Comment on lines 82 to 99
status-check:
name: Test and Build
runs-on: ubuntu-latest
needs: [build-and-package, test]
if: always()
steps:
- name: Check job results
run: |
if [ "${{ needs.build-and-package.result }}" == "failure" ] || [ "${{ needs.test.result }}" == "failure" ]; then
echo "One or more jobs failed"
exit 1
elif [ "${{ needs.build-and-package.result }}" == "cancelled" ] || [ "${{ needs.test.result }}" == "cancelled" ]; then
echo "One or more jobs were cancelled"
exit 1
else
echo "All jobs completed successfully or were skipped"
exit 0
fi
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Curious about this, why was this needed?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah this seems unnecessary

Copy link
Contributor

Choose a reason for hiding this comment

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

It was hanging without this. Perhaps there's a more elegant solution, but its not just AI slop. 😅

name: Test and Build
runs-on: ubuntu-latest
needs: [build-and-package, test]
if: always()
Copy link
Contributor

Choose a reason for hiding this comment

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

why have this if?

Copy link
Contributor

Choose a reason for hiding this comment

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

it was hanging, when running a normal build, this would start but never resolve, so the checks never passed.

@tculig tculig requested review from Copilot and gagik November 28, 2025 16:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@tculig tculig force-pushed the chore/gh-actions-reorg-for-install-tests branch from ee225c0 to 15d18f7 Compare December 1, 2025 12:19
Comment on lines 64 to 68
- name: Setup Node.js Environment
uses: actions/setup-node@v4
with:
node-version: 22.15.1
cache: npm
Copy link
Contributor

Choose a reason for hiding this comment

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

let's move this inside ./.github/workflows/actions/run-tests

Copy link
Contributor

Choose a reason for hiding this comment

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

Updated!

id: set-tag
run: echo "release-tag=${RELEASE_TAG}" >> $GITHUB_OUTPUT

- name: Upload updated package.json
Copy link
Contributor

@gagik gagik Dec 2, 2025

Choose a reason for hiding this comment

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

I'm confused by this; what is this for? Why would a draft release upload a package.json?
Is it so the version number is different? Then package-lock.json is also interesting to us, arguably more

Copy link
Contributor

Choose a reason for hiding this comment

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

The point is to build once and then use the built package for all subsequent tasks, namely running tests.
You are right about the package-lock file, I'll add it to the artifact..

Copy link
Contributor

Choose a reason for hiding this comment

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

can we move build-and-package into this instead? this job doesn't do much on its own otherwise.

Copy link
Contributor

@gagik gagik Dec 8, 2025

Choose a reason for hiding this comment

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

also I don't see how this would do much; node_modules would also be what we're looking for if we're trying to skip the install step

Comment on lines +128 to +142
- name: Create Jira Tickets
if: >
(
github.event_name == 'push' && github.ref == 'refs/heads/main' ||
github.event_name == 'workflow_dispatch' ||
github.event_name == 'schedule'
)
shell: bash
env:
JIRA_API_TOKEN: ${{ inputs.JIRA_API_TOKEN }}
JIRA_BASE_URL: "https://jira.mongodb.org"
JIRA_PROJECT: "VSCODE"
JIRA_VULNERABILITY_BUILD_INFO: "- [GitHub Run|https://github.com/mongodb-js/vscode/actions/runs/${{github.run_id}}/jobs/${{github.job}}]"
run: |
pnpm run create-vulnerability-tickets > /dev/null
Copy link
Contributor

Choose a reason for hiding this comment

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

this is broken right now, I found out the hard way just now #1196

@tculig tculig requested review from a team and gagik December 8, 2025 11:57
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