From 66b45886fcb4d58469fd1e14c679f4cb860b410d Mon Sep 17 00:00:00 2001 From: Guy Garcia Date: Sun, 22 Jun 2025 18:17:05 -0400 Subject: [PATCH 1/6] added workflow --- .github/workflows/tests.yml | 54 +++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..5ae169c --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,54 @@ +name: Smart Contracts Testing +on: + pull_request: + push: + branches: + - main + - testnet + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Restore cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - name: Install Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + + - name: Cache Sui installation + id: cache-sui + uses: actions/cache@v4 + with: + path: ~/.cargo/bin/sui + key: ${{ runner.os }}-sui-testnet-${{ hashFiles('.github/workflows/*.yml') }} + restore-keys: | + ${{ runner.os }}-sui-testnet- + + - name: Install Sui CLI + if: steps.cache-sui.outputs.cache-hit != 'true' + run: | + cargo install --locked --git https://github.com/MystenLabs/sui.git --branch testnet --features tracing sui + + - name: Verify Sui installation + run: | + sui --version + which sui + + - name: Run Sui Move tests + run: | + sui move test \ No newline at end of file From 83649e0e33bac9beb80af374899162981edbfa3b Mon Sep 17 00:00:00 2001 From: Guy Garcia Date: Sun, 22 Jun 2025 18:55:08 -0400 Subject: [PATCH 2/6] finished workflows --- .github/workflows/mainnet.yml | 101 +++++++++++++++++++++++++++++++++ .github/workflows/testnet.yml | 102 ++++++++++++++++++++++++++++++++++ .github/workflows/tests.yml | 54 ------------------ .gitignore | 1 + 4 files changed, 204 insertions(+), 54 deletions(-) create mode 100644 .github/workflows/mainnet.yml create mode 100644 .github/workflows/testnet.yml delete mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/mainnet.yml b/.github/workflows/mainnet.yml new file mode 100644 index 0000000..312e393 --- /dev/null +++ b/.github/workflows/mainnet.yml @@ -0,0 +1,101 @@ +name: Smart Contracts Testing +on: + pull_request: + push: + branches: + - mainnet + +jobs: + test: + name: Test Contracts + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Restore cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - name: Install Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + + - name: Cache Sui installation + id: cache-sui + uses: actions/cache@v4 + with: + path: ~/.cargo/bin/sui + key: ${{ runner.os }}-sui-mainnet-${{ hashFiles('.github/workflows/*.yml') }} + restore-keys: | + ${{ runner.os }}-sui-mainnet- + + - name: Install Sui CLI + if: steps.cache-sui.outputs.cache-hit != 'true' + run: | + cargo install --locked --git https://github.com/MystenLabs/sui.git --branch mainnet --features tracing sui + + - name: Verify Sui installation + run: | + sui --version + which sui + + - name: Run Sui Move tests + run: | + sui move test + + lint: + name: Lint Contracts + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Restore cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - name: Install Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + + - name: Cache Sui installation + id: cache-sui + uses: actions/cache@v4 + with: + path: ~/.cargo/bin/sui + key: ${{ runner.os }}-sui-mainnet-${{ hashFiles('.github/workflows/*.yml') }} + restore-keys: | + ${{ runner.os }}-sui-mainnet- + + - name: Install Sui CLI + if: steps.cache-sui.outputs.cache-hit != 'true' + run: | + cargo install --locked --git https://github.com/MystenLabs/sui.git --branch mainnet --features tracing sui + + - name: Verify Sui installation + run: | + sui --version + which sui + + - name: Run Sui Move lints + run: | + sui move build --lint --warnings-are-errors \ No newline at end of file diff --git a/.github/workflows/testnet.yml b/.github/workflows/testnet.yml new file mode 100644 index 0000000..a701ad0 --- /dev/null +++ b/.github/workflows/testnet.yml @@ -0,0 +1,102 @@ +name: Smart Contracts Testing +on: + pull_request: + push: + branches: + - main + - testnet + +jobs: + test: + name: Test Contracts + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Restore cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - name: Install Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + + - name: Cache Sui installation + id: cache-sui + uses: actions/cache@v4 + with: + path: ~/.cargo/bin/sui + key: ${{ runner.os }}-sui-testnet-${{ hashFiles('.github/workflows/*.yml') }} + restore-keys: | + ${{ runner.os }}-sui-testnet- + + - name: Install Sui CLI + if: steps.cache-sui.outputs.cache-hit != 'true' + run: | + cargo install --locked --git https://github.com/MystenLabs/sui.git --branch testnet --features tracing sui + + - name: Verify Sui installation + run: | + sui --version + which sui + + - name: Run Sui Move tests + run: | + sui move test + + lint: + name: Lint Contracts + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Restore cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - name: Install Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + + - name: Cache Sui installation + id: cache-sui + uses: actions/cache@v4 + with: + path: ~/.cargo/bin/sui + key: ${{ runner.os }}-sui-testnet-${{ hashFiles('.github/workflows/*.yml') }} + restore-keys: | + ${{ runner.os }}-sui-testnet- + + - name: Install Sui CLI + if: steps.cache-sui.outputs.cache-hit != 'true' + run: | + cargo install --locked --git https://github.com/MystenLabs/sui.git --branch testnet --features tracing sui + + - name: Verify Sui installation + run: | + sui --version + which sui + + - name: Run Sui Move lints + run: | + sui move build --lint --warnings-are-errors \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 5ae169c..0000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Smart Contracts Testing -on: - pull_request: - push: - branches: - - main - - testnet - -jobs: - test: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Restore cache - uses: actions/cache@v4 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - - name: Install Rust - uses: dtolnay/rust-toolchain@master - with: - toolchain: stable - - - name: Cache Sui installation - id: cache-sui - uses: actions/cache@v4 - with: - path: ~/.cargo/bin/sui - key: ${{ runner.os }}-sui-testnet-${{ hashFiles('.github/workflows/*.yml') }} - restore-keys: | - ${{ runner.os }}-sui-testnet- - - - name: Install Sui CLI - if: steps.cache-sui.outputs.cache-hit != 'true' - run: | - cargo install --locked --git https://github.com/MystenLabs/sui.git --branch testnet --features tracing sui - - - name: Verify Sui installation - run: | - sui --version - which sui - - - name: Run Sui Move tests - run: | - sui move test \ No newline at end of file diff --git a/.gitignore b/.gitignore index a007fea..a429920 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ build/* +.idea/* \ No newline at end of file From 149b1c00570d8365a24cc89e19a4a250da25c578 Mon Sep 17 00:00:00 2001 From: Guy Garcia Date: Sun, 22 Jun 2025 19:06:52 -0400 Subject: [PATCH 3/6] added better tool installs --- .github/workflows/mainnet.yml | 68 +++++++---------------------------- .github/workflows/testnet.yml | 68 +++++++---------------------------- 2 files changed, 24 insertions(+), 112 deletions(-) diff --git a/.github/workflows/mainnet.yml b/.github/workflows/mainnet.yml index 312e393..ddb2e60 100644 --- a/.github/workflows/mainnet.yml +++ b/.github/workflows/mainnet.yml @@ -14,40 +14,18 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Restore cache - uses: actions/cache@v4 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Install Rust uses: dtolnay/rust-toolchain@master with: toolchain: stable - - name: Cache Sui installation - id: cache-sui - uses: actions/cache@v4 - with: - path: ~/.cargo/bin/sui - key: ${{ runner.os }}-sui-mainnet-${{ hashFiles('.github/workflows/*.yml') }} - restore-keys: | - ${{ runner.os }}-sui-mainnet- - - name: Install Sui CLI - if: steps.cache-sui.outputs.cache-hit != 'true' - run: | - cargo install --locked --git https://github.com/MystenLabs/sui.git --branch mainnet --features tracing sui - - - name: Verify Sui installation - run: | - sui --version - which sui + uses: baptiste0928/cargo-install@v3 + with: + crate: sui + git: https://github.com/MystenLabs/sui.git + branch: mainnet + features: tracing - name: Run Sui Move tests run: | @@ -61,40 +39,18 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Restore cache - uses: actions/cache@v4 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Install Rust uses: dtolnay/rust-toolchain@master with: toolchain: stable - - name: Cache Sui installation - id: cache-sui - uses: actions/cache@v4 - with: - path: ~/.cargo/bin/sui - key: ${{ runner.os }}-sui-mainnet-${{ hashFiles('.github/workflows/*.yml') }} - restore-keys: | - ${{ runner.os }}-sui-mainnet- - - name: Install Sui CLI - if: steps.cache-sui.outputs.cache-hit != 'true' - run: | - cargo install --locked --git https://github.com/MystenLabs/sui.git --branch mainnet --features tracing sui - - - name: Verify Sui installation - run: | - sui --version - which sui + uses: baptiste0928/cargo-install@v3 + with: + crate: sui + git: https://github.com/MystenLabs/sui.git + branch: mainnet + features: tracing - name: Run Sui Move lints run: | diff --git a/.github/workflows/testnet.yml b/.github/workflows/testnet.yml index a701ad0..7a4bec7 100644 --- a/.github/workflows/testnet.yml +++ b/.github/workflows/testnet.yml @@ -15,40 +15,18 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Restore cache - uses: actions/cache@v4 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Install Rust uses: dtolnay/rust-toolchain@master with: toolchain: stable - - name: Cache Sui installation - id: cache-sui - uses: actions/cache@v4 - with: - path: ~/.cargo/bin/sui - key: ${{ runner.os }}-sui-testnet-${{ hashFiles('.github/workflows/*.yml') }} - restore-keys: | - ${{ runner.os }}-sui-testnet- - - name: Install Sui CLI - if: steps.cache-sui.outputs.cache-hit != 'true' - run: | - cargo install --locked --git https://github.com/MystenLabs/sui.git --branch testnet --features tracing sui - - - name: Verify Sui installation - run: | - sui --version - which sui + uses: baptiste0928/cargo-install@v3 + with: + crate: sui + git: https://github.com/MystenLabs/sui.git + branch: testnet + features: tracing - name: Run Sui Move tests run: | @@ -62,40 +40,18 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Restore cache - uses: actions/cache@v4 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Install Rust uses: dtolnay/rust-toolchain@master with: toolchain: stable - - name: Cache Sui installation - id: cache-sui - uses: actions/cache@v4 - with: - path: ~/.cargo/bin/sui - key: ${{ runner.os }}-sui-testnet-${{ hashFiles('.github/workflows/*.yml') }} - restore-keys: | - ${{ runner.os }}-sui-testnet- - - name: Install Sui CLI - if: steps.cache-sui.outputs.cache-hit != 'true' - run: | - cargo install --locked --git https://github.com/MystenLabs/sui.git --branch testnet --features tracing sui - - - name: Verify Sui installation - run: | - sui --version - which sui + uses: baptiste0928/cargo-install@v3 + with: + crate: sui + git: https://github.com/MystenLabs/sui.git + branch: testnet + features: tracing - name: Run Sui Move lints run: | From 3fdbfdaaeb788649fcf55ebd11dde1814a2d2032 Mon Sep 17 00:00:00 2001 From: Guy Garcia Date: Wed, 25 Jun 2025 20:24:08 -0400 Subject: [PATCH 4/6] changed the permissions --- .github/workflows/mainnet.yml | 1 - .github/workflows/testnet.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/mainnet.yml b/.github/workflows/mainnet.yml index ddb2e60..5c55fdd 100644 --- a/.github/workflows/mainnet.yml +++ b/.github/workflows/mainnet.yml @@ -1,7 +1,6 @@ name: Smart Contracts Testing on: pull_request: - push: branches: - mainnet diff --git a/.github/workflows/testnet.yml b/.github/workflows/testnet.yml index 7a4bec7..2c4d5fa 100644 --- a/.github/workflows/testnet.yml +++ b/.github/workflows/testnet.yml @@ -1,7 +1,6 @@ name: Smart Contracts Testing on: pull_request: - push: branches: - main - testnet From 53e6a500130bcd6810f8023ada0470587edeb42e Mon Sep 17 00:00:00 2001 From: Guy Garcia Date: Wed, 25 Jun 2025 20:25:17 -0400 Subject: [PATCH 5/6] added on push --- .github/workflows/mainnet.yml | 3 +++ .github/workflows/testnet.yml | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/.github/workflows/mainnet.yml b/.github/workflows/mainnet.yml index 5c55fdd..2f9a36a 100644 --- a/.github/workflows/mainnet.yml +++ b/.github/workflows/mainnet.yml @@ -3,6 +3,9 @@ on: pull_request: branches: - mainnet + push: + branches: + - mainnet jobs: test: diff --git a/.github/workflows/testnet.yml b/.github/workflows/testnet.yml index 2c4d5fa..29897b9 100644 --- a/.github/workflows/testnet.yml +++ b/.github/workflows/testnet.yml @@ -4,6 +4,10 @@ on: branches: - main - testnet + push: + branches: + - main + - testnet jobs: test: From aa84d5b164ddb08af011856d0905e8df89c95e8f Mon Sep 17 00:00:00 2001 From: Guy Garcia Date: Wed, 25 Jun 2025 20:59:12 -0400 Subject: [PATCH 6/6] make actions happen sequentially --- .github/workflows/mainnet.yml | 1 + .github/workflows/testnet.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/mainnet.yml b/.github/workflows/mainnet.yml index 2f9a36a..c390a32 100644 --- a/.github/workflows/mainnet.yml +++ b/.github/workflows/mainnet.yml @@ -35,6 +35,7 @@ jobs: lint: name: Lint Contracts + needs: test runs-on: ubuntu-latest steps: diff --git a/.github/workflows/testnet.yml b/.github/workflows/testnet.yml index 29897b9..62b0f28 100644 --- a/.github/workflows/testnet.yml +++ b/.github/workflows/testnet.yml @@ -37,6 +37,7 @@ jobs: lint: name: Lint Contracts + needs: test runs-on: ubuntu-latest steps: