Skip to content

Commit

Permalink
feat(#379): Automate npm publish and fix devnet conflicting sqds txns (
Browse files Browse the repository at this point in the history
…#386)

* feat(#379): Automate npm publish and fix devnet conflicting sqds txns

* Cleanup action cache
  • Loading branch information
ChewingGlass authored Aug 31, 2023
1 parent bcb043c commit a4a3780
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/actions/build-anchor/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ runs:
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: cargo-${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}-2
key: cargo-${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
- name: Cache Anchor Build
uses: actions/cache@v2
id: cache-anchor-build
Expand Down
16 changes: 10 additions & 6 deletions .github/actions/setup-anchor/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@ runs:
id: cache-anchor-cli
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
./target/
key: anchor-cli-${{ runner.os }}-v0001-${{ env.ANCHOR_VERSION }}
~/.cargo/bin/anchor
key: anchor-cli-${{ runner.os }}-v0002-${{ env.ANCHOR_VERSION }}
# if ANCHOR_VERSION is 0, then install the anchor-cli from source
- run: if [ $ANCHOR_VERSION -eq 0 ]; then cargo install --git https://github.com/coral-xyz/anchor anchor-cli --locked --force; else cargo install --git https://github.com/coral-xyz/anchor --tag "v$ANCHOR_VERSION" anchor-cli --locked; fi
shell: bash
if: steps.cache-anchor-cli.outputs.cache-hit != 'true'
- uses: actions/cache@v2
name: Cache Toml Cli
id: cache-toml-cli
with:
path: |
~/.cargo/bin/toml
key: toml-cli-${{ runner.os }}-v0001
- run: cargo install toml-cli
if: steps.cache-toml-cli.outputs.cache-hit != 'true'
shell: bash
8 changes: 0 additions & 8 deletions .github/actions/setup-ts/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,5 @@ runs:
- run: yarn && ./node_modules/.bin/lerna bootstrap
shell: bash
if: steps.cache-typescript-node-modules.outputs.cache-hit != 'true'
- name: Cache Typescript Build
uses: actions/cache@v2
id: cache-typescript-build
with:
path: |
./packages
key: deps-${{ runner.os }}-ts-build-${{ hashFiles('./packages/*/src/**/*') }}-${{ hashFiles('./yarn.lock') }}
- run: yarn run build
if: steps.cache-typescript-build.outputs.cache-hit != 'true'
shell: bash
15 changes: 3 additions & 12 deletions .github/actions/upload-bpf/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,17 @@ runs:
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: cargo-${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}-2
key: cargo-${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/cache@v2
name: Cache Cargo registry + index
name: Cache Solana Verify
id: cache-solana-verify
with:
path: |
~/.cargo/bin/solana-verify
key: cargo-${{ runner.os }}-cargo-build-${{ hashFiles('~/.cargo/bin/solana-verify') }}-2
key: cargo-${{ runner.os }}-cargo-build-${{ hashFiles('~/.cargo/bin/solana-verify') }}
- run: cargo install solana-verify
if: steps.cache-solana-verify.outputs.cache-hit != 'true'
shell: bash
- name: Cache Deps Builds
uses: actions/cache@v2
id: cache-cargo-deps-builds
with:
path: |
./deps/metaplex-program-brary
./deps/solana-program-library
./deps/clockwork
key: deps-${{ runner.os }}-build-${{ hashFiles('./deps/**/Cargo.lock') }}
- run: ${{ inputs.testing == 'true' && 'TESTING=true' || '' }} ~/.cargo/bin/solana-verify build --library-name $PROGRAM ${{ inputs.devnet == 'true' && '-- --features devnet' || '' }}
shell: bash
env:
Expand Down
24 changes: 20 additions & 4 deletions .github/workflows/develop-release-program.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,16 @@ jobs:
run: |
find programs -type f -name '*.rs' -exec sed -i "s/b\"nJWGUMOK\"/b\"devnethelium5\"/g" {} \;
- name: Install toml-cli
if: steps.cache-toml.outputs.cache-hit != 'true'
run: cargo install toml-cli
- uses: actions/cache@v2
name: Cache Toml Cli
id: cache-toml-cli
with:
path: |
~/.cargo/bin/toml
key: toml-cli-${{ runner.os }}-v0001
- run: cargo install toml-cli
if: steps.cache-toml-cli.outputs.cache-hit != 'true'
shell: bash

- name: Set program information
if: steps.cache-toml.outputs.cache-hit != 'true'
Expand All @@ -70,7 +77,16 @@ jobs:
keypair: ${{ secrets.DEVNET_DEPLOYER_KEYPAIR }}
program-id: ${{ env.PROGRAM_ID }}
buffer-authority: ${{ secrets.DEVNET_MULTISIG_VAULT }}

publish_programs:
needs: [build_programs]
runs-on: ubuntu-latest
if: needs.detect_changed_programs.outputs.programs_with_changes != '[]' && needs.detect_changed_programs.outputs.programs_with_changes != ''
strategy:
# Publish must happen one at a time or there can be conflicts
max-parallel: 1
matrix:
program: ${{ fromJson(needs.detect_changed_programs.outputs.programs_with_changes) }}
steps:
- name: Squads program upgrade
uses: helium/squads-program-upgrade@v0.3.1
with:
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/release-program.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,16 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Install toml-cli
run: cargo install toml-cli
- uses: actions/cache@v2
name: Cache Toml Cli
id: cache-toml-cli
with:
path: |
~/.cargo/bin/toml
key: toml-cli-${{ runner.os }}-v0001
- run: cargo install toml-cli
if: steps.cache-toml-cli.outputs.cache-hit != 'true'
shell: bash

- name: Set tag information
run: |
Expand Down
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
"versionup:patch": "lerna version patch --conventional-commits --no-git-tag-version",
"versionup:minor": "lerna version minor --conventional-commits --no-git-tag-version",
"versionup:major": "lerna version major --conventional-commits --no-git-tag-version",
"postversionup": "npm run commit-version",
"postversionup:patch": "npm run commit-version",
"postversionup:minor": "npm run commit-version",
"postversionup:major": "npm run commit-version",
"commit-version": "git add . && git commit -m \"chore(release): publish `node -p 'require(\"./lerna.json\").version'`\"",
"release": "lerna publish from-package --no-verify-access",
"release:canary": "lerna publish --canary --preid next --dist-tag next --force-publish='*' --no-push --no-git-tag-version --no-verify-access --yes",
"lint:fix": "prettier */*.js \"*/**/*{.js,.ts}\" -w",
"lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check",
"build": "lerna run --parallel prebuild && tsc --build",
Expand Down

0 comments on commit a4a3780

Please sign in to comment.