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

Constrain CI triggers #266

Merged
merged 4 commits into from
Apr 9, 2023
Merged

Constrain CI triggers #266

merged 4 commits into from
Apr 9, 2023

Conversation

0xPhaze
Copy link
Contributor

@0xPhaze 0xPhaze commented Mar 28, 2023

Some action triggers can be further restricted. Re #214

@0xPhaze 0xPhaze requested a review from montyly as a code owner March 28, 2023 17:54
Copy link
Member

@elopez elopez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some notes inline 👍 Maybe instead of duplicating the manticore workflow, we could convert it into a reusable workflow: https://docs.github.com/en/actions/using-workflows/reusing-workflows

- "**.rs"
- "**.py"
paths:
- "program-analysis/echidna/**/*.sol"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add the echidna yaml configs, and the workflow yaml file itself?

@@ -3,6 +3,8 @@ on:
push:
branches:
- master
paths:
- "**.md"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also include things like images, css and other static/ resources

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking was that if a new static resource is added, it must be referenced somewhere in the .md, right? Otherwise it's just part of the github repo.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the resources could be edited on their own (e.g modify a diagram, or update the CSS)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah I see, I was somehow expecting them to be directly linked to the github-hosted resources. Maybe then it's easier to only exclude code files (if #264 is merged). Otherwise, I'll just keep it unrestricted for now...

Comment on lines 33 to 34
env:
TEST_TYPE: ${{ matrix.type }}
TEST_TYPE: slither
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This env variable is now unused, so it can be dropped

Comment on lines 33 to 34
env:
TEST_TYPE: manticore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This env variable is unused, so it can be dropped

@0xPhaze
Copy link
Contributor Author

0xPhaze commented Mar 29, 2023

I left some notes inline 👍 Maybe instead of duplicating the manticore workflow, we could convert it into a reusable workflow: https://docs.github.com/en/actions/using-workflows/reusing-workflows

I'm not so familiar with workflows yet. If we want to keep them in one file like before, do you mind showing me how?

@elopez
Copy link
Member

elopez commented Mar 29, 2023

I'm not so familiar with workflows yet. If we want to keep them in one file like before, do you mind showing me how?

With reusable workflows you'd still need separate files, but at least the steps would not be duplicated. It may not be worth the effort though, these workflows are rather small. Untested sample below, refer to the docs if you want to try it and it doesn't work 😅

manticore.yml (similar for slither.yml)

name: Run Manticore tests

on:
  push:
    paths:
      - ".github/workflows/manticore.yml"
      - "program-analysis/manticore/**/*.py"
    branches:
      - master
  pull_request:
    paths:
      - ".github/workflows/manticore.yml"
      - "program-analysis/manticore/**/*.py"
  schedule:
    # run CI every day even if no PRs/merges occur
    - cron: "0 12 * * *"

jobs:
  tests:
    uses: ./.github/workflows/python-test.yml
    with:
      tool: manticore
    secrets: inherit

python-test.yml

on:
  workflow_call:
    inputs:
      tool:
        required: true
        type: string

jobs:
  tests:
    runs-on: ubuntu-22.04
    strategy:
      fail-fast: false
    steps:
      - uses: actions/checkout@v3
      - name: Set up Python 3.8
        uses: actions/setup-python@v4
        with:
          python-version: 3.8
      - name: Install dependencies
        run: |
          pip install solc-select
          solc-select install 0.5.11
          solc-select use 0.5.11
      - name: Run Tests
        run: |
          bash program-analysis/${{ inputs.tool }}/scripts/gh_action_test.sh

@0xPhaze
Copy link
Contributor Author

0xPhaze commented Mar 30, 2023

I guess I'll leave it as is for now. We might want to change it when we get more CI workflows in the future.

@montyly montyly added this pull request to the merge queue Apr 9, 2023
Merged via the queue into master with commit 480ea3a Apr 9, 2023
@montyly montyly deleted the constrain-ci-triggers branch April 9, 2023 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants