pitch-detection icon indicating copy to clipboard operation
pitch-detection copied to clipboard

Create a GitHub Action that builds and runs unit tests

Open sevagh opened this issue 1 year ago • 5 comments

sevagh avatar Dec 27 '23 16:12 sevagh

Hey @sevagh ,

I would love to take this up, If you can let me know the steps involved in the process of building and commands to run tests

prabhjotsingh18 avatar Dec 28 '23 09:12 prabhjotsingh18

You can do it pretty easily with the included Docker image.

  1. Use the standard checkout workflow of github actions (https://github.com/actions/checkout) to clone the code (make sure you use the appropriate options to enable git-lfs, since the test data files are stored with git-lfs: https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-git-large-file-storage
  2. You can probably use the free ubuntu-latest runner
  3. Run the docker build command, using a docker workflow or just a bash run command in GitHub Actions: docker build --rm --pull -f "Dockerfile" -t pitchdetection:latest "."
  4. Run the unit tests in the container: docker run --rm --init -it pitchdetection:latest /usr/src/pitch-detection/build/pitch_tests
  5. Run the benchmark in the container: docker run --rm --init -it pitchdetection:latest /usr/src/pitch-detection/build/pitch_bench

We can also possibly look at GHCR.io/github's container registry to store the pitch_detection docker container as a release artifact: https://docs.github.com/en/actions/publishing-packages/publishing-docker-images

sevagh avatar Dec 31 '23 17:12 sevagh

Feel free to explore at your pace, and ping me when you have any questions. There is no urgency on this issue.

sevagh avatar Dec 31 '23 17:12 sevagh

Hey sevagh,

Thanks for the detailed steps.

While running unit test im getting error code of 139

Run docker run --rm --init -t pitchdetection:latest /usr/src/pitch-detection/build/pitch_tests
Running main() from ./googletest/src/gtest_main.cc
[==========] Running 228 tests from 22 test suites.
[----------] Global test environment set-up.
[----------] 2 tests from MpmSinewaveTestManualAllocFloat
[ RUN      ] MpmSinewaveTestManualAllocFloat.OneAllocMultipleFreqFromFile
Error: Process completed with exit code 13[9](https://github.com/prabhjotsingh18/pitch-detection/actions/runs/7462132679/job/20303759912#step:5:10).

is this expected ?

I also tried the same locally I'm still getting the same error code when running it on my local machine.

prabhjotsingh18 avatar Jan 09 '24 14:01 prabhjotsingh18

Did you make sure to enable git-lfs?

Use the standard checkout workflow of github actions (https://github.com/actions/checkout) to clone the code (make sure you use the appropriate options to enable git-lfs, since the test data files are stored with git-lfs: https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-git-large-file-storage

If you run git lfs ls-files, what happens?

(system) sevagh@pop-os:~/repos/pitch-detection$ git lfs ls-files
5f6ff87b4d * misc/degraded_audio_tests/Viola-deg0.wav
f2ded53416 * misc/degraded_audio_tests/Viola-deg1.wav
c687598952 * misc/degraded_audio_tests/Viola-deg2.wav
0c125d1b40 * misc/degraded_audio_tests/Viola-deg3.wav
85382ee6f4 * misc/degraded_audio_tests/Viola-deg4.wav
96da9d1b2c * misc/degraded_audio_tests/Viola-deg5.wav
700846a8db * misc/degraded_audio_tests/Viola.arco.ff.sulC.E3.stereo.aiff
ada1f0cae6 * misc/degraded_audio_tests/restaurant08.wav
6839a50862 * misc/deps.png
fd6ebe74a3 * misc/mcleod/.github/degraded_e3_nsdf.png
2dc888c12b * misc/mcleod/.github/open_e_autocorrelation.png
...

The test data is stored with git-lfs (git large-file storage), which needs an extra step to clone.

Are there any more messages printed by the failing test?

sevagh avatar Jan 09 '24 14:01 sevagh