Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -959,20 +959,13 @@ jobs:
if: steps.restore-tarball-cache.outputs.cache-hit != 'true'
run: yarn build:tarball

- name: Get node version
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hmm I thought we had e2e test apps running under different node versions than the repo-wide one. Is this still possible? Might have been a thing of the past though, so given our current test apps pass, no objections to the change!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

IMHO this should still be fine because this just publishes to verdaccio which should work with any node version we use in our matrix,I think 🤔

id: versions
run: |
echo "echo node=$(jq -r '.volta.node' dev-packages/e2e-tests/package.json)" >> $GITHUB_OUTPUT
- name: Validate Verdaccio
run: yarn test:validate
working-directory: dev-packages/e2e-tests

- name: Prepare Verdaccio
run: yarn test:prepare
working-directory: dev-packages/e2e-tests
env:
E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ steps.versions.outputs.node }}

- name: Copy to temp
run: yarn ci:copy-to-temp ./test-applications/${{ matrix.test-application }} ${{ runner.temp }}/test-application
Expand Down Expand Up @@ -1076,20 +1069,13 @@ jobs:
if: steps.restore-tarball-cache.outputs.cache-hit != 'true'
run: yarn build:tarball

- name: Get node version
id: versions
run: |
echo "echo node=$(jq -r '.volta.node' dev-packages/e2e-tests/package.json)" >> $GITHUB_OUTPUT
- name: Validate Verdaccio
run: yarn test:validate
working-directory: dev-packages/e2e-tests

- name: Prepare Verdaccio
run: yarn test:prepare
working-directory: dev-packages/e2e-tests
env:
E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ steps.versions.outputs.node }}

- name: Copy to temp
run: yarn ci:copy-to-temp ./test-applications/${{ matrix.test-application }} ${{ runner.temp }}/test-application
Expand Down
7 changes: 0 additions & 7 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,20 +140,13 @@ jobs:
path: ${{ env.CACHED_BUILD_PATHS }}
key: canary-${{ env.HEAD_COMMIT }}

- name: Get node version
id: versions
run: |
echo "echo node=$(jq -r '.volta.node' dev-packages/e2e-tests/package.json)" >> $GITHUB_OUTPUT

- name: Validate Verdaccio
run: yarn test:validate
working-directory: dev-packages/e2e-tests

- name: Prepare Verdaccio
run: yarn test:prepare
working-directory: dev-packages/e2e-tests
env:
E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ steps.versions.outputs.node }}

- name: Copy to temp
run: yarn ci:copy-to-temp ./test-applications/${{ matrix.test-application }} ${{ runner.temp }}/test-application
Expand Down
6 changes: 0 additions & 6 deletions dev-packages/e2e-tests/Dockerfile.publish-packages

This file was deleted.

1 change: 0 additions & 1 deletion dev-packages/e2e-tests/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ export const TEST_REGISTRY_CONTAINER_NAME = 'verdaccio-e2e-test-registry';
export const DEFAULT_BUILD_TIMEOUT_SECONDS = 60 * 5;
export const DEFAULT_TEST_TIMEOUT_SECONDS = 60 * 2;
export const VERDACCIO_VERSION = '5.22.1';
export const PUBLISH_PACKAGES_DOCKER_IMAGE_NAME = 'publish-packages';
41 changes: 41 additions & 0 deletions dev-packages/e2e-tests/lib/publishPackages.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* eslint-disable no-console */
import * as childProcess from 'child_process';
import { readFileSync } from 'fs';
import { globSync } from 'glob';
import * as path from 'path';

const repositoryRoot = path.resolve(__dirname, '../../..');

/**
* Publishes all built Sentry package tarballs to the local Verdaccio test registry.
*/
export function publishPackages(): void {
const version = (JSON.parse(readFileSync(path.join(__dirname, '../package.json'), 'utf8')) as { version: string })
.version;

// Get absolute paths of all the packages we want to publish to the fake registry
// Only include the current versions, to avoid getting old tarballs published as well
const packageTarballPaths = globSync(`packages/*/sentry-*-${version}.tgz`, {
cwd: repositoryRoot,
absolute: true,
});

if (packageTarballPaths.length === 0) {
throw new Error(`No packages to publish for version ${version}, did you run "yarn build:tarballs"?`);
}

const npmrc = path.join(__dirname, '../test-registry.npmrc');

for (const tarballPath of packageTarballPaths) {
console.log(`Publishing tarball ${tarballPath} ...`);
const result = childProcess.spawnSync('npm', ['--userconfig', npmrc, 'publish', tarballPath], {
cwd: repositoryRoot,
encoding: 'utf8',
stdio: 'inherit',
});

if (result.status !== 0) {
throw new Error(`Error publishing tarball ${tarballPath}`);
}
}
}
43 changes: 0 additions & 43 deletions dev-packages/e2e-tests/publish-packages.ts

This file was deleted.

58 changes: 3 additions & 55 deletions dev-packages/e2e-tests/registrySetup.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
/* eslint-disable no-console */
import * as childProcess from 'child_process';
import * as path from 'path';
import { PUBLISH_PACKAGES_DOCKER_IMAGE_NAME, TEST_REGISTRY_CONTAINER_NAME, VERDACCIO_VERSION } from './lib/constants';

const publishScriptNodeVersion = process.env.E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION;
const repositoryRoot = path.resolve(__dirname, '../..');
import { TEST_REGISTRY_CONTAINER_NAME, VERDACCIO_VERSION } from './lib/constants';
import { publishPackages } from './lib/publishPackages';

// https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#grouping-log-lines
function groupCIOutput(groupTitle: string, fn: () => void): void {
Expand Down Expand Up @@ -45,56 +42,7 @@ export function registrySetup(): void {
throw new Error('Start Registry Process failed.');
}

// Build container image that is uploading our packages to fake registry with specific Node.js/npm version
const buildPublishImageProcessResult = childProcess.spawnSync(
'docker',
[
'build',
'--tag',
PUBLISH_PACKAGES_DOCKER_IMAGE_NAME,
'--file',
'./Dockerfile.publish-packages',
...(publishScriptNodeVersion ? ['--build-arg', `NODE_VERSION=${publishScriptNodeVersion}`] : []),
'.',
],
{
encoding: 'utf8',
stdio: 'inherit',
},
);

if (buildPublishImageProcessResult.status !== 0) {
throw new Error('Build Publish Image failed.');
}

// Run container that uploads our packages to fake registry
const publishImageContainerRunProcess = childProcess.spawnSync(
'docker',
[
'run',
'--rm',
'-v',
`${repositoryRoot}:/sentry-javascript`,
'--network',
'host',
PUBLISH_PACKAGES_DOCKER_IMAGE_NAME,
],
{
encoding: 'utf8',
stdio: 'inherit',
},
);

const statusCode = publishImageContainerRunProcess.status;

if (statusCode !== 0) {
if (statusCode === 137) {
throw new Error(
`Publish Image Container failed with exit code ${statusCode}, possibly due to memory issues. Consider increasing the memory limit for the container.`,
);
}
throw new Error(`Publish Image Container failed with exit code ${statusCode}`);
}
publishPackages();
});

console.log('');
Expand Down
Loading