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

Pre & Post commands #461

Merged
merged 10 commits into from
Sep 21, 2023
Merged

Pre & Post commands #461

merged 10 commits into from
Sep 21, 2023

Conversation

kareemmahlees
Copy link
Contributor

@kareemmahlees kareemmahlees commented Aug 29, 2023

closes #453

New Features

  • A new option pre_cmd is added to .air.toml
  • A new option post_cmd is added to .air.tom

New behavior

  • commands that are in pre_cmd will be executed one by one before each build
  • commands that are in post_cmd will be executed upon exiting (i.e. upon hitting ^C)

@kareemmahlees kareemmahlees marked this pull request as draft August 29, 2023 19:38
@kareemmahlees kareemmahlees changed the title WIP: Pre & Post commands Pre & Post commands Aug 30, 2023
@kareemmahlees kareemmahlees marked this pull request as ready for review August 30, 2023 11:11
@kareemmahlees
Copy link
Contributor Author

@xiantang could you review the changes made until now

@xiantang
Copy link
Collaborator

So, this time is it in support of the pre command?

@kareemmahlees
Copy link
Contributor Author

So, this time is it in support of the pre command?

Yes, will work on the post command shortly.

if err != nil {
t.Fatalf("Should not be fail: %s.", err)
}
err = engine.runPreCmd()
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should use a real command for integration testing, such as writing a file to the test folder and then checking if the file exists after execution is complete

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think the current unit tests can test anything

air_example.toml Outdated
@@ -6,6 +6,8 @@ root = "."
tmp_dir = "tmp"

[build]
# Array of commands to run before each build
pre_cmd = ["echo Hello","echo Air"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Separate with spaces

@xiantang
Copy link
Collaborator

xiantang commented Sep 4, 2023

any update?

@kareemmahlees
Copy link
Contributor Author

Sorry for the delay, I updated the tests hoping that they do a little more this time, unfortunately, I can't ensure that the tests are passing because there is a problem with t.tempDir on Windows specifically 😢

@xiantang
Copy link
Collaborator

xiantang commented Sep 5, 2023

The latest version of GO that I remember has already been fixed. You can try updating your GO version

@kareemmahlees
Copy link
Contributor Author

I already have the latest version ( 1.21 ) installed, Sorry for being not so helpful but I can start working on post cmd if that's okay!

@xiantang
Copy link
Collaborator

xiantang commented Sep 5, 2023

Keep going

@kareemmahlees
Copy link
Contributor Author

sorry for the delay, been busy at work.
@xiantang could you check the latest changes?

@xiantang
Copy link
Collaborator

xiantang commented Sep 20, 2023 via email

air_example.toml Outdated Show resolved Hide resolved
@xiantang
Copy link
Collaborator

LGTM merged!

@xiantang xiantang merged commit c29522a into air-verse:master Sep 21, 2023
2 checks passed
@xiantang
Copy link
Collaborator

thank you!

@jackielii
Copy link

Hmm, I thought post_cmd would run each time after cmd is restarted... it's surprising to call it post_cmd, should've been before_exit

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.

Support Pre & Post build scripts
3 participants