Skip to content

Commit

Permalink
Adds web4 contract (#457)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
elliotBraem authored and Megha-Dev-19 committed Jul 8, 2024
1 parent bce333f commit 33e3ddd
Show file tree
Hide file tree
Showing 12 changed files with 6,566 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/web4-deploy-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Deploy to production
on:
push:
branches: [main]
paths:
- web4contract/**

defaults:
run:
working-directory: ./web4contract

jobs:
test:
uses: ./.github/workflows/web4-test.yml

deploy-staging:
name: Deploy to production
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install cargo-near CLI
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
- name: Deploy to production
run: |
cargo near deploy "${{ vars.BOS_DEPLOY_ACCOUNT_ID }}" \
without-init-call \
network-config "mainnet" \
sign-with-plaintext-private-key \
--signer-public-key "${{ vars.BOS_SIGNER_PUBLIC_KEY }}" \
--signer-private-key "${{ secrets.BOS_BUILDDAO_SIGNER_PRIVATE_KEY }}" \
send
58 changes: 58 additions & 0 deletions .github/workflows/web4-deploy-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Deploy to staging
on:
pull_request:
paths:
- web4contract/**

defaults:
run:
working-directory: ./web4contract

jobs:
test:
uses: ./.github/workflows/web4-test.yml

deploy-staging:
name: Deploy to staging subaccount
permissions:
pull-requests: write
needs: [test]
runs-on: ubuntu-latest
env:
NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID: gh-${{ github.event.number }}.${{ vars.BOS_TESTNET_SIGNER_ACCOUNT_ID }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install near CLI
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
- name: Create staging account
if: github.event.action == 'opened' || github.event.action == 'reopened'
run: |
near account create-account fund-myself "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" '10 NEAR' \
use-manually-provided-public-key "${{ vars.BOS_TESTNET_SIGNER_PUBLIC_KEY }}" \
sign-as "${{ vars.BOS_TESTNET_SIGNER_ACCOUNT_ID }}" \
network-config "testnet" \
sign-with-plaintext-private-key \
--signer-public-key "${{ vars.BOS_TESTNET_SIGNER_PUBLIC_KEY }}" \
--signer-private-key "${{ secrets.BOS_BUILDDAO_TESTNET_SIGNER_PRIVATE_KEY }}" \
send
- name: Install cargo-near CLI
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
- name: Deploy to staging
run: |
cargo near deploy "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" \
without-init-call \
network-config "testnet" \
sign-with-plaintext-private-key \
--signer-public-key "${{ vars.BOS_TESTNET_SIGNER_PUBLIC_KEY }}" \
--signer-private-key "${{ secrets.BOS_BUILDDAO_TESTNET_SIGNER_PRIVATE_KEY }}" \
send
- name: Comment on pull request
env:
GH_TOKEN: ${{ github.token }}
run: |
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 }})"
36 changes: 36 additions & 0 deletions .github/workflows/web4-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Test
on:
workflow_call:

defaults:
run:
working-directory: ./web4contract

jobs:
code-formatting:
name: Code Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- run: cargo fmt --check

code-linter:
name: Code Linter
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run cargo clippy
run: |
rustup component add clippy
cargo clippy --all-features --workspace --tests -- --warn clippy::all --warn clippy::nursery
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run cargo test
run: cargo test
31 changes: 31 additions & 0 deletions .github/workflows/web4-undeploy-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Undeploy staging
on:
pull_request:
types: [closed]
paths:
- web4contract/**

defaults:
run:
working-directory: ./web4contract

jobs:
cleanup-staging:
name: Cleanup staging account
runs-on: ubuntu-latest
env:
NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID: gh-${{ github.event.number }}.${{ vars.BOS_TESTNET_SIGNER_ACCOUNT_ID }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install near CLI
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
- name: Remove staging account
run: |
near account delete-account "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" \
beneficiary "${{ vars.BOS_TESTNET_SIGNER_ACCOUNT_ID }}" \
network-config "testnet" \
sign-with-plaintext-private-key \
--signer-public-key "${{ vars.BOS_TESTNET_SIGNER_PUBLIC_KEY }}" \
--signer-private-key "${{ secrets.BOS_BUILDDAO_TESTNET_SIGNER_PRIVATE_KEY }}" \
send
17 changes: 17 additions & 0 deletions apps/new/widget/Index.metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "Build DAO",
"description": "Support Systems for Open Web Projects",
"linktree": {
"website": "nearbuilders.org"
},
"image": {
"ipfs_cid": "bafkreie5hd6cfckrpyx6nmtgwzlmsd356nh2e6pqeryond3b54ejqeszqi"
},
"tags": {
"build": "",
"dao": "",
"public-goods": "",
"open-source": "",
"app": ""
}
}
1 change: 1 addition & 0 deletions web4contract/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
Loading

0 comments on commit 33e3ddd

Please sign in to comment.