Skip to content

Commit 33e3ddd

Browse files
elliotBraemMegha-Dev-19
authored andcommitted
Adds web4 contract (#457)
* init * tests pass, init * tests pass * configures workflow * update web component * sets default workflow wd * upgrade versions * add network * adds metadata * fmt * updates contract for testnet social db * set title
1 parent bce333f commit 33e3ddd

File tree

12 files changed

+6566
-0
lines changed

12 files changed

+6566
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Deploy to production
2+
on:
3+
push:
4+
branches: [main]
5+
paths:
6+
- web4contract/**
7+
8+
defaults:
9+
run:
10+
working-directory: ./web4contract
11+
12+
jobs:
13+
test:
14+
uses: ./.github/workflows/web4-test.yml
15+
16+
deploy-staging:
17+
name: Deploy to production
18+
needs: [test]
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
- name: Install cargo-near CLI
24+
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/cargo-near/releases/download/cargo-near-v0.6.2/cargo-near-installer.sh | sh
25+
- name: Deploy to production
26+
run: |
27+
cargo near deploy "${{ vars.BOS_DEPLOY_ACCOUNT_ID }}" \
28+
without-init-call \
29+
network-config "mainnet" \
30+
sign-with-plaintext-private-key \
31+
--signer-public-key "${{ vars.BOS_SIGNER_PUBLIC_KEY }}" \
32+
--signer-private-key "${{ secrets.BOS_BUILDDAO_SIGNER_PRIVATE_KEY }}" \
33+
send
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Deploy to staging
2+
on:
3+
pull_request:
4+
paths:
5+
- web4contract/**
6+
7+
defaults:
8+
run:
9+
working-directory: ./web4contract
10+
11+
jobs:
12+
test:
13+
uses: ./.github/workflows/web4-test.yml
14+
15+
deploy-staging:
16+
name: Deploy to staging subaccount
17+
permissions:
18+
pull-requests: write
19+
needs: [test]
20+
runs-on: ubuntu-latest
21+
env:
22+
NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID: gh-${{ github.event.number }}.${{ vars.BOS_TESTNET_SIGNER_ACCOUNT_ID }}
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Install near CLI
29+
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/near-cli-rs/releases/download/v0.11.1/near-cli-rs-installer.sh | sh
30+
- name: Create staging account
31+
if: github.event.action == 'opened' || github.event.action == 'reopened'
32+
run: |
33+
near account create-account fund-myself "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" '10 NEAR' \
34+
use-manually-provided-public-key "${{ vars.BOS_TESTNET_SIGNER_PUBLIC_KEY }}" \
35+
sign-as "${{ vars.BOS_TESTNET_SIGNER_ACCOUNT_ID }}" \
36+
network-config "testnet" \
37+
sign-with-plaintext-private-key \
38+
--signer-public-key "${{ vars.BOS_TESTNET_SIGNER_PUBLIC_KEY }}" \
39+
--signer-private-key "${{ secrets.BOS_BUILDDAO_TESTNET_SIGNER_PRIVATE_KEY }}" \
40+
send
41+
42+
- name: Install cargo-near CLI
43+
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/cargo-near/releases/download/cargo-near-v0.6.2/cargo-near-installer.sh | sh
44+
- name: Deploy to staging
45+
run: |
46+
cargo near deploy "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" \
47+
without-init-call \
48+
network-config "testnet" \
49+
sign-with-plaintext-private-key \
50+
--signer-public-key "${{ vars.BOS_TESTNET_SIGNER_PUBLIC_KEY }}" \
51+
--signer-private-key "${{ secrets.BOS_BUILDDAO_TESTNET_SIGNER_PRIVATE_KEY }}" \
52+
send
53+
54+
- name: Comment on pull request
55+
env:
56+
GH_TOKEN: ${{ github.token }}
57+
run: |
58+
gh pr comment "${{ github.event.number }}" --body "Staging contract is deployed to ["'`'"${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}"'`'" account](https://explorer.testnet.near.org/accounts/${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }})"

.github/workflows/web4-test.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Test
2+
on:
3+
workflow_call:
4+
5+
defaults:
6+
run:
7+
working-directory: ./web4contract
8+
9+
jobs:
10+
code-formatting:
11+
name: Code Formatting
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
- run: cargo fmt --check
17+
18+
code-linter:
19+
name: Code Linter
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
- name: Run cargo clippy
25+
run: |
26+
rustup component add clippy
27+
cargo clippy --all-features --workspace --tests -- --warn clippy::all --warn clippy::nursery
28+
29+
tests:
30+
name: Tests
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v4
35+
- name: Run cargo test
36+
run: cargo test
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Undeploy staging
2+
on:
3+
pull_request:
4+
types: [closed]
5+
paths:
6+
- web4contract/**
7+
8+
defaults:
9+
run:
10+
working-directory: ./web4contract
11+
12+
jobs:
13+
cleanup-staging:
14+
name: Cleanup staging account
15+
runs-on: ubuntu-latest
16+
env:
17+
NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID: gh-${{ github.event.number }}.${{ vars.BOS_TESTNET_SIGNER_ACCOUNT_ID }}
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
- name: Install near CLI
22+
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/near/near-cli-rs/releases/download/v0.11.1/near-cli-rs-installer.sh | sh
23+
- name: Remove staging account
24+
run: |
25+
near account delete-account "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" \
26+
beneficiary "${{ vars.BOS_TESTNET_SIGNER_ACCOUNT_ID }}" \
27+
network-config "testnet" \
28+
sign-with-plaintext-private-key \
29+
--signer-public-key "${{ vars.BOS_TESTNET_SIGNER_PUBLIC_KEY }}" \
30+
--signer-private-key "${{ secrets.BOS_BUILDDAO_TESTNET_SIGNER_PRIVATE_KEY }}" \
31+
send
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "Build DAO",
3+
"description": "Support Systems for Open Web Projects",
4+
"linktree": {
5+
"website": "nearbuilders.org"
6+
},
7+
"image": {
8+
"ipfs_cid": "bafkreie5hd6cfckrpyx6nmtgwzlmsd356nh2e6pqeryond3b54ejqeszqi"
9+
},
10+
"tags": {
11+
"build": "",
12+
"dao": "",
13+
"public-goods": "",
14+
"open-source": "",
15+
"app": ""
16+
}
17+
}

web4contract/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

0 commit comments

Comments
 (0)