Giter VIP home page Giter VIP logo

Comments (6)

czerus avatar czerus commented on August 30, 2024

@pajhiwo I would like to propose following change to Actions.

Current solution

  • we have 2 workflows: Pre Submit verification (run on commit to every branch except master) and Submit Verification (that should be run only on merge to master)
  • Both workflows are implemented using yml files
  • Workflows are almost identical. SV differs from PSV only by 2 steps: creating whl and archiving it. Remaining 70% of those files are the same
  • Currently github does not have easy way to factor out common part into some import (at least I didn't found it)

Proposed solution

  • single workflow that will run for commits on master and any other branch
  • Single implementation file
  • Additional parts in SV (whl and archiving) implemented using conditional steps that will run only on master:
...
    - name: Build wheel
      if: github.ref == 'refs/heads/master'
...

Pros:

  • easier to maitain
  • no duplication of the code
  • single place to check the results

Cons:

EDIT
There is new feature of actions called composite actions and it looks like it allows to reuse steps but firstly I would need to take a look on this deeper: https://docs.github.com/en/actions/creating-actions/creating-a-composite-run-steps-action

EDIT2: I believe composite actions mentioned above could be the way to go ("this is the way") if they support uses, but currently they do not. We are using following uses actions: To checkout the code(actions/checkout@v2) and to setup the cache (actions/cache@v2). Here is great explanation how to use it: https://dev.to/n3wt0n/github-composite-actions-nest-actions-within-actions-3e5l

@pajhiwo please share your thoughts.

from pydriverr.

pajhiwo avatar pajhiwo commented on August 30, 2024

This looks interesting and yes, this approach will decrease duplication of code, especially at this stage when there is such small difference between two workflows.

I do not have much DevOps exp. but i'm fan of separation. I think (my personal point of view) would be to have them separate - just in case we need to have them different in future.
But.....that composition seems like perfect solution, as we could create "common" steps and then just reuse them between SV and PSV workflows - so kind of achieving compromise in both:

  1. not having duplication of code
  2. have both workflows separate.

EDIT: actually i would change different thing. I have noticed that PSV is run on every commit, even when I do not intend to create PR, and i push just to store it on origin branch - and it uses those free runs. Maybe it would be possible not to run it on every save-commit, and only when creating PR - PSV i mean.

from pydriverr.

czerus avatar czerus commented on August 30, 2024

I didn't explain it properly. I also opt for separation but current actions implementations (by Github) allows only to move common part to some sharable part if it doesn't use uses in step. We have only following steps that does not use it: Linting, Test, Install dependencies, Setup python version. Also whole structure of psv or sv needs to be repeated in both workflows. I do not know if the gain is really big enough to justify keeping 2 workflows instead of 1 with conditions.

Regarding the free minutes. This project has 2000 free minutes per month. I believe currently we are not using even 20 minutes per month (thanks to cache mechanism). Also it is sometimes beneficial run the CI before raising PR to be sure everything is fine and sometimes it takes several iteration to make something properly.

from pydriverr.

pajhiwo avatar pajhiwo commented on August 30, 2024

ah. if that is the case, then cool. lets have one workflow file

from pydriverr.

czerus avatar czerus commented on August 30, 2024

as we have to improve the workflow and implement testing on windows I will handle here only original issue

from pydriverr.

czerus avatar czerus commented on August 30, 2024

@pajhiwo but maybe we could implement such explicit handling of skipping the CI run: https://stackoverflow.com/questions/59759921/how-to-skip-github-actions-job-on-push-event/59775665#59775665

EDIT: this is already implemented by default: https://github.blog/changelog/2021-02-08-github-actions-skip-pull-request-and-push-workflows-with-skip-ci/

from pydriverr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.