chore(artifact): keep runtime dependency fix minimal
Remove the packed-package test, CI step, and related documentation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
1 parent
0e77576622
commit
7b81ecbf50
3 files changed
-85
No files matched your search
@@ -29,13 +29,6 @@ To run unit tests for the `@actions/artifact` package:
|
|||||||
3. Change working directory to `packages/artifact`
|
3. Change working directory to `packages/artifact`
|
||||||
4. Run jest tests: `npm run test`
|
4. Run jest tests: `npm run test`
|
||||||
|
|
||||||
After building the package, run `npm run test:package` from `packages/artifact`
|
|
||||||
to pack it, install it in a temporary consumer with only production dependencies,
|
|
||||||
and check that its public entry point and protobuf RPC runtime can be imported.
|
|
||||||
This check requires access to the npm registry and also runs in the unit-test CI
|
|
||||||
matrix, without monorepo hoisting or code-generation tooling masking missing
|
|
||||||
runtime dependencies.
|
|
||||||
|
|
||||||
## Within upload-artifact or download-artifact actions
|
## Within upload-artifact or download-artifact actions
|
||||||
|
|
||||||
Any easy way to test changes for the official upload/download actions is to fork them, compile changes and run them.
|
Any easy way to test changes for the official upload/download actions is to fork them, compile changes and run them.
|
||||||
|
|||||||
@@ -38,7 +38,6 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
|
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
|
||||||
"test": "cd ../../ && npm run test ./packages/artifact",
|
"test": "cd ../../ && npm run test ./packages/artifact",
|
||||||
"test:package": "node scripts/test-package.mjs",
|
|
||||||
"bootstrap": "cd ../../ && npm run bootstrap",
|
"bootstrap": "cd ../../ && npm run bootstrap",
|
||||||
"tsc-run": "tsc && cp src/internal/shared/package-version.cjs lib/internal/shared/",
|
"tsc-run": "tsc && cp src/internal/shared/package-version.cjs lib/internal/shared/",
|
||||||
"tsc": "npm run bootstrap && npm run tsc-run",
|
"tsc": "npm run bootstrap && npm run tsc-run",
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
import assert from 'node:assert/strict'
|
|
||||||
import {execFileSync} from 'node:child_process'
|
|
||||||
import {mkdtempSync, readFileSync, rmSync} from 'node:fs'
|
|
||||||
import {tmpdir} from 'node:os'
|
|
||||||
import {join} from 'node:path'
|
|
||||||
import {fileURLToPath} from 'node:url'
|
|
||||||
|
|
||||||
const packageDirectory = fileURLToPath(new URL('../', import.meta.url))
|
|
||||||
const npm = process.env.npm_execpath
|
|
||||||
assert.ok(npm, 'Run this check with npm run test:package')
|
|
||||||
|
|
||||||
const consumer = mkdtempSync(join(tmpdir(), 'artifact-package-'))
|
|
||||||
const env = {...process.env}
|
|
||||||
delete env.NODE_PATH
|
|
||||||
|
|
||||||
function runNpm(args, cwd) {
|
|
||||||
return execFileSync(process.execPath, [npm, ...args], {
|
|
||||||
cwd,
|
|
||||||
env,
|
|
||||||
encoding: 'utf8'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const [{filename}] = JSON.parse(
|
|
||||||
runNpm(
|
|
||||||
['pack', '--json', '--ignore-scripts', '--pack-destination', consumer],
|
|
||||||
packageDirectory
|
|
||||||
)
|
|
||||||
)
|
|
||||||
runNpm(
|
|
||||||
[
|
|
||||||
'install',
|
|
||||||
'--omit=dev',
|
|
||||||
'--ignore-scripts',
|
|
||||||
'--no-audit',
|
|
||||||
'--no-fund',
|
|
||||||
'--package-lock=false',
|
|
||||||
join(consumer, filename)
|
|
||||||
],
|
|
||||||
consumer
|
|
||||||
)
|
|
||||||
|
|
||||||
const manifest = JSON.parse(
|
|
||||||
readFileSync(
|
|
||||||
join(consumer, 'node_modules/@actions/artifact/package.json'),
|
|
||||||
'utf8'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
assert.equal(manifest.dependencies['@protobuf-ts/runtime-rpc'], '^2.11.1')
|
|
||||||
execFileSync(
|
|
||||||
process.execPath,
|
|
||||||
[
|
|
||||||
'--input-type=module',
|
|
||||||
'--eval',
|
|
||||||
`
|
|
||||||
import assert from 'node:assert/strict'
|
|
||||||
import {createRequire} from 'node:module'
|
|
||||||
import client, {DefaultArtifactClient} from '@actions/artifact'
|
|
||||||
import {ServiceType} from '@protobuf-ts/runtime-rpc'
|
|
||||||
|
|
||||||
assert.ok(client instanceof DefaultArtifactClient)
|
|
||||||
assert.equal(typeof ServiceType, 'function')
|
|
||||||
const require = createRequire(import.meta.url)
|
|
||||||
assert.throws(() => require.resolve('@protobuf-ts/plugin'), {
|
|
||||||
code: 'MODULE_NOT_FOUND'
|
|
||||||
})
|
|
||||||
`
|
|
||||||
],
|
|
||||||
{cwd: consumer, env, stdio: 'inherit'}
|
|
||||||
)
|
|
||||||
console.log(
|
|
||||||
'Packed artifact imports successfully with production dependencies'
|
|
||||||
)
|
|
||||||
} finally {
|
|
||||||
rmSync(consumer, {recursive: true, force: true})
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user