From 884e56f4707e8f641b02bf1f5aae57c9f1d8096d Mon Sep 17 00:00:00 2001 From: yohanelly95 Date: Mon, 2 Oct 2023 17:16:06 +0530 Subject: [PATCH] chore: migrate to github actions --- .github/workflows/ci.yml | 174 ++++++++++++++------------------------- 1 file changed, 64 insertions(+), 110 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f578d99..8d1e0e49 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,129 +23,83 @@ jobs: 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 - - gasCompare: + test: runs-on: ubuntu-latest needs: install_dependencies steps: - uses: bissolli/gh-action-persist-workspace@v1 with: action: retrieve - - name: Run GasCompare + - name: Run tests 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 + - name: Store artifacts + uses: actions/upload-artifact@v2 with: - action: persist - - - name: Checkout - uses: actions/checkout@v3 + 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 GasCompare + - name: Run scenarios run: | - ls -la - npm run gasCompare /tmp/gasReporterOutput_Current.json /tmp/gasReporterOutput_Master.json + 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 - - \ No newline at end of file + 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