-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from Hats-Protocol/github-actions
Automated tests and bundling
- Loading branch information
Showing
20 changed files
with
522 additions
and
313 deletions.
There are no files selected for viewing
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,34 @@ | ||
name: "Bundle" | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "modules/*.json" | ||
- "infra/*.json" | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.16.1 | ||
- name: Set up foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
- name: Install | ||
run: yarn install --frozen-lockfile | ||
- name: Bundle | ||
run: | | ||
yarn bundle | ||
yarn format-bundle | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
git add . | ||
git commit -m "automated bundle" | ||
git push |
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,39 @@ | ||
name: "Test" | ||
|
||
on: [pull_request] | ||
|
||
env: | ||
GOERLI_RPC: https://goerli.infura.io/v3/${{ secrets.INFURA_KEY }} | ||
SEPOLIA_RPC: https://sepolia.infura.io/v3/${{ secrets.INFURA_KEY }} | ||
MAINNET_RPC: https://mainnet.infura.io/v3/${{ secrets.INFURA_KEY }} | ||
POLYGON_RPC: https://polygon-mainnet.infura.io/v3/${{ secrets.INFURA_KEY }} | ||
OPTIMISM_RPC: https://optimism-mainnet.infura.io/v3/${{ secrets.INFURA_KEY }} | ||
ARBITRUM_RPC: https://arbitrum-mainnet.infura.io/v3/${{ secrets.INFURA_KEY }} | ||
GNOSIS_RPC: https://gnosis.publicnode.com | ||
BASE_RPC: https://base.publicnode.com | ||
PGN_RPC: https://rpc.publicgoods.network | ||
CELO_RPC: https://forno.celo.org | ||
ETHERSCAN_KEY: ${{ secrets.ETHERSCAN_KEY }} | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.16.1 | ||
- name: Set up foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
- name: Install | ||
run: yarn install --frozen-lockfile | ||
- name: Check Format | ||
run: yarn prettier . --check | ||
- name: Test | ||
uses: nick-fields/retry@v2 | ||
with: | ||
timeout_minutes: 10 | ||
max_attempts: 3 | ||
command: yarn test |
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,30 @@ | ||
import * as fs from "fs"; | ||
|
||
export function bundleModules() { | ||
const factoryBuffer = fs.readFileSync("./infra/factory.json"); | ||
const factory = JSON.parse(factoryBuffer.toString()); | ||
|
||
const eligibilitiesChainBuffer = fs.readFileSync( | ||
"./infra/eligibilitiesChain.json", | ||
); | ||
const eligibilitiesChain = JSON.parse(eligibilitiesChainBuffer.toString()); | ||
|
||
const togglesChainBuffer = fs.readFileSync("./infra/togglesChain.json"); | ||
const togglesChain = JSON.parse(togglesChainBuffer.toString()); | ||
|
||
let moduleFiles = fs.readdirSync("modules"); | ||
const modules = []; | ||
for (let i = 0; i < moduleFiles.length; i++) { | ||
const moduleFile = moduleFiles[i]; | ||
const moduleBuffer = fs.readFileSync(`./modules/${moduleFile}`); | ||
const module = JSON.parse(moduleBuffer.toString()); | ||
modules.push(module); | ||
} | ||
|
||
return { | ||
factory, | ||
eligibilitiesChain, | ||
togglesChain, | ||
modules, | ||
}; | ||
} |
This file was deleted.
Oops, something went wrong.
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,9 @@ | ||
import { bundleModules } from "./bundler"; | ||
import * as fs from "fs"; | ||
|
||
export function updateBundle() { | ||
const bundledModules = bundleModules(); | ||
fs.writeFileSync("modules.json", JSON.stringify(bundledModules)); | ||
} | ||
|
||
updateBundle(); |
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
Oops, something went wrong.