Skip to content

Commit

Permalink
dont run smoke publish on mac ci
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed May 9, 2024
1 parent f15d852 commit 7228ee8
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 32 deletions.
19 changes: 1 addition & 18 deletions .github/workflows/ci-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,29 +162,12 @@ jobs:
- name: Linux
os: ubuntu-latest
shell: bash
- name: macOS
os: macos-latest
shell: bash
- name: macOS
os: macos-13
shell: bash
node-version:
- 18.17.0
- 18.x
- 20.5.0
- 20.x
- 22.x
exclude:
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 18.17.0
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 18.x
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 20.5.0
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 20.x
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 22.x
runs-on: ${{ matrix.platform.os }}
defaults:
run:
Expand Down Expand Up @@ -221,7 +204,7 @@ jobs:
run: ./scripts/smoke-publish-test.sh
- name: Conclude Check
uses: LouisBrunner/[email protected]
if: always()
if: steps.create-check.outputs.check-id && always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
conclusion: ${{ job.status }}
Expand Down
8 changes: 4 additions & 4 deletions mock-registry/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ class MockRegistry {
})
}

async package ({ manifest, times = 1, query, tarballs, tarballTimes = 1 }) {
async package ({ manifest, times = 1, query, tarballs }) {
let nock = this.nock
const spec = npa(manifest.name)
nock = nock.get(this.fullPath(`/${spec.escapedName}`)).times(times)
Expand All @@ -380,17 +380,17 @@ class MockRegistry {
if (tarballs) {
for (const [version, tarball] of Object.entries(tarballs)) {
const m = manifest.versions[version]
nock = await this.tarball({ manifest: m, tarball, times: tarballTimes })
nock = await this.tarball({ manifest: m, tarball })
}
}
this.nock = nock
}

async tarball ({ manifest, tarball, times = 1 }) {
async tarball ({ manifest, tarball }) {
const nock = this.nock
const dist = new URL(manifest.dist.tarball)
const tar = await pacote.tarball(tarball, { Arborist })
nock.get(this.fullPath(dist.pathname)).times(times).reply(200, tar)
nock.get(this.fullPath(dist.pathname)).reply(200, tar)
return nock
}

Expand Down
4 changes: 2 additions & 2 deletions scripts/smoke-publish-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ node . install -w smoke-tests --ignore-scripts --no-audit --no-fund
# debugging locally when we want to pass args to the smoke-tests to limit the
# files being run or grep a test, etc. Also now set CI=true so we get more
# debug output in our tap tests
CI="true" SMOKE_PUBLISH_NPM="1" SMOKE_PUBLISH_TARBALL="$NPM_TARBALL" npm test \
CI="true" SMOKE_PUBLISH_TARBALL="$NPM_TARBALL" npm test \
-w smoke-tests \
--ignore-scripts \
-- -Rtap "$@"
-- "$@"
3 changes: 2 additions & 1 deletion scripts/template-oss/ci-release-yml.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
jobCheckout=(obj ref="${{ inputs.ref }}")
jobCreateCheck=(obj sha="${{ inputs.check-sha }}")
windowsCI=false
macCI=false
}}
- name: Smoke Publish
run: ./scripts/smoke-publish-test.sh
- name: Conclude Check
uses: LouisBrunner/[email protected]
if: always()
if: steps.create-check.outputs.check-id && always()
with:
token: $\{{ secrets.GITHUB_TOKEN }}
conclusion: $\{{ job.status }}
Expand Down
10 changes: 5 additions & 5 deletions smoke-tests/test/fixtures/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const MockRegistry = require('@npmcli/mock-registry')
const http = require('http')
const { createProxy } = require('proxy')

const { SMOKE_PUBLISH_NPM, SMOKE_PUBLISH_TARBALL, CI, PATH, Path } = process.env
const { SMOKE_PUBLISH_TARBALL, CI, PATH, Path } = process.env

const DEFAULT_REGISTRY = new URL('https://registry.npmjs.org/')
const MOCK_REGISTRY = new URL('http://smoke-test-registry.club/')
Expand Down Expand Up @@ -75,7 +75,7 @@ const getCleanPaths = async () => {

module.exports = async (t, { testdir = {}, debug, mockRegistry = true, useProxy = false } = {}) => {
const debugLog = debug || CI ? (...a) => t.comment(...a) : () => {}
debugLog({ SMOKE_PUBLISH_NPM, SMOKE_PUBLISH_TARBALL, CI })
debugLog({ SMOKE_PUBLISH_TARBALL, CI })

const cleanPaths = await getCleanPaths()

Expand Down Expand Up @@ -219,7 +219,7 @@ module.exports = async (t, { testdir = {}, debug, mockRegistry = true, useProxy

const npmLocal = async (...args) => {
const [{ force = false }] = getOpts(...args)
if (SMOKE_PUBLISH_NPM && !force) {
if (SMOKE_PUBLISH_TARBALL && !force) {
throw new Error('npmLocal cannot be called during smoke-publish')
}
return baseNpm({
Expand Down Expand Up @@ -251,7 +251,7 @@ module.exports = async (t, { testdir = {}, debug, mockRegistry = true, useProxy
return {
npmPath,
npmLocal,
npm: SMOKE_PUBLISH_NPM ? npmPath : npm,
npm: SMOKE_PUBLISH_TARBALL ? npmPath : npm,
spawn: baseSpawn,
readFile,
getPath,
Expand All @@ -269,6 +269,6 @@ module.exports.testdir = testdirHelper
module.exports.getNpmRoot = getNpmRoot
module.exports.CLI_ROOT = CLI_ROOT
module.exports.WINDOWS = WINDOWS
module.exports.SMOKE_PUBLISH = !!SMOKE_PUBLISH_NPM
module.exports.SMOKE_PUBLISH = !!SMOKE_PUBLISH_TARBALL
module.exports.SMOKE_PUBLISH_TARBALL = SMOKE_PUBLISH_TARBALL
module.exports.MOCK_REGISTRY = MOCK_REGISTRY
3 changes: 1 addition & 2 deletions smoke-tests/test/npm-replace-global.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,11 @@ t.test('publish and replace global self', async t => {
})
}

const npmInstall = async (useNpm, opts) => {
const npmInstall = async (useNpm) => {
await npmPackage({
manifest: { packuments: [publishedPackument] },
tarballs: { [version]: tarball },
times: 3,
...opts,
})
await fs.rm(cache, { recursive: true, force: true })
await useNpm('install', 'npm@latest', '--global')
Expand Down

0 comments on commit 7228ee8

Please sign in to comment.