Skip to content

Commit

Permalink
Cherry-pick CI improvements to release branch (#8743)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhofman authored Jan 19, 2024
2 parents b0c1f78 + 44cbe2c commit 5db2a2c
Show file tree
Hide file tree
Showing 51 changed files with 4,208 additions and 1,586 deletions.
9 changes: 1 addition & 8 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ module.exports = {
{
files: ['*.ts'],
rules: {
'jsdoc/require-param-type': 'off',
// TS has this covered and eslint gets it wrong
'no-undef': 'off',
},
Expand All @@ -119,13 +120,5 @@ module.exports = {
project: false,
},
},
{
files: ['packages/**/upgrade-test-scripts/**/*.*js'],
rules: {
// NOTE: This rule is enabled for the repository in general. We turn it
// off for test code for now.
'@jessie.js/safe-await-separator': 'off',
},
},
],
};
82 changes: 82 additions & 0 deletions .github/actions/get-latest-check/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Get latest check
description: "Get the latest integration-test-result check associated with the workflow's commit"

inputs:
create-if-needed:
description: 'Create a new check if a previous check is not suitable'
default: false

outputs:
run_id:
description: 'The id of the integration-test-result check'
value: ${{ steps.attach-check.outputs.result }}

runs:
using: composite
steps:
- name: Attach integration-test-result check
id: attach-check
uses: actions/github-script@v6
env:
CREATE_IF_NEEDED: '${{ inputs.create-if-needed }}'
with:
result-encoding: string
script: |
let createIfNeeded = process.env.CREATE_IF_NEEDED === 'true'
let runId;
const currentWorkflowRunUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`
const head_sha = context.eventName === 'pull_request' ?
context.payload.pull_request.head.sha : context.sha
async function attachRun(run) {
if (!run) {
core.setFailed(`No integration-test-result check found for commit ${head_sha}`)
return
}
console.log('Latest integration-test-result check run:', run.html_url)
if (run.status === 'completed') {
core.setFailed(`Latest integration-test-result check status is already completed`)
return
}
if (run.output.summary) {
if (run.output.summary.includes(currentWorkflowRunUrl)) {
console.log('Latest integration-test-result check is already attached to this workflow run, using.')
return run.id
} else {
core.setFailed(`Latest integration-test-result check found attached to workflow run: ${run.output.summary}`)
return
}
}
const res = await github.rest.checks.update({
...context.repo,
check_run_id: run.id,
output: {
title: 'Integration Test Aggregate Result',
summary: `Synthetic check capturing the result of the <a href="${currentWorkflowRunUrl}">integration-test workflow run</a>`,
},
})
console.log(`Attached integration-test-result check to this workflow run`)
return run.id
}
const runs = await github.paginate(github.rest.checks.listForRef, {
...context.repo,
ref: head_sha,
check_name: "integration-test-result",
})
core.debug(`integration-test-result check runs: ${JSON.stringify(runs, null, 2)}`)
runId = await attachRun(runs.sort((a, b) => Date.parse(b.started_at) - Date.parse(a.started_at))[0])
if (!runId && createIfNeeded) {
process.exitCode = 0
const res = await github.rest.checks.create({
...context.repo,
head_sha,
name: "integration-test-result",
})
core.debug('check create response: ${JSON.stringify(res, null, 2)}')
console.log('created integration-test-result check:', res.data.html_url)
runId = await attachRun(res.data)
}
return runId
11 changes: 6 additions & 5 deletions .github/actions/notify-status/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ description: 'Notify on actions status'
inputs:
from:
description: 'The email address to send the notification from'
required: true
required: false
to:
description: 'Recipients'
required: true
required: false
password:
description: 'Sendgrid Password'
required: true
required: false
webhook:
description: 'Slack webhook URL'
required: true
Expand All @@ -19,7 +19,8 @@ runs:
using: composite
steps:
- name: send ${{ job.status }} email
uses: dawidd6/action-send-mail@v2
if: ${{ inputs.to != '' }}
uses: dawidd6/action-send-mail@v3
with:
# mail server settings
server_address: smtp.sendgrid.net
Expand All @@ -42,7 +43,7 @@ runs:
from: ${{ inputs.from }}
- name: Send GitHub trigger payload
id: slack
uses: slackapi/slack-github-action@v1.18.0
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
Expand Down
11 changes: 0 additions & 11 deletions .github/actions/restore-golang/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,7 @@ runs:
with:
cache-dependency-path: ${{ inputs.path }}/golang/cosmos/go.sum
go-version: ${{ inputs.go-version }}
- uses: kenchan0130/actions-system-info@master
id: system-info
- name: cache Go modules
id: cache
uses: actions/cache@v3
with:
path: ${{ env.GOPATH }}/pkg/mod
key: ${{ runner.os }}-${{ runner.arch }}-${{ steps.system-info.outputs.release }}-go-${{ inputs.go-version }}-built-${{ hashFiles('golang/**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-${{ steps.system-info.outputs.release }}-go-${{ inputs.go-version }}-built-
- name: go mod download
working-directory: ${{ inputs.path }}/golang/cosmos
run: go mod download
shell: bash
if: steps.cache.outputs.cache-hit != 'true'
42 changes: 34 additions & 8 deletions .github/actions/restore-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ inputs:
required: false
default: '0'

outputs:
endo-branch:
description: 'The branch of Endo used (NOPE if no override)'
value: ${{ steps.endo-branch.outputs.result }}

runs:
using: composite
steps:
Expand All @@ -26,13 +31,13 @@ runs:
shell: bash
- uses: actions/checkout@v3
with:
clean: 'false'
clean: false
submodules: 'true'
persist-credentials: false
path: ${{ inputs.path }}
# Select a branch on Endo to test against by adding text to the body of the
# pull request. For example: #endo-branch: some-pr-branch
# The default is '*NONE*' to indicate not to check out Endo, just use
# The default is '*NOPE*' to indicate not to check out Endo, just use
# the published NPM packages.
- name: Get the appropriate Endo branch
id: endo-branch
Expand All @@ -41,7 +46,9 @@ runs:
result-encoding: string
script: |-
let branch = 'NOPE';
if (context.payload.pull_request) {
if (context.eventName === 'schedule') {
branch = 'master';
} else if (context.payload.pull_request) {
const { body } = context.payload.pull_request;
const regex = /^\#endo-branch:\s+(\S+)/m;
const result = regex.exec(body);
Expand Down Expand Up @@ -73,6 +80,18 @@ runs:
echo "sha=NOPE" >> $GITHUB_OUTPUT
fi
shell: bash
- name: merge endo integration branch
id: endo-integration-merge
run: |-
set -e
git ls-remote --exit-code --heads origin "refs/heads/integration-endo-${{ steps.endo-branch.outputs.result }}" || exit 0
git fetch --unshallow origin integration-endo-${{ steps.endo-branch.outputs.result }}
git config user.name github-actions
git config user.email [email protected]
git merge --commit --no-edit origin/integration-endo-${{ steps.endo-branch.outputs.result }}
shell: bash
working-directory: ${{ inputs.path }}
if: steps.endo-branch.outputs.result != 'NOPE'
- name: Reconfigure git to use HTTP authentication
run: git config --global url."https://github.com/".insteadOf ssh://[email protected]/
shell: bash
Expand Down Expand Up @@ -100,14 +119,18 @@ runs:
sudo apt-get update
sudo apt-get install libbsd-dev
fi
yarn install
# Replace the Endo packages with the ones built from the checked-out branch.
if test -e ~/endo; then
scripts/replace-packages.sh ~/endo
${{ inputs.keep-endo }} || rm -rf ~/endo
scripts/get-packed-versions.sh ~/endo | scripts/resolve-versions.sh
fi
yarn install
mkdir -p node_modules/.cache/agoric
date > node_modules/.cache/agoric/yarn-installed
if test -e ~/endo; then
# Stage the redirected `yarn install` consequences.
git add package.json yarn.lock
${{ inputs.keep-endo }} || rm -rf ~/endo
fi
shell: bash
if: steps.built.outputs.cache-hit != 'true'
- name: yarn build
Expand All @@ -124,9 +147,12 @@ runs:
- name: git dirty check
working-directory: ${{ inputs.path }}
run: |-
if [ -n "$(git status --porcelain)" ];
then
set -x
# In case of Endo override, ignore matching index and worktree.
# (First column is non-space, second column is space, followed by separator.)
if [ -n "$(git status --porcelain | grep -Eve '^[^ ] '; true)" ]; then
git status
echo "Unexpected dirty git status" 1>&2
exit 1
fi
shell: bash
121 changes: 0 additions & 121 deletions .github/workflows/deployment-test.yml

This file was deleted.

Loading

0 comments on commit 5db2a2c

Please sign in to comment.