Skip to content

Commit

Permalink
Merge branch 'Agoric:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
schnetzlerjoe authored Sep 26, 2023
2 parents 2e710af + ef466d3 commit f0014e0
Show file tree
Hide file tree
Showing 1,062 changed files with 29,607 additions and 17,304 deletions.
5 changes: 3 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
docker
packages/cosmic-swingset/t[0-9]
packages/cosmic-swingset/t[0-9].*
packages/cosmic-swingset/lib/lib*.h
packages/cosmic-swingset/lib/lib*.so
golang/cosmos/build
packages/deployment
packages/swingset-runner
packages/stat-logger
**/deployment.json
**/vars.tf
**/*.log
**/build
**/bundles
**/__pycache__
**/*.egg-info
**/swingset-kernel-state
Expand Down
74 changes: 56 additions & 18 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/* eslint-disable no-restricted-syntax */
/* eslint-env node */
const process = require('process');

const lintTypes = !!process.env.AGORIC_ESLINT_TYPES;

const deprecatedForLoanContract = [
['currency', 'brand, asset or another descriptor'],
Expand Down Expand Up @@ -34,27 +31,32 @@ const deprecatedTerminology = Object.fromEntries(
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: lintTypes
? {
sourceType: 'module',
project: [
'./packages/*/jsconfig.json',
'./packages/*/tsconfig.json',
'./packages/wallet/*/jsconfig.json',
'./tsconfig.json',
],
tsconfigRootDir: __dirname,
extraFileExtensions: ['.cjs'],
}
: undefined,
parserOptions: {
// Works for us!
EXPERIMENTAL_useProjectService: true,
sourceType: 'module',
project: [
'./packages/*/tsconfig.json',
'./packages/*/tsconfig.json',
'./packages/wallet/*/tsconfig.json',
'./tsconfig.json',
],
tsconfigRootDir: __dirname,
extraFileExtensions: ['.cjs'],
},
plugins: ['@typescript-eslint', 'prettier'],
extends: ['@agoric'],
extends: ['@agoric', 'plugin:ava/recommended'],
rules: {
'@typescript-eslint/prefer-ts-expect-error': 'warn',
'@typescript-eslint/no-floating-promises': lintTypes ? 'warn' : 'off',
'@typescript-eslint/no-floating-promises': 'error',
// so that floating-promises can be explicitly permitted with void operator
'no-void': ['error', { allowAsStatement: true }],

// We allow disabled tests in master
'ava/no-skip-test': 'off',
// Contrary to recommendation https://github.com/avajs/ava/blob/main/docs/recipes/typescript.md#typing-tcontext
'ava/use-test': 'off',

// The rule is “safe await separator" which implements the architectural
// goal of “clearly separate an async function's synchronous prelude from
// the part that runs in a future turn”. That is our architectural rule. It
Expand Down Expand Up @@ -111,11 +113,25 @@ module.exports = {
'packages/wallet/api/test/**/*.js',
],
rules: {
// sometimes used for organizing logic
'no-lone-blocks': 'off',

// 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',
},
},
{
// These tests use EV() instead of E(), which are easy to confuse.
// Help by erroring when E() packages are imported.
files: ['packages/boot/test/**/test-*'],
rules: {
'no-restricted-imports': [
'error',
{ paths: ['@endo/eventual-send', '@endo/far'] },
],
},
},
{
// Allow "loan" contracts to mention the word "loan".
files: ['packages/zoe/src/contracts/loan/*.js'],
Expand All @@ -140,5 +156,27 @@ 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',
},
},
{
// Types files have no promises to lint and that linter chokes on the .d.ts twin.
// Maybe due to https://github.com/typescript-eslint/typescript-eslint/issues/7435
files: ['types*.js'],
rules: {
// Disabled to prevent:
// Error: Error while loading rule '@typescript-eslint/no-floating-promises': You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.
// Occurred while linting ~agoric-sdk/packages/vats/src/core/types.js
// at Object.getParserServices (~agoric-sdk/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js:24:15)
// at create (~agoric-sdk/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-floating-promises.js:77:31)
// at Object.create (~agoric-sdk/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js:38:20)
'@typescript-eslint/no-floating-promises': 'off',
},
},
],
};
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/work_item.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ assignees: ''

