Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update release stats install/build executing #54576

Merged
merged 1 commit into from
Aug 25, 2023
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
20 changes: 6 additions & 14 deletions .github/actions/next-stats-action/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,8 @@ const addComment = require('./add-comment')
const actionInfo = require('./prepare/action-info')()
const { mainRepoDir, diffRepoDir } = require('./constants')
const loadStatsConfig = require('./prepare/load-stats-config')
const {
cloneRepo,
checkoutRef,
mergeBranch,
getCommitId,
linkPackages,
getLastStable,
} = require('./prepare/repo-setup')(actionInfo)
const { cloneRepo, mergeBranch, getCommitId, linkPackages, getLastStable } =
require('./prepare/repo-setup')(actionInfo)

const allowedActions = new Set(['synchronize', 'opened'])

Expand Down Expand Up @@ -109,21 +103,19 @@ if (!allowedActions.has(actionInfo.actionName) && !actionInfo.isRelease) {
const usePnpm = await fs.pathExists(path.join(dir, 'pnpm-lock.yaml'))

if (!statsConfig.skipInitialInstall) {
await exec(
await exec.spawnPromise(
`cd ${dir}${
usePnpm
? // --no-frozen-lockfile is used here to tolerate lockfile
// changes from merging latest changes
` && pnpm install --no-frozen-lockfile`
: ' && yarn install --network-timeout 1000000'
}`,
false
}`
)

await exec(
await exec.spawnPromise(
statsConfig.initialBuildCommand ||
`cd ${dir} && ${usePnpm ? 'pnpm build' : 'echo built'}`,
false
`cd ${dir} && ${usePnpm ? 'pnpm build' : 'echo built'}`
)
}
}
Expand Down
14 changes: 14 additions & 0 deletions .github/actions/next-stats-action/src/util/exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,18 @@ exec.spawn = function spawn(command = '', opts = {}) {
return child
}

exec.spawnPromise = function spawnPromise(command = '', opts = {}) {
return new Promise((resolve, reject) => {
const child = exec.spawn(command)
child.on('exit', (code, signal) => {
if (code || signal) {
return reject(
new Error(`bad exit code/signal code: ${code} signal: ${signal}`)
)
}
resolve()
})
})
}

module.exports = exec
2 changes: 2 additions & 0 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ jobs:

name: stable - ${{ matrix.settings.target }} - node@16
runs-on: ${{ matrix.settings.host }}
timeout-minutes: 30
steps:
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
Expand Down Expand Up @@ -509,6 +510,7 @@ jobs:
- 'linux'
- 'x64'
- 'metal'
timeout-minutes: 25
needs: [publishRelease]
steps:
- uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pull_request_stats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
stats:
name: PR Stats
needs: build
timeout-minutes: 25
runs-on:
- 'self-hosted'
- 'linux'
Expand Down