Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: migrate to github actions #992

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
162 changes: 0 additions & 162 deletions .circleci/config.yml

This file was deleted.

152 changes: 152 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,152 @@
name: CI

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize]

jobs:

install_dependencies:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: |
npm install
npm run cp-ci-env
- uses: bissolli/gh-action-persist-workspace@v1
with:
action: persist

test:
runs-on: ubuntu-latest
needs: install_dependencies
steps:
- uses: bissolli/gh-action-persist-workspace@v1
with:
action: retrieve
- name: Run tests
run: |
CI=true npm run test
- name: Store artifacts
uses: actions/upload-artifact@v2
with:
name: test
path: test

scenarios:
runs-on: ubuntu-latest
needs: install_dependencies
steps:
- uses: bissolli/gh-action-persist-workspace@v1
with:
action: retrieve
- name: Run scenarios
run: |
CI=true npm run scenarios
- name: Store artifacts
uses: actions/upload-artifact@v2
with:
name: scenarios
path: scenarios

lint:
runs-on: ubuntu-latest
needs: install_dependencies
steps:
- uses: bissolli/gh-action-persist-workspace@v1
with:
action: retrieve
- name: Run Lint
run: npm run lint
- name: Store artifacts
uses: actions/upload-artifact@v2
with:
name: lint
path: lint

coverage:
runs-on: ubuntu-latest
needs: install_dependencies
steps:
- uses: bissolli/gh-action-persist-workspace@v1
with:
action: retrieve
- name: Run Coverage
run: npm run coverage
- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Store artifacts
uses: actions/upload-artifact@v2
with:
name: coverage
path: coverage

slither:
runs-on: ubuntu-latest
needs: install_dependencies
steps:
- uses: bissolli/gh-action-persist-workspace@v1
with:
action: retrieve
- name: Run Slither
uses: crytic/slither-action@v0.3.0
id: slither
with:
node-version: 16
sarif: results.sarif
fail-on: high

# WIP can safely be ignored
# gasCompare:
# runs-on: ubuntu-latest
# needs: install_dependencies
# steps:
# - uses: bissolli/gh-action-persist-workspace@v1
# with:
# action: retrieve
# - name: Run GasCompare
# run: |
# if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
# BRANCH_NAME=$GITHUB_HEAD_REF
# else
# BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//-/g')
# fi
# echo "Current branch is $BRANCH_NAME"
# if [ "$BRANCH_NAME" == "master" ]; then
# echo "This is the master branch. Exiting..."
# exit 0
# fi
# CI=true npm run test
# mv ./gasReporterOutput.json /tmp/gasReporterOutput_Current.json
# git checkout master
# npm install
# CI=true npm run test
# mv ./gasReporterOutput.json /tmp/gasReporterOutput_Master.json

# - uses: bissolli/gh-action-persist-workspace@v1
# with:
# action: persist

# - name: Checkout
# uses: actions/checkout@v3

# - uses: bissolli/gh-action-persist-workspace@v1
# with:
# action: retrieve

# - name: Run GasCompare
# run: |
# npm run gasCompare /tmp/gasReporterOutput_Current.json /tmp/gasReporterOutput_Master.json
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -53,7 +53,6 @@
"@primitivefi/hardhat-dodoc": "^0.1.3",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/git": "^10.0.1",
"circleci-pr-commenter": "^0.1.2",
"fs": "^0.0.1-security",
"hardhat": "^2.11.0",
"hardhat-abi-exporter": "^2.3.0",
Expand Down
25 changes: 8 additions & 17 deletions scripts/gasCompare.js
@@ -1,8 +1,5 @@
const fs = require("fs");
const markdown = require('json-to-markdown-table');
const Commenter = require('circleci-pr-commenter');

const commenter = new Commenter()

let arguments = process.argv

Expand Down Expand Up @@ -79,21 +76,15 @@ let gasCompare = async () => {
}
}
}
let markdownstring = markdown(gasChangeData,coloumn);
if(gasChangeData.length!==0){

await commenter.createOrUpdateComment('gasCompare', markdownstring ).catch(err=>{
console.log(markdownstring);
})

let markdownString = markdown(gasChangeData, coloumn);

if (gasChangeData.length !== 0) {
// Write the markdown to a file called gasCompareOutput.json
yohanelly95 marked this conversation as resolved.
Show resolved Hide resolved
fs.writeFileSync('gasCompareOutput.md', markdownString);
} else {
console.log("No changes found in gas Consumption");
}

else{
await commenter.createOrUpdateComment('gasCompare', `No changes found in gas Consumption`).catch(err=>
{
console.log(`No changes found in gas Consumption`);
})

}
}

gasCompare();