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

test - add bash script tests to CI #54

Merged
merged 1 commit into from
Mar 31, 2022

Conversation

jbedard
Copy link
Collaborator

@jbedard jbedard commented Mar 30, 2022

No description provided.

@kormide
Copy link
Collaborator

kormide commented Mar 30, 2022

What do you think about putting this in an e2e folder?

@kormide
Copy link
Collaborator

kormide commented Mar 30, 2022

I find the .spec.sh extension a little awkward---makes me think it's a unit test.

@jbedard
Copy link
Collaborator Author

jbedard commented Mar 30, 2022

What do you think about putting this in an e2e folder?

I guess that's a better description? 🤷

I find the .spec.sh extension a little awkward---makes me think it's a unit test.

I'm open to whatever. Could be a subfolder that contains all the tests, or test.sh can be put in the root etc.

@kormide
Copy link
Collaborator

kormide commented Mar 30, 2022

What do you think about putting this in an e2e folder?

I guess that's a better description? 🤷

I find the .spec.sh extension a little awkward---makes me think it's a unit test.

I'm open to whatever. Could be a subfolder that contains all the tests, or test.sh can be put in the root etc.

Personally prefer separating the e2e tests and putting them in one folder 🤷

.github/workflows/ci.yaml Outdated Show resolved Hide resolved
Comment on lines 1 to 6
#!/bin/bash

set -e

bazel run //lib/tests/write_source_files:write_dist
exit 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why _gitignored in the filename?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That test is for writing files to a file that is gitignored and not controlled by bazel. The exit was me playing around making sure CI fails correctly

@jbedard jbedard force-pushed the shell-tests branch 4 times, most recently from fcb4afd to 7da1249 Compare March 30, 2022 23:41
@jbedard
Copy link
Collaborator Author

jbedard commented Mar 30, 2022

Updated... the find command has been inlined into the CI file. It's a bit ugly but now we don't have to decide where to put a test.sh file. That command now executes a beautiful ---------------- testname.sh ------------- so you can actually understand the stdout and separation between the tests, it will fail and stop if any test fails.

Determining which files are executable seems to be a pita and differs per platform (mac is different then our ubuntu ci) so I'm doing *.sh instead of find-ing executable files (see https://stackoverflow.com/questions/4458120/search-for-executable-files-using-find-command). I dropped the *.spec pattern and just any shell scripts are assumed to be e2e tests.

Copy link
Collaborator

@kormide kormide left a comment

Choose a reason for hiding this comment

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

LGTM

@jbedard
Copy link
Collaborator Author

jbedard commented Mar 31, 2022

You can see an example with 2 tests running in the other PR: https://github.com/aspect-build/bazel-lib/runs/5763137160

@jbedard jbedard merged commit d21acfb into bazel-contrib:main Mar 31, 2022
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.

2 participants