Skip to content

Commit

Permalink
chore: fix intermittent timeouts in osx test runners (#6007)
Browse files Browse the repository at this point in the history
* chore: workflow steps are no longer relevant

* fix: hoist build import to top of file

* test: use serial only for macosx and only in github actions
  • Loading branch information
mrstork authored Jan 7, 2025
1 parent 47b8fef commit eee459c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ jobs:
deno-version: 'v1.46.3'
fail-fast: false
steps:
# Increasing the maximum number of open files. See:
# https://github.com/actions/virtual-environments/issues/268
- name: Increase open file limit
run: sudo ulimit -Sn 65536
if: "${{ matrix.os == 'macos-14' }}"
- run: git config --global core.symlinks true
# Sets an output parameter if this is a release PR
- name: Check for release
id: release-check
Expand Down
6 changes: 6 additions & 0 deletions packages/build/ava.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { platform } from 'node:os'
import { env } from 'node:process'

import baseConfig from '../../ava.base.js'

const config = {
...baseConfig,
files: ['tests/**/tests.{cjs,mjs,js}'],
// github action runners for osx have lower memory than windows/linux
// https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
serial: env.GITHUB_ACTIONS && platform() === 'darwin',
}

export default config
4 changes: 1 addition & 3 deletions packages/testing/src/fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { normalize, delimiter } from 'path'
import { env } from 'process'
import { fileURLToPath } from 'url'

import { default as build, startDev } from '@netlify/build'
import test from 'ava'
import cpy from 'cpy'
import { execa, execaCommand } from 'execa'
Expand Down Expand Up @@ -194,7 +195,6 @@ export class Fixture {

/** Runs @netlify/build main function programmatic with the provided flags */
async runBuildProgrammatic(): Promise<object> {
const { default: build } = await import('@netlify/build')
return await build(this.getBuildFlags())
}

Expand All @@ -204,7 +204,6 @@ export class Fixture {
}

async runWithBuildAndIntrospect() {
const { default: build } = await import('@netlify/build')
const buildResult = await build(this.getBuildFlags())
const output = [buildResult.logs?.stdout.join('\n'), buildResult.logs?.stderr.join('\n')]
.filter(Boolean)
Expand All @@ -218,7 +217,6 @@ export class Fixture {

// TODO: provide better typing if we know what's possible
async runDev(devCommand: unknown): Promise<string> {
const { startDev } = await import('@netlify/build')
const entryPoint = startDev.bind(null, devCommand)
const { logs } = await entryPoint(this.getBuildFlags())
return [logs.stdout.join('\n'), logs.stderr.join('\n')].filter(Boolean).join('\n\n')
Expand Down

0 comments on commit eee459c

Please sign in to comment.