From 6c0f6cfde31e3e74cd1228d787813aeb30a636a6 Mon Sep 17 00:00:00 2001 From: rabi-siddique Date: Thu, 1 Aug 2024 15:51:18 +0500 Subject: [PATCH] ci: use pyTooling/Actions/with-post-step for commands in run and post-run --- .github/actions/restore-node/action.yml | 31 +++++-------------- .../actions/restore-node/check-git-status.sh | 13 ++++++++ .github/actions/with-post-step/action.yml | 21 ------------- .github/actions/with-post-step/main.cjs | 22 ------------- .gitignore | 4 +++ a3p-integration/.gitignore | 1 + packages/cosmic-swingset/.gitignore | 3 ++ 7 files changed, 28 insertions(+), 67 deletions(-) create mode 100644 .github/actions/restore-node/check-git-status.sh delete mode 100644 .github/actions/with-post-step/action.yml delete mode 100644 .github/actions/with-post-step/main.cjs diff --git a/.github/actions/restore-node/action.yml b/.github/actions/restore-node/action.yml index 6d7740325b3..bf48fc1a5fd 100644 --- a/.github/actions/restore-node/action.yml +++ b/.github/actions/restore-node/action.yml @@ -181,29 +181,12 @@ runs: mkdir -p node_modules/.cache/agoric date > node_modules/.cache/agoric/yarn-built - # Refs: https://github.com/orgs/community/discussions/45342 - - name: Validate Git Tree in Root Directory - if: inputs.path == '.' - uses: ./.github/actions/with-post-step + - name: Validate Git Tree Cleanliness + uses: pyTooling/Actions/with-post-step@v0.4.5 with: - main: echo "Checking Git tree for changes in the root directory..." + main: | + bash "$SRC/.github/actions/restore-node/check-git-status.sh" "$SRC" post: | - set -x - if [ -n "$(git status --porcelain | grep -vE 'junit.xml$' | grep -vE '^[?][?] endo-sha.txt$|^.'; true)" ]; then - git status - echo "Unexpected dirty git status in default path" 1>&2 - exit 1 - fi - - - name: Validate Git Tree in Agoric SDK Directory - if: inputs.path == './agoric-sdk' - uses: ./agoric-sdk/.github/actions/with-post-step - with: - main: echo "Checking Git tree for changes in the root directory..." - post: | - set -x - if [ -n "$(git status --porcelain | grep -vE 'junit.xml$' | grep -vE '^[?][?] endo-sha.txt$|^.'; true)" ]; then - git status - echo "Unexpected dirty git status in Agoric SDK path" 1>&2 - exit 1 - fi + bash "$SRC/.github/actions/restore-node/check-git-status.sh" "$SRC" + env: + SRC: ${{ inputs.path }} diff --git a/.github/actions/restore-node/check-git-status.sh b/.github/actions/restore-node/check-git-status.sh new file mode 100644 index 00000000000..e95d150ec32 --- /dev/null +++ b/.github/actions/restore-node/check-git-status.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Set verbose execution +set -x +# Navigate to the specified directory +cd "$1" || exit $? +# Check for unexpected changes +# Fail if git status detects changes +changes=$(git status --porcelain) +if [ -n "$changes" ]; then + git status + echo "Unexpected dirty git status in Agoric SDK path" + exit 1 +fi diff --git a/.github/actions/with-post-step/action.yml b/.github/actions/with-post-step/action.yml deleted file mode 100644 index 9e1295380c8..00000000000 --- a/.github/actions/with-post-step/action.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: With Post Step - -description: > - JavaScript Action to run a main command and a subsequent post command. - -inputs: - main: - description: 'Primary command or script to execute.' - required: true - post: - description: 'Command or script to run after the main command.' - required: true - key: - description: 'State variable name to identify the post step.' - required: false - default: POST - -runs: - using: 'node20' - main: 'main.cjs' - post: 'main.cjs' diff --git a/.github/actions/with-post-step/main.cjs b/.github/actions/with-post-step/main.cjs deleted file mode 100644 index 15390bc4bb4..00000000000 --- a/.github/actions/with-post-step/main.cjs +++ /dev/null @@ -1,22 +0,0 @@ -// Ref: https://github.com/pyTooling/Actions/blob/main/with-post-step/main.js -const { spawn } = require('child_process'); -const { appendFileSync } = require('fs'); -const { EOL } = require('os'); - -const run = cmd => { - const subprocess = spawn(cmd, { stdio: 'inherit', shell: true }); - subprocess.on('exit', exitCode => { - process.exitCode = exitCode; - }); -}; - -const key = process.env.INPUT_KEY.toUpperCase(); - -if (process.env[`STATE_${key}`] !== undefined) { - // Are we in the 'post' step? - run(process.env.INPUT_POST); -} else { - // Otherwise, this is the main step - appendFileSync(process.env.GITHUB_STATE, `${key}=true${EOL}`); - run(process.env.INPUT_MAIN); -} diff --git a/.gitignore b/.gitignore index 924317ab198..4868d9a80f4 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,7 @@ api-docs chaintest _testoutput.txt + + +junit.xml +endo-sha.txt \ No newline at end of file diff --git a/a3p-integration/.gitignore b/a3p-integration/.gitignore index 2027ea67059..ddfb8bb6826 100644 --- a/a3p-integration/.gitignore +++ b/a3p-integration/.gitignore @@ -15,6 +15,7 @@ upgrade-test-scripts # same for each proposal, an independent project proposals/*/.pnp.* proposals/*/.yarn/* +proposals/a:upgrade-next/* !proposals/*/.yarn/patches !proposals/*/.yarn/plugins !proposals/*/.yarn/releases diff --git a/packages/cosmic-swingset/.gitignore b/packages/cosmic-swingset/.gitignore index fd4c7ab84c2..c54a14d5162 100644 --- a/packages/cosmic-swingset/.gitignore +++ b/packages/cosmic-swingset/.gitignore @@ -87,3 +87,6 @@ typings/ # next.js build output .next + +# rosetta-cli executable +bin/rosetta-cli \ No newline at end of file