## Test Plan

## Upgrade Considerations
4 changes: 4 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ Backwards compatibility: what happens to existing data or deployments when this

<!-- Every PR should of course come with tests of its own functionality. What additional tests are still needed beyond those unit tests? How does this affect CI, other test automation, or the testnet?
-->

### Upgrade Considerations

<!-- What aspects of this PR are relevant to upgrading live production systems, and how should they be addressed? -->
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
9 changes: 7 additions & 2 deletions .github/actions/restore-golang/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ inputs:
go-version:
description: 'The version of Go to use'
required: true
path:
description: 'The relative path to the agoric-sdk directory'
required: false
default: '.'

runs:
using: composite
Expand All @@ -14,13 +18,14 @@ runs:
shell: bash
- uses: actions/checkout@v3
with:
path: ${{ inputs.path }}
clean: 'false'
submodules: 'true'
- uses: actions/setup-go@v4
with:
cache-dependency-path: golang/cosmos/go.sum
cache-dependency-path: ${{ inputs.path }}/golang/cosmos/go.sum
go-version: ${{ inputs.go-version }}
- name: go mod download
working-directory: ./golang/cosmos
working-directory: ${{ inputs.path }}/golang/cosmos
run: go mod download
shell: bash
35 changes: 27 additions & 8 deletions .github/actions/restore-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ inputs:
description: 'The relative path to the agoric-sdk directory'
required: false
default: '.'
keep-endo:
description: 'Keep Endo repository after installing from it'
required: false
default: 'false'
xsnap-random-init:
description: Build xsnap binary with random memory init
required: false
Expand All @@ -27,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 Down Expand Up @@ -76,13 +80,25 @@ 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
- uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
cache: 'yarn'
cache: yarn
cache-dependency-path: ${{ inputs.path }}/yarn.lock
- uses: kenchan0130/actions-system-info@master
id: system-info
Expand Down Expand Up @@ -111,9 +127,9 @@ runs:
mkdir -p node_modules/.cache/agoric
date > node_modules/.cache/agoric/yarn-installed
if test -e ~/endo; then
# Remove traces of the redirected `yarn install`.
git restore package.json yarn.lock
rm -rf ~/endo
# 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'
Expand All @@ -131,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
29 changes: 19 additions & 10 deletions .github/workflows/after-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ on:
branches:
# $default-branch
- master
- release-pismo
- 'release-*'
workflow_dispatch:

jobs:
build:
Expand Down Expand Up @@ -54,14 +55,22 @@ jobs:
run: npm whoami
- name: publish to NPM tag
run: |
if [ "${{ github.ref_name }}" = "release-pismo" ]; then
# A pismo dev release.
TAG=pismo-dev
else
# Just a dev release.
TAG=dev
fi
yarn lerna publish --conventional-prerelease --canary --exact \
case $GITHUB_REF_NAME in
release-*)
# A pre-release.
TAG=${GITHUB_REF_NAME#release-}-dev
;;
master)
# A trunk dev release.
TAG=dev
;;
*)
# Some other dev release.
TAG=other-dev
;;
esac
# without concurrency until https://github.com/Agoric/agoric-sdk/issues/8091
yarn lerna publish --concurrency 1 --conventional-prerelease --canary --exact \
--dist-tag=$TAG --preid=$TAG-$(git rev-parse --short=7 HEAD) \
--no-push --no-verify-access --yes
- name: notify on failure
Expand Down Expand Up @@ -101,7 +110,7 @@ jobs:
- uses: nwtgck/[email protected]
with:
# Production deployment if a push or merged PR.
production-deploy: ${{github.event_name == 'push'}}
production-deploy: ${{ github.event_name == 'push' && github.ref_name == 'master' }}
publish-dir: coverage/html
# SECURITY: we don't want to hand out the Github token to this action.
# github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ag-solo-xs.yml.DISABLED
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
branches:
# $default-branch
- master
- release-pismo
- 'release-*'

jobs:
xs-build:
Expand Down
Loading

0 comments on commit f0014e0

Please sign in to comment.