-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:NEAR-DevHub/neardevhub-bos into fea…
…ture/events-bos-ws
- Loading branch information
Showing
62 changed files
with
11,876 additions
and
37 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
.github/workflows/continuous-integration-workflow-infra.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: CI - Infrastructure Committee | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
prettier: | ||
name: Prettier | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
cache: "npm" | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Run code formatting check | ||
run: npm run fmt:check | ||
|
||
playwright-tests-infra: | ||
name: Infrastructure Committee - Playwright tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
cache: "npm" | ||
- name: Install dependencies | ||
run: | | ||
npm ci | ||
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/mpeterdev/bos-loader/releases/download/v0.7.1/bos-loader-v0.7.1-installer.sh | sh | ||
npx playwright install-deps | ||
npx playwright install | ||
- name: Run tests | ||
run: | | ||
INSTANCE=infrastructure npx playwright test --project=infrastructure playwright-tests/tests/infrastructure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Deploy Widgets to Mainnet - Infrastructure | ||
on: | ||
pull_request: | ||
push: | ||
branches: [main] | ||
jobs: | ||
deploy-widgets: | ||
runs-on: ubuntu-latest | ||
name: Deploy ( or diff from PR ) | ||
env: | ||
NEAR_SOCIAL_DEPLOY_ID: ${{ vars.NEAR_INFRA_SOCIAL_ACCOUNT_ID }} | ||
NEAR_SOCIAL_ACCOUNT_ID: ${{ vars.NEAR_INFRA_SOCIAL_ACCOUNT_ID }} | ||
NEAR_SOCIAL_ACCOUNT_PUBLIC_KEY: ${{ vars.NEAR_INFRA_SOCIAL_ACCOUNT_PUBLIC_KEY }} | ||
NEAR_SOCIAL_ACCOUNT_PRIVATE_KEY: ${{ secrets.NEAR_INFRA_SOCIAL_ACCOUNT_PRIVATE_KEY }} | ||
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} | ||
defaults: | ||
run: | ||
working-directory: ./instances/infrastructure-committee.near | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set replacements | ||
id: set_replacements | ||
run: | | ||
echo "replacements=$(jq -r '[to_entries[] | .["find"] = "${" + .key + "}" | .["replace"] = .value | del(.key, .value), {"find": "${REPL_POSTHOG_API_KEY}", "replace": "'$POSTHOG_API_KEY'"}]' aliases.mainnet.json | tr -d "\n\r")" >> $GITHUB_OUTPUT | ||
- name: Replace placeholders | ||
uses: flcdrg/replace-multiple-action@v1 | ||
with: | ||
files: "**/*.jsx" | ||
find: "${{ steps.set_replacements.outputs.replacements }}" | ||
prefix: "(^|.*)" | ||
suffix: "($|.*)" | ||
|
||
- name: Install bos CLI | ||
run: | | ||
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/FroVolod/bos-cli-rs/releases/download/v0.3.6/bos-cli-installer.sh | sh | ||
- name: Deploy widgets | ||
run: | | ||
BRANCH="$(git rev-parse --abbrev-ref HEAD)" | ||
echo "on branch $BRANCH" | ||
if [[ "$BRANCH" != "main" ]]; then | ||
echo "Not on main branch, dry run by diff with infrastructure-committee.near" | ||
bos components diff infrastructure-committee.near network-config mainnet | ||
else | ||
bos components deploy "$NEAR_INFRA_SOCIAL_DEPLOY_ID" sign-as "$NEAR_INFRA_SOCIAL_ACCOUNT_ID" network-config mainnet sign-with-plaintext-private-key --signer-public-key "$NEAR_INFRA_SOCIAL_ACCOUNT_PUBLIC_KEY" --signer-private-key "$NEAR_INFRA_SOCIAL_ACCOUNT_PRIVATE_KEY" send | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
build | ||
dist |
12 changes: 12 additions & 0 deletions
12
instances/infrastructure-committee.near/aliases.mainnet.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"REPL_DEVHUB": "devhub.near", | ||
"REPL_INFRASTRUCTURE_COMMITTEE": "infrastructure-committee.near", | ||
"REPL_INFRASTRUCTURE_COMMITTEE_CONTRACT": "infrastructure-committee.near", | ||
"REPL_NEAR": "near", | ||
"REPL_RPC_URL": "https://rpc.mainnet.near.org", | ||
"REPL_RFP_IMAGE": "https://ipfs.near.social/ipfs/bafkreicbygt4kajytlxij24jj6tkg2ppc2dw3dlqhkermkjjfgdfnlizzy", | ||
"REPL_RFP_FEED_INDEXER_QUERY_NAME": "polyprogrammist_near_devhub_ic_v1_rfps_with_latest_snapshot", | ||
"REPL_RFP_INDEXER_QUERY_NAME": "polyprogrammist_near_devhub_ic_v1_rfp_snapshots", | ||
"REPL_PROPOSAL_FEED_INDEXER_QUERY_NAME": "polyprogrammist_near_devhub_ic_v1_proposals_with_latest_snapshot", | ||
"REPL_PROPOSAL_QUERY_NAME": "polyprogrammist_near_devhub_ic_v1_proposal_snapshots" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"account": "infrastructure-committee.near", | ||
"aliasPrefix": "REPL", | ||
"aliasesContainsPrefix": true, | ||
"aliases": ["./aliases.mainnet.json"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"infrastructure-committee.near": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
widget |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
/** | ||
* This is the main entry point for the RFP application. | ||
* Page route gets passed in through params, along with all other page props. | ||
*/ | ||
|
||
const { page, ...passProps } = props; | ||
|
||
// Import our modules | ||
const { AppLayout } = VM.require( | ||
`${REPL_INFRASTRUCTURE_COMMITTEE}/widget/components.template.AppLayout` | ||
); | ||
|
||
if (!AppLayout) { | ||
return <p>Loading modules...</p>; | ||
} | ||
|
||
// CSS styles to be used across the app. | ||
// Define fonts here, as well as any other global styles. | ||
const Theme = styled.div` | ||
a { | ||
color: inherit; | ||
} | ||
.attractable { | ||
box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important; | ||
transition: box-shadow 0.6s; | ||
&:hover { | ||
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important; | ||
} | ||
} | ||
`; | ||
|
||
if (!page) { | ||
// If no page is specified, we default to the feed page TEMP | ||
page = "about"; | ||
} | ||
|
||
// This is our navigation, rendering the page based on the page parameter | ||
function Page() { | ||
const routes = page.split("."); | ||
switch (routes[0]) { | ||
case "about": { | ||
return ( | ||
<Widget | ||
src={`${REPL_INFRASTRUCTURE_COMMITTEE}/widget/components.pages.about`} | ||
props={passProps} | ||
/> | ||
); | ||
} | ||
case "rfps": { | ||
return ( | ||
<Widget | ||
src={`${REPL_INFRASTRUCTURE_COMMITTEE}/widget/components.rfps.Feed`} | ||
props={passProps} | ||
/> | ||
); | ||
} | ||
case "rfp": { | ||
return ( | ||
<Widget | ||
src={`${REPL_INFRASTRUCTURE_COMMITTEE}/widget/components.rfps.Rfp`} | ||
props={passProps} | ||
/> | ||
); | ||
} | ||
case "create-rfp": { | ||
return ( | ||
<Widget | ||
src={`${REPL_INFRASTRUCTURE_COMMITTEE}/widget/components.rfps.Editor`} | ||
props={passProps} | ||
/> | ||
); | ||
} | ||
case "create-proposal": { | ||
return ( | ||
<Widget | ||
src={`${REPL_INFRASTRUCTURE_COMMITTEE}/widget/components.proposals.Editor`} | ||
props={{ ...passProps }} | ||
/> | ||
); | ||
} | ||
|
||
case "proposals": { | ||
return ( | ||
<Widget | ||
src={`${REPL_INFRASTRUCTURE_COMMITTEE}/widget/components.proposals.Feed`} | ||
props={passProps} | ||
/> | ||
); | ||
} | ||
case "proposal": { | ||
return ( | ||
<Widget | ||
src={`${REPL_INFRASTRUCTURE_COMMITTEE}/widget/components.proposals.Proposal`} | ||
props={passProps} | ||
/> | ||
); | ||
} | ||
case "about": { | ||
return ( | ||
<Widget | ||
src={`${REPL_INFRASTRUCTURE_COMMITTEE}/widget/components.pages.about`} | ||
props={passProps} | ||
/> | ||
); | ||
} | ||
case "admin": { | ||
return ( | ||
<Widget | ||
src={`${REPL_INFRASTRUCTURE_COMMITTEE}/widget/components.pages.admin`} | ||
props={passProps} | ||
/> | ||
); | ||
} | ||
default: { | ||
// TODO: 404 page | ||
return <p>404</p>; | ||
} | ||
} | ||
} | ||
|
||
return ( | ||
<Theme> | ||
<AppLayout page={page}> | ||
<Page /> | ||
</AppLayout> | ||
</Theme> | ||
); |
Oops, something went wrong.