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

Automatically triggers test action and waits for test results before merged #71

Merged
merged 6 commits into from Jun 24, 2022

Conversation

shenxianpeng
Copy link
Collaborator

@shenxianpeng shenxianpeng commented Jun 23, 2022

Since we can not pass branch variables like cpp-linter/cpp-linter-action@${{ branch_name }} in the test action YAML file, the laziest way is to wait for the PR to be merged into the master branch and test it. (hope we could have another better way for testing before merging in the future)

Instead of manully running the test actions, I'm creating this action to automatically trigger test repo actions and wait for the result when PR is merged.

Instead of finding a more official way to do this, I found this action called convictional/trigger-workflow-and-wait

@shenxianpeng shenxianpeng added the enhancement New feature or request label Jun 23, 2022
@shenxianpeng shenxianpeng requested a review from 2bndy5 June 23, 2022 07:53
@shenxianpeng shenxianpeng changed the title Automaticlly trigger test action and wait for test result when PR merged Automatically triggers test action and waits for test results after PR merged Jun 23, 2022
@2bndy5
Copy link
Collaborator

2bndy5 commented Jun 23, 2022

Seems like a complex solution. Typically, I would

  1. create a test branch
  2. modify the either/both workflow(s) to use the specific branch of cpp-linter-action repo
  3. trigger the workflow. Lately, I've had to do this manually because the push triggers were removed at some point (which just adds more work).

My only objection to this is when we need to test a PR event. I think using this approach would entail

  1. merging a test branch to master
  2. opening another branch to PR master into the new branch
  3. when done testing, reset master to previous commit (prior to merging test branch into master)

Am I understanding this correctly?

@2bndy5
Copy link
Collaborator

2bndy5 commented Jun 23, 2022

I wish we could use reusable workflows, but we still have the non-dynamic uses problem, and we can't call a reusable workflow from a workflow that uses a matrix.

@shenxianpeng
Copy link
Collaborator Author

I totally agree with your workflow, that's the right one, the only problem is it involves manual work.

This PR is not good, its approach is to check merged code and revert if any test failed 😢

Copy link
Collaborator

@2bndy5 2bndy5 left a comment

Choose a reason for hiding this comment

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

I personally won't use it, but I don't think it would hurt to have it (even if only to try it out). You made me curious... 🤓

@shenxianpeng shenxianpeng marked this pull request as draft June 23, 2022 10:28
@shenxianpeng
Copy link
Collaborator Author

Convert to draft in case there is other good options.

@shenxianpeng
Copy link
Collaborator Author

I have an idea that I can add a tag for each latest commit, for example, tag lastest.

Then change the uses from cpp-linter/cpp-linter-action@master to cpp-linter/cpp-linter-action@latest

shenxianpeng and others added 2 commits June 24, 2022 11:24
@shenxianpeng shenxianpeng marked this pull request as ready for review June 24, 2022 06:31
@shenxianpeng shenxianpeng changed the title Automatically triggers test action and waits for test results after PR merged Automatically triggers test action and waits for test results before merged Jun 24, 2022
@shenxianpeng shenxianpeng merged commit e4cf6e4 into master Jun 24, 2022
@shenxianpeng shenxianpeng deleted the trigger-test-action branch June 24, 2022 06:34
@2bndy5
Copy link
Collaborator

2bndy5 commented Jun 24, 2022

I didn't realize this was the action repo. I thought this was the test repo.

@shenxianpeng
Copy link
Collaborator Author

shenxianpeng commented Jun 24, 2022

Oh, so you felt curious yesterday

@2bndy5
Copy link
Collaborator

2bndy5 commented Jun 24, 2022

I'm still curious.

Sorry, I'm rather distracted. I'm writing a C/C++ source code parser using clang to automate beautiful documentation in Sphinx. Doxygen SUCKS, and breathe (extension for Sphinx) is limited to Doxygen's XML output (which is worse than Doxyen's HTML output).

@shenxianpeng
Copy link
Collaborator Author

For this PR, I just want to test any PRs using the test actions in the test repo without any manual work. Bypass passing variables to uses, I used a fixed tag latest to achive, a little complex solution.

I'm not familly with Sphinx, it looks like a beautiful document tool and polular. plooking forward to use it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants