Skip to content

Commit

Permalink
ci: add git diff for checking lock file changes (#1654)
Browse files Browse the repository at this point in the history
  • Loading branch information
fanatid authored Mar 20, 2022
1 parent 58af625 commit 45a5d20
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 102 deletions.
7 changes: 7 additions & 0 deletions .github/actions/git-diff/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: "Git diff"
description: "Check git changes "
runs:
using: "composite"
steps:
- run: git diff --exit-code
shell: bash
6 changes: 3 additions & 3 deletions .github/actions/setup-ts/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ runs:
path: |
./ts/dist/
key: solana-${{ runner.os }}-v0000-${{ env.NODE_VERSION }}-${{ hashFiles('./ts/**/*.ts') }}
- run: cd ts && yarn && yarn build:node && yarn link && cd ../
- run: cd ts && yarn --frozen-lockfile && yarn build:node && yarn link && cd ../
shell: bash
- run: cd examples/tutorial && yarn link @project-serum/anchor && yarn && cd ../../
- run: cd examples/tutorial && yarn link @project-serum/anchor && yarn --frozen-lockfile && cd ../../
shell: bash
- run: cd tests && yarn link @project-serum/anchor && yarn && cd ..
- run: cd tests && yarn link @project-serum/anchor && yarn --frozen-lockfile && cd ..
shell: bash

28 changes: 19 additions & 9 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ jobs:
- run: rustup toolchain install nightly --profile minimal --component clippy
- run: cargo +nightly clippy --all-targets -- -D warnings
- run: cargo test
- run: cd ts && yarn
- run: cd ts && yarn --frozen-lockfile
- run: cd ts && yarn test
- run: cd ts && yarn lint
- run: cd examples/tutorial && yarn
- run: cd examples/tutorial && yarn --frozen-lockfile
- run: cd examples/tutorial && yarn lint
- run: cd tests && yarn
- run: cd tests && yarn --frozen-lockfile
- run: cd tests && yarn lint
- uses: ./.github/actions/git-diff/

setup-anchor-cli:
name: Setup Anchor cli
Expand All @@ -72,6 +73,8 @@ jobs:
name: anchor-binary
path: ~/.cargo/bin/anchor

- uses: ./.github/actions/git-diff/

test-examples:
needs: setup-anchor-cli
name: Examples Test
Expand Down Expand Up @@ -118,6 +121,7 @@ jobs:
path: ./examples/tutorial/basic-4/target
key: cargo-${{ runner.os }}-${{ hashFiles('./examples/tutorial/basic-4/**/Cargo.toml') }}-${{ env.SOLANA_CLI_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
- run: cd examples/tutorial && yarn workspaces run test
- uses: ./.github/actions/git-diff/

setup-client-example:
needs: setup-anchor-cli
Expand Down Expand Up @@ -151,6 +155,7 @@ jobs:
with:
name: ${{ matrix.node.name }}
path: ${{ matrix.node.path }}target/deploy/${{ matrix.node.name }}
- uses: ./.github/actions/git-diff/

test-client-example:
needs: setup-client-example
Expand Down Expand Up @@ -190,6 +195,7 @@ jobs:
key: cargo-${{ runner.os }}-client/example-${{ env.ANCHOR_VERSION }}-${{ env.SOLANA_CLI_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
- uses: ./.github/actions/setup-solana/
- run: cd client/example && ./run-test.sh
- uses: ./.github/actions/git-diff/

test-bpf-upgradeable-state:
needs: setup-anchor-cli
Expand Down Expand Up @@ -228,11 +234,12 @@ jobs:

- run: solana-test-validator -r --quiet &
name: start validator
- run: cd tests/bpf-upgradeable-state && yarn
- run: cd tests/bpf-upgradeable-state && yarn --frozen-lockfile
- run: cd tests/bpf-upgradeable-state && yarn link @project-serum/anchor
- run: cd tests/bpf-upgradeable-state && anchor build --skip-lint
- run: cd tests/bpf-upgradeable-state && solana program deploy --program-id program_with_different_programdata.json target/deploy/bpf_upgradeable_state.so
- run: cd tests/bpf-upgradeable-state && cp bpf_upgradeable_state-keypair.json target/deploy/bpf_upgradeable_state-keypair.json && anchor deploy && anchor test --skip-deploy --skip-build --skip-lint
- uses: ./.github/actions/git-diff/

test-anchor-init:
needs: setup-anchor-cli
Expand Down Expand Up @@ -263,6 +270,7 @@ jobs:
path: ~/.cargo/bin/

- run: cd "$(mktemp -d)" && anchor init hello-anchor && cd hello-anchor && anchor test
- uses: ./.github/actions/git-diff/

test-programs:
needs: setup-anchor-cli
Expand All @@ -287,7 +295,7 @@ jobs:
path: tests/interface
- cmd: cd tests/lockup && anchor test --skip-lint
path: tests/lockup
- cmd: cd tests/swap/deps/serum-dex/dex && cargo build-bpf && cd ../../../ && anchor test --skip-lint
- cmd: cd tests/swap/deps/serum-dex/dex && cargo build-bpf -- --locked && cd ../../../ && anchor test --skip-lint
path: tests/swap
- cmd: cd tests/escrow && anchor test --skip-lint
path: tests/escrow
Expand All @@ -311,17 +319,17 @@ jobs:
path: tests/chat
- cmd: cd tests/ido-pool && anchor test --skip-lint
path: tests/ido-pool
- cmd: cd tests/cfo && anchor run test-with-build
- cmd: cd tests/cfo && anchor run test-with-build && cd deps/stake && git checkout Cargo.lock && cd ../swap && git checkout Cargo.lock
path: tests/cfo
- cmd: cd tests/auction-house && yarn && anchor test --skip-lint
- cmd: cd tests/auction-house && yarn --frozen-lockfile && anchor test --skip-lint && git checkout Cargo.lock
path: tests/auction-house
- cmd: cd tests/floats && yarn && anchor test --skip-lint
- cmd: cd tests/floats && yarn --frozen-lockfile && anchor test --skip-lint
path: tests/floats
- cmd: cd tests/safety-checks && ./test.sh
path: tests/safety-checks
- cmd: cd tests/custom-coder && anchor test --skip-lint
path: tests/custom-coder
- cmd: cd tests/validator-clone && yarn && anchor test --skip-lint
- cmd: cd tests/validator-clone && yarn --frozen-lockfile && anchor test --skip-lint
path: tests/validator-clone
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -355,3 +363,5 @@ jobs:

- run: ${{ matrix.node.cmd }}
name: ${{ matrix.node.path }} program test

- uses: ./.github/actions/git-diff/
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ build-example-bpf-all: build-example-bpf-zero-copy
.PHONY: clean
clean:
find . -type d -name .anchor -print0 | xargs -0 rm -rf
find . -type d -name node_modules -print0 | xargs -0 rm -rf
find . -type d -name target -print0 | xargs -0 rm -rf

.PHONY: publish
Expand Down
51 changes: 42 additions & 9 deletions examples/tutorial/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,19 @@
"@ethersproject/logger" "^5.5.0"
hash.js "1.1.7"

"@project-serum/anchor@^0.20.0":
version "0.20.0"
resolved "https://registry.yarnpkg.com/@project-serum/anchor/-/anchor-0.20.0.tgz#547f5c0ff7e66809fa7118b2e3abd8087b5ec519"
integrity sha512-p1KOiqGBIbNsopMrSVoPwgxR1iPffsdjMNCOysahTPL9whX2CLX9HQCdopHjYaGl7+SdHRuXml6Wahk/wUmC8g==
"@project-serum/anchor@^0.22.1":
version "0.22.1"
resolved "https://registry.yarnpkg.com/@project-serum/anchor/-/anchor-0.22.1.tgz#698a9620f94691de0a12bbc650a5c8380e2f0e8a"
integrity sha512-5pHeyvQhzLahIQ8aZymmDMZJAJFklN0joZdI+YIqFkK2uU/mlKr6rBLQjxysf/j1mLLiNG00tdyLfUtTAdQz7w==
dependencies:
"@project-serum/borsh" "^0.2.2"
"@project-serum/borsh" "^0.2.5"
"@solana/web3.js" "^1.17.0"
base64-js "^1.5.1"
bn.js "^5.1.2"
bs58 "^4.0.1"
buffer-layout "^1.2.2"
camelcase "^5.3.1"
cross-fetch "^3.1.5"
crypto-hash "^1.3.0"
eventemitter3 "^4.0.7"
find "^0.3.0"
Expand All @@ -50,10 +51,10 @@
snake-case "^3.0.4"
toml "^3.0.0"

"@project-serum/borsh@^0.2.2":
version "0.2.2"
resolved "https://registry.yarnpkg.com/@project-serum/borsh/-/borsh-0.2.2.tgz#63e558f2d6eb6ab79086bf499dea94da3182498f"
integrity sha512-Ms+aWmGVW6bWd3b0+MWwoaYig2QD0F90h0uhr7AzY3dpCb5e2S6RsRW02vFTfa085pY2VLB7nTZNbFECQ1liTg==
"@project-serum/borsh@^0.2.5":
version "0.2.5"
resolved "https://registry.yarnpkg.com/@project-serum/borsh/-/borsh-0.2.5.tgz#6059287aa624ecebbfc0edd35e4c28ff987d8663"
integrity sha512-UmeUkUoKdQ7rhx6Leve1SssMR/Ghv8qrEiyywyxSWg7ooV7StdpPBhciiy5eB3T0qU1BXvdRNC8TdrkxK7WC5Q==
dependencies:
bn.js "^5.1.2"
buffer-layout "^1.2.0"
Expand Down Expand Up @@ -361,6 +362,13 @@ cross-fetch@^3.1.4:
dependencies:
node-fetch "2.6.1"

cross-fetch@^3.1.5:
version "3.1.5"
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f"
integrity sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==
dependencies:
node-fetch "2.6.7"

crypto-hash@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/crypto-hash/-/crypto-hash-1.3.0.tgz#b402cb08f4529e9f4f09346c3e275942f845e247"
Expand Down Expand Up @@ -761,6 +769,13 @@ node-fetch@2.6.1:
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==

node-fetch@2.6.7:
version "2.6.7"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==
dependencies:
whatwg-url "^5.0.0"

node-gyp-build@^4.2.0, node-gyp-build@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.3.0.tgz#9f256b03e5826150be39c764bf51e993946d71a3"
Expand Down Expand Up @@ -946,6 +961,11 @@ toml@^3.0.0:
resolved "https://registry.yarnpkg.com/toml/-/toml-3.0.0.tgz#342160f1af1904ec9d204d03a5d61222d762c5ee"
integrity sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==

tr46@~0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=

traverse-chain@~0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/traverse-chain/-/traverse-chain-0.1.0.tgz#61dbc2d53b69ff6091a12a168fd7d433107e40f1"
Expand Down Expand Up @@ -978,6 +998,19 @@ uuid@^8.3.0:
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==

webidl-conversions@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=

whatwg-url@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"
integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0=
dependencies:
tr46 "~0.0.3"
webidl-conversions "^3.0.0"

which@2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"
Expand Down
81 changes: 0 additions & 81 deletions tests/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -421,21 +421,6 @@ chokidar@3.5.2:
optionalDependencies:
fsevents "~2.3.2"

chokidar@3.5.3:
version "3.5.3"
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd"
integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==
dependencies:
anymatch "~3.1.2"
braces "~3.0.2"
glob-parent "~5.1.2"
is-binary-path "~2.1.0"
is-glob "~4.0.1"
normalize-path "~3.0.0"
readdirp "~3.6.0"
optionalDependencies:
fsevents "~2.3.2"

circular-json@^0.5.9:
version "0.5.9"
resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.5.9.tgz#932763ae88f4f7dead7a0d09c8a51a4743a53b1d"
Expand Down Expand Up @@ -498,13 +483,6 @@ debug@4.3.2:
dependencies:
ms "2.1.2"

debug@4.3.3:
version "4.3.3"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.3.tgz#04266e0b70a98d4462e6e288e38259213332b664"
integrity sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==
dependencies:
ms "2.1.2"

decamelize@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837"
Expand Down Expand Up @@ -661,18 +639,6 @@ glob@7.1.7:
once "^1.3.0"
path-is-absolute "^1.0.0"

glob@7.2.0:
version "7.2.0"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023"
integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==
dependencies:
fs.realpath "^1.0.0"
inflight "^1.0.4"
inherits "2"
minimatch "^3.0.4"
once "^1.3.0"
path-is-absolute "^1.0.0"

growl@1.10.5:
version "1.10.5"
resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e"
Expand Down Expand Up @@ -881,13 +847,6 @@ minimatch@3.0.4, minimatch@^3.0.4:
dependencies:
brace-expansion "^1.1.7"

minimatch@4.2.1:
version "4.2.1"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-4.2.1.tgz#40d9d511a46bdc4e563c22c3080cde9c0d8299b4"
integrity sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g==
dependencies:
brace-expansion "^1.1.7"

minimist@^1.2.0, minimist@^1.2.5:
version "1.2.5"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
Expand Down Expand Up @@ -930,36 +889,6 @@ mocha@^9.1.3:
yargs-parser "20.2.4"
yargs-unparser "2.0.0"

mocha@^9.2.2:
version "9.2.2"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-9.2.2.tgz#d70db46bdb93ca57402c809333e5a84977a88fb9"
integrity sha512-L6XC3EdwT6YrIk0yXpavvLkn8h+EU+Y5UcCHKECyMbdUIxyMuZj4bX4U9e1nvnvUUvQVsV2VHQr5zLdcUkhW/g==
dependencies:
"@ungap/promise-all-settled" "1.1.2"
ansi-colors "4.1.1"
browser-stdout "1.3.1"
chokidar "3.5.3"
debug "4.3.3"
diff "5.0.0"
escape-string-regexp "4.0.0"
find-up "5.0.0"
glob "7.2.0"
growl "1.10.5"
he "1.2.0"
js-yaml "4.1.0"
log-symbols "4.1.0"
minimatch "4.2.1"
ms "2.1.3"
nanoid "3.3.1"
serialize-javascript "6.0.0"
strip-json-comments "3.1.1"
supports-color "8.1.1"
which "2.0.2"
workerpool "6.2.0"
yargs "16.2.0"
yargs-parser "20.2.4"
yargs-unparser "2.0.0"

ms@2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
Expand All @@ -975,11 +904,6 @@ nanoid@3.1.25:
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.25.tgz#09ca32747c0e543f0e1814b7d3793477f9c8e152"
integrity sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==

nanoid@3.3.1:
version "3.3.1"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.1.tgz#6347a18cac88af88f58af0b3594b723d5e99bb35"
integrity sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==

no-case@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/no-case/-/no-case-3.0.4.tgz#d361fd5c9800f558551a8369fc0dcd4662b6124d"
Expand Down Expand Up @@ -1331,11 +1255,6 @@ workerpool@6.1.5:
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.1.5.tgz#0f7cf076b6215fd7e1da903ff6f22ddd1886b581"
integrity sha512-XdKkCK0Zqc6w3iTxLckiuJ81tiD/o5rBE/m+nXpRCB+/Sq4DqkfXZ/x0jW02DG1tGsfUGXbTJyZDP+eu67haSw==

workerpool@6.2.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.0.tgz#827d93c9ba23ee2019c3ffaff5c27fccea289e8b"
integrity sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
Expand Down

0 comments on commit 45a5d20

Please sign in to comment.