Skip to content

Commit

Permalink
Merge pull request #31 from Arrow-air/dodoc
Browse files Browse the repository at this point in the history
Add dodoc and associated CI/CD actions
  • Loading branch information
GoodluckH authored May 9, 2022
2 parents 99d80cc + f59e414 commit 09278ea
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 6 deletions.
19 changes: 19 additions & 0 deletions .github/actions/install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Install dependencies
description: "Checkout code and install node dependencies using cache if available"

inputs:
node-version:
required: true
description: "The node version to use for node setup"

runs:
using: "composite"
steps:
- name: Use Node.js ${{ inputs.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ inputs.node-version }}
cache: "npm"
- name: Install dependencies
shell: bash
run: npm ci
55 changes: 55 additions & 0 deletions .github/workflows/GenerateDocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, and run hardhat dodoc on Arrow contracts

name: Generate docs

on:
push:
branches:
- main
workflow_dispatch:

jobs:
generate-docs:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
uses: ./.github/actions/install
with:
node-version: 16.x
- name: Run hardhat dodoc
run: npm run dodoc
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: "${{ secrets.AWS_ROLE_ARN }}"
role-session-name: arrow-contracts-generate-docs
aws-region: "us-east-2"
- name: Sync files to S3 for processing
id: sync_s3
run: |
FILES_CHANGED=$(aws s3 sync ./docs/ "s3://${{ secrets.AWS_S3_BUCKET }}${{ secrets.AWS_S3_DOCS_DEST_PATH }}" --delete --size-only | wc -l)
echo "::set-output name=files_changed::$FILES_CHANGED"
outputs:
files_changed: "${{ steps.sync_s3.outputs.files_changed }}"

publish-docs:
runs-on: ubuntu-latest
needs: [generate-docs]
if: needs.generate-docs.outputs.files_changed > 0
steps:
- name: Info
run: |
echo '::echo::on'
echo "Running action since files_changed is set to: ${{ needs.generate-docs.outputs.files_changed }}"
- name: Dispatch website deploy docs action
uses: peter-evans/repository-dispatch@v2
with:
repository: Arrow-Air/website
event-type: deploy-docs
token: "${{ secrets.REPO_ACCESS_TOKEN }}"
client-payload: '{"environment": "production"}'
7 changes: 2 additions & 5 deletions .github/workflows/HardhatTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
- name: Install dependencies Node.js version ${{ matrix.node-version }}
uses: ./.github/actions/install
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run hardhat tests
run: npm run test
7 changes: 6 additions & 1 deletion hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ require("@nomiclabs/hardhat-etherscan");
require("@nomiclabs/hardhat-ethers");
require("@openzeppelin/hardhat-upgrades");
require("@openzeppelin/hardhat-defender");
require('@primitivefi/hardhat-dodoc');


/**
Expand All @@ -19,7 +20,11 @@ module.exports = {
},

defaultNetwork: "hardhat",

dodoc: {
runOnCompile: false,
exclude: ["test/", "openzeppelin"],
debugMode: false
},
networks: {
hardhat: {},
mainnet: {
Expand Down
37 changes: 37 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
},
"scripts": {
"test": "npx hardhat test",
"dodoc": "npx hardhat dodoc",
"verifyOptimismKovan": "npx hardhat verify --network optimismKovan",
"deployOptimismKovan": "npx hardhat deploy --network optimismKovan"
},
Expand All @@ -34,6 +35,7 @@
"@nomiclabs/hardhat-web3": "^2.0.0",
"@openzeppelin/contracts": "^4.5.0",
"@openzeppelin/contracts-upgradeable": "^4.5.1",
"@primitivefi/hardhat-dodoc": "^0.2.3",
"dotenv": "^16.0.0",
"ethers": "^5.5.4",
"web3": "^1.7.0"
Expand Down

0 comments on commit 09278ea

Please sign in to comment.