Skip to content

Commit

Permalink
Update release stats install/build executing
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Aug 25, 2023
1 parent 2de4569 commit fc92b3d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
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

0 comments on commit fc92b3d

Please sign in to comment.