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

Change from dependencies to hooks #75

Closed
xmnlab opened this issue Dec 24, 2023 · 2 comments
Closed

Change from dependencies to hooks #75

xmnlab opened this issue Dec 24, 2023 · 2 comments
Labels
psf-grant-proposal Issues used for a PSF grant proposal size:large >16h

Comments

@xmnlab
Copy link
Member

xmnlab commented Dec 24, 2023

Currently we use the attribute dependencies to define dependencies among targets.

Although it works fine, but it is just a pre-run (setup) hook, and we would need to add support for post-run (teardown) hook as well.

Example:

version: 1.0
env-file: .env
groups:
  main:
    tasks:
      target1:
        help: target1
        run: echo "target 1"
      target2:
        help: target2
        run: echo "target 2"

  build:
    targets:
      clean:
        help: target clean
        hooks:
          pre-run: 
            - task: main.target1
          post-run:
            - task: main.target2
        run: echo "target clean"
@xmnlab xmnlab added psf-grant-proposal Issues used for a PSF grant proposal size:large >16h labels Feb 16, 2024
@xmnlab
Copy link
Member Author

xmnlab commented Sep 25, 2024

change in the .makim.yaml layout

current state:

...

  build:
    targets:
      clean:
        help: target clean
        dependencies:
          - task: main.target1
            if: ${{ 1 == 1 }}
        run: echo "target clean"
...

  build:
    targets:
      clean:
        help: target clean
        hooks:
          pre-run: 
            - task: main.target1
              if: ${{ 1 == 1 }}
        run: echo "target clean"

example with post-run

...

  build:
    tasks:
      clean:
        help: target clean
        hooks:
          pre-run: 
            - task: main.target1a
              if: ${{ 1 == 1 }}
            - task: main.target1b
              if: ${{ 1 == 1 }}
          post-run:
            - task: main.target2a
              if: ${{ 1 == 1 }}
            - task: main.target2b
              if: ${{ 1 == 1 }}
        run: echo "target clean"

so for this last example, when makim build.clean is executed, it runs the code in the following order:

  • (pre-run) main.target1a
  • (pre-run) main.target1b
  • run ("echo target clean")
  • (post-run) main.target2a
  • (post-run) main.target2b

@xmnlab
Copy link
Member Author

xmnlab commented Oct 7, 2024

done by @abhijeetSaroha #115
thank you

@xmnlab xmnlab closed this as completed Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
psf-grant-proposal Issues used for a PSF grant proposal size:large >16h
Projects
None yet
Development

No branches or pull requests

1 participant