Skip to content

Commit

Permalink
Install Packages post release (#482)
Browse files Browse the repository at this point in the history
After packages are released, attempt to install each of them. combined
with pre-releasing this should help us catch any issues arising from
packages being used outside of development environment



## tested
run with mock data

https://github.com/celo-org/developer-tooling/actions/runs/12275055520/job/34249530769?pr=482

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the GitHub Actions workflows and modifies the
`package.json` file for a project, primarily focusing on changing
Node.js versions, enhancing package publishing processes, and improving
the installation of released packages.

### Detailed summary
- Deleted `.github/workflows/cron-npm-install.yml.gitignore`.
- Updated `node-version` from `18.x` to `20.x` in the `release.yaml`
workflow.
- Changed `prepack` script in `package.json` to use `yarn run build`.
- Added new steps for formatting output and installing released packages
in the workflow.
- Adjusted conditions for opening documentation PRs to check for
`@celo/celocli`.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
  • Loading branch information
aaronmgdr authored Dec 11, 2024
1 parent b83d8c4 commit ef9ca97
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 46 deletions.
40 changes: 0 additions & 40 deletions .github/workflows/cron-npm-install.yml

This file was deleted.

69 changes: 64 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ jobs:
id-token: write
pull-requests: write
repository-projects: write
outputs:
outputs:
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
published: ${{ steps.changesets.outputs.published }}

steps:
- name: Checkout Repo
uses: actions/checkout@v4
Expand All @@ -30,17 +32,17 @@ jobs:
api-url: https://api.gateway.akeyless.celo-networks-dev.org
access-id: p-kf9vjzruht6l
static-secrets: '{"/static-secrets/NPM/npm-publish-token":"NPM_TOKEN"}'
- name: Setup Node.js 18.x
- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 20.x
- name: 'enable corepack for yarn'
run: sudo corepack enable yarn
shell: bash
# must call twice because of chicken and egg problem with yarn and node
- uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'
cache: 'yarn'
- name: Install Dependencies
shell: bash
Expand All @@ -55,10 +57,67 @@ jobs:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: yarn release
version: yarn version-and-reinstall

# release gives an array of published packages as jsob objects, we need an array of strings for installing
prepare:
name: Format Output for Install
if: needs.release.outputs.published
needs: release
runs-on: ubuntu-latest
container:
image: node:20-bullseye
outputs:
result: "${{ steps.map.outputs.output }}"
steps:
- name: Install jq
if: needs.release.outputs.published
uses: dcarbone/[email protected]
- name: Format Published Packages Array
if: needs.release.outputs.published
uses: cloudposse/github-action-jq@main
id: map
with:
compact: true
raw-output: true
input: '${{ needs.release.outputs.publishedPackages }}'
script: |-
map("\(.name)@\(.version)")
# last line of defense to ensure that the packages were published correctly
install-released-packages:
name: Install Released Packages
needs: [prepare, release]
if: needs.release.outputs.published
runs-on: ubuntu-latest
container:
image: node:20-bullseye
strategy:
fail-fast: false
max-parallel: 12
matrix:
package: ${{fromJson(needs.prepare.outputs.result)}}
steps:
- name: Install @celo/celocli dependencies
if: contains(matrix.package, '@celo/celocli')
run: |
apt update
apt install -y libusb-1.0-0-dev libudev-dev
npm install node-gyp --global
- name: Installing ${{ matrix.package }} package
run: npm install ${{ matrix.package }} --global
- name: Ensure sample of celocli commands run
if: contains(matrix.package, '@celo/celocli')
run: |
celocli --version
celocli account:new
echo "checking celo community fund balance"
celocli account:balance 0xD533Ca259b330c7A88f74E000a3FaEa2d63B7972 --node celo
celocli network:whitelist --node alfajores
open-docs-pr:
needs: release
if: ${{ contains(fromJson(needs.release.outputs.publishedPackages).*.name, '@celo/cli') }}
if: ${{ contains(fromJson(needs.release.outputs.publishedPackages).*.name, '@celo/celocli') }}
uses: celo-org/developer-tooling/.github/workflows/open-docs-pr.yml@master
with:
commit: ${{ github.sha }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,4 @@ gha-creds-*.json
transactions.json
packages/sdk/metadata-claims/lib
packages/cli/key
package.tgz
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"docs": "./generate_docs.sh",
"lint": "yarn run --top-level eslint -c .eslintrc.js ",
"prepublish": "",
"prepack": "yarn build && oclif readme",
"prepack": "yarn run build && oclif readme",
"test": "TZ=UTC NODE_OPTIONS='--experimental-vm-modules' yarn jest --runInBand --forceExit",
"test-anvil": "RUN_GANACHE_TESTS=false RUN_ANVIL_TESTS=true TZ=UTC NODE_OPTIONS='--experimental-vm-modules' yarn jest --forceExit",
"test-ganache": "RUN_GANACHE_TESTS=true RUN_ANVIL_TESTS=false TZ=UTC NODE_OPTIONS='--experimental-vm-modules' yarn jest --runInBand --forceExit",
Expand Down

0 comments on commit ef9ca97

Please sign in to comment.