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

#308 put CaM sources into zip archive #366

Merged
merged 5 commits into from
Sep 26, 2024
Merged

Conversation

Raleksan
Copy link
Contributor

Work under #308: Adding CaM sources to a zip archive.

Some notes:

  • The path to clone the repo is ${TARGET}/github/self/${name} to use a common command for all repos, removing the .git directories.
  • A user may be using an out-of-date version of CaM, in which case they will keep an archive with a CaM repo of a newer version.

@yegor256
Copy link
Owner

@Raleksan what about a unit test for this new feature? Simply put, how do you know that it works?

@Raleksan
Copy link
Contributor Author

Raleksan commented Sep 21, 2024

I think adding a test for this feature is achievable for me.

As I understand, the tests for the scripts in the /steps directory are located in /test/steps and to add a new test I need to edit test/steps/test-zip.sh.

Am I getting this right?

p.s. Do I always need to ping you with @*? Or will you get the notification anyway?

@yegor256
Copy link
Owner

@Raleksan you are right, the tests are in the test/steps/test-zip.sh. Also, read this please: https://www.yegor256.com/2024/04/01/ping-me-please.html

@Raleksan
Copy link
Contributor Author

@yegor256 I added a new test, you can review it.

cam_repo_target_dir="${TARGET}/github/self/${name}"

if [ ! -d "${cam_repo_target_dir}" ]; then
git clone --depth 1 https://github.com/yegor256/cam.git "${cam_repo_target_dir}"
Copy link
Owner

Choose a reason for hiding this comment

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

@Raleksan I believe, it is reasonable to delete the "${cam_repo_target_dir}/.git" directory after the clone

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yegor256 I know that I need to delete .git, therefore I locate it at ${TARGET}/github/self/${name} to delete .git directory with all others git directories, using already existing command, or it is better to do it separately and explicitly?

Copy link
Owner

Choose a reason for hiding this comment

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

@Raleksan this location is wrong, I believe. Let's put it into ${TARGET}/cam-sources instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yegor256 I changed the location as you remarked and improved the test.

Can you please review it again?

@yegor256
Copy link
Owner

@Raleksan not all tests pass after your changes. Try to run make test locally.

@Raleksan
Copy link
Contributor Author

@yegor256

I have analyzed the pipeline run errors and found that both failures depend on the same test test-integration.sh.

I checked out test-integration.sh and here is my interpretation, could you please clarify?

The actions of test-integration.sh:

  • Initially it uses https://github.com/yegor256/tojos as a single repo to collect metrics (lines 29-44).
  • After analysis, it checks that all artifacts (hashes, reports, etc) exist (lines 45-48)
  • Checks the number of entities contained in the TARGET directory [this step raises an error] (line 49)
  • Checks if certain files exist (lines 50-66)

I'm interested in line 49:

test ‘$(find “${TARGET}” -maxdepth 1 | wc -l | xargs)’ = 10.

It's unclear to me from where we inherit this ‘magic number’.

For this PR, I added 1 entity to TARGET which is CaM sources, which I think is causing the error in this test.

p.s. These are just my thoughts without running tests because I faced a bug while building a Docker container locally, I'm going to investigate and try to fix this problem or open an issue if if it's a real bug

@yegor256
Copy link
Owner

@Raleksan here, 10 is the number of highest-level elements we expect to have in the array. It's indeed a magic number. I believe, you should just change it to 11 and the test will pass.

@Raleksan
Copy link
Contributor Author

@yegor256 I corrected this value, can you run CI to test it? I'm still having problems with the local build of the Docker image.

@yegor256
Copy link
Owner

@Raleksan if you have problem with Docker, please report an issue, we will try to resolve it

@yegor256 yegor256 merged commit 8209166 into yegor256:master Sep 26, 2024
12 checks passed
@yegor256
Copy link
Owner

@Raleksan thanks!

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