Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: build scripts (rust 1.81) #149

Merged
merged 14 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
{
"image": "ghcr.io/near/near-devcontainer:latest",
"features": {
"ghcr.io/near/near-devcontainers/features/cargo-near:latest": {},
"ghcr.io/near/near-devcontainers/features/near-cli:latest": {}
},
"customizations": {
"vscode": {
"extensions": [
"dtsvet.vscode-wasm",
"rust-lang.rust-analyzer",
"github.vscode-github-actions"
"github.vscode-github-actions",
"vadimcn.vscode-lldb"
]
}
},
Expand Down
6 changes: 2 additions & 4 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/bin/bash

(cd discussions && cargo near build)
(cd community && cargo near build)
(cd community-factory && cargo near build)
cargo near build
(cd community-factory && cargo near build --no-docker)
cargo near build --no-docker
8 changes: 2 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@ jobs:
- uses: Swatinem/rust-cache@v1
- name: Install cargo-near
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/cargo-near/releases/latest/download/cargo-near-installer.sh | sh
- name: Build discussions contract
run: cd discussions && cargo near build
- name: Build community contract
run: cd community && cargo near build
- name: Build community factory contract
run: cd community-factory && cargo near build
run: cd community-factory && cargo near build --no-docker
- name: Build devhub contract
run: cargo near build
run: cargo near build --no-docker
- name: Unit tests
run: cargo test
8 changes: 2 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,10 @@ jobs:
- uses: Swatinem/rust-cache@v1
- name: Install cargo-near
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/cargo-near/releases/latest/download/cargo-near-installer.sh | sh
- name: Build discussions contract
run: cd discussions && cargo near build
- name: Build community contract
run: cd community && cargo near build
- name: Build community factory contract
run: cd community-factory && cargo near build
run: cd community-factory && cargo near build --no-docker
- name: Build devhub contract
run: cargo near build
run: cargo near build --no-docker
- name: Install near CLI
run: |
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/near-cli-rs/releases/download/v0.3.1/near-cli-rs-v0.3.1-installer.sh | sh
Expand Down
117 changes: 106 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ near-sdk = { version = "5.1.0", features = ["unit-testing"] }
insta = { version = "1.31.0", features = ["json", "redactions"] }
regex = "1"
near-workspaces = { version = "0.10.0", features = ["unstable"], default-features = false }
cargo-near-build = "0.1.0"
tokio = { version = "1.10.0", features = ["full"] }
anyhow = "1.0"

Expand Down
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,10 @@ Before starting, make sure you have the following installed:
From the root directory, run:

```sh
cd discussions
cargo near build
cd ../community
cargo near build
cd ../community-factory
cargo near build
cd community-factory
cargo near build --no-docker
cd ..
cargo near build
cargo near build --no-docker
```

## Running Tests
Expand All @@ -36,12 +32,22 @@ From the root directory, run:
cargo test
```

NOTE: integration tests automatically build the `devhub-community-factory` and
`devhub` they depend on and place them into `target/devhub-tests-contracts`.

To trigger rebuild of contracts being tested, e.g. after their modification,
one should run:

```bash
rm -rf target/devhub-tests-contracts
```
dj8yfo marked this conversation as resolved.
Show resolved Hide resolved

## Deploying

Using [cargo-near](https://github.com/near/cargo-near), run the following command. Be sure to set your own account id and corresponding network.

```sh
cargo near deploy {{account.near}}
cargo near deploy --no-docker {{account.near}}
cd community-factory
cargo near deploy {{community.account.near}}
cargo near deploy --no-docker {{community.account.near}}
```
Loading
Loading