diff --git a/.github/workflows/cron-npm-install.yml b/.github/workflows/cron-npm-install.yml deleted file mode 100644 index c3e36df27..000000000 --- a/.github/workflows/cron-npm-install.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: NPM install testing workflow -# By default the sha where it runs is latest commit on default branch -# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule -on: - schedule: - # daily at 19:00 UTC - - cron: 0 19 * * * - workflow_dispatch: - pull_request: - branches: - - master - -jobs: - install-npm-package: - name: ${{ matrix.package }} NPM package install - runs-on: ubuntu-latest - container: - image: node:18-bullseye - strategy: - fail-fast: false - matrix: - package: - - '@celo/utils@beta' - - '@celo/contractkit@beta' - - '@celo/celocli@beta' - steps: - - name: Install @celo/celocli dependencies - if: matrix.package == '@celo/celocli@beta' - run: | - apt update - apt install -y libusb-1.0-0-dev libudev-dev - npm install node-gyp --global - git config --global url."https://".insteadOf ssh:// - - - name: Installing npm package - run: npm install ${{ matrix.package }} --global - - name: Test celocli command - if: matrix.package == '@celo/celocli@beta' - run: | - celocli account:new diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5fd95d32b..2265b26cb 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -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 @@ -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 @@ -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/install-jq-action@v3.0.1 + - 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 }} diff --git a/.gitignore b/.gitignore index 9ea5b7afd..0b3fa4b83 100644 --- a/.gitignore +++ b/.gitignore @@ -93,3 +93,4 @@ gha-creds-*.json transactions.json packages/sdk/metadata-claims/lib packages/cli/key +package.tgz diff --git a/packages/cli/package.json b/packages/cli/package.json index d497b2204..45a31d115 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -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",