src-d / hercules

Gaining advanced insights from Git repository history.
Other
2.63k stars 334 forks source link

Easy docker way to make it work within a git repo #398

Open chneau opened 2 months ago

chneau commented 2 months ago

I couldn't install labours but made it work with this docker command:

docker run --rm -v "$PWD":"$PWD" -w "$PWD" -u 1000 srcd/hercules hercules --burndown --pb . | docker run --rm -i -v "$PWD":"$PWD" -w "$PWD" -u 1000 srcd/hercules labours -f pb -m burndown-project --resample month -o git.png

it will create a ./git/project.png file. Hope that helps save some time to people, I couldn't make the normal install to work but that command does exactly what I wanted.

RicardoHS commented 1 month ago

Thank you very much. It works!

EgoPingvina commented 3 weeks ago

It doesn't work for me. Could you please help, @chneau

My main.yml:

name: Run Hercules Analysis

on:
  push:
    branches:
      - master
jobs:
  run-hercules:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout code
      uses: actions/checkout@v2

    - name: Run Hercules
      run: |
        docker run --rm -v "$PWD":"$PWD" -w "$PWD" -u 1000 srcd/hercules hercules --burndown --pb . | docker run --rm -i -v "$PWD":"$PWD" -w "$PWD" -u 1000 srcd/hercules labours -f pb -m burndown-project --resample month -o git.png
    - name: Upload Artifacts
      uses: actions/upload-artifact@v3
      with:
        name: hercules-output
        path: git.png

An error:

latest: Pulling from srcd/hercules
171[8](https://github.com/EgoPingvina/TravianFarmBot/actions/runs/11599670059/job/32298317693#step:3:8)57c49d0f: Pulling fs layer
419640447d26: Pulling fs layer
61e52f86261[9](https://github.com/EgoPingvina/TravianFarmBot/actions/runs/11599670059/job/32298317693#step:3:9): Pulling fs layer
0bd94767c998: Pulling fs layer
99452a2b707c: Pulling fs layer
38371b41a3c4: Pulling fs layer
0bd94767c998: Waiting
99452a2b707c: Waiting
38371b41a3c4: Waiting
99452a2b707c: 99452a2b707c: Verifying Checksum
Verifying Checksum
99452a2b707c: Download complete
99452a2b707c: Download complete
171857c49d0f: Verifying Checksum
171857c49d0f: Download complete
171857c49d0f: Verifying Checksum
171857c49d0f: Download complete
0bd94767c998: 0bd94767c998: Verifying Checksum
Verifying Checksum
0bd94767c998: Download complete
0bd94767c998: Download complete
171857c49d0f: Pull complete
171857c49d0f: Pull complete
419640447d26: Pull complete
419640447d26: Pull complete
61e52f862619: Pull complete
61e52f862619: Pull complete
0bd94767c998: Pull complete
0bd94767c998: Pull complete
99452a2b707c: Pull complete
99452a2b707c: Pull complete
38371b41a3c4: 38371b41a3c4: Download complete
Download complete
38371b41a3c4: Pull complete
38371b41a3c4: Pull complete
Digest: sha256:f1bb45e6be3f35dedf14dbe7ceaa6d719067570951ede6c301bead96586cde9c
Status: Downloaded newer image for srcd/hercules:latest
Digest: sha256:f1bb45e6be3f35dedf14dbe7ceaa6d719067570951ede6c301bead96586cde9c
Status: Image is up to date for srcd/hercules:latest
git log...
2024/[10](https://github.com/EgoPingvina/TravianFarmBot/actions/runs/11599670059/job/32298317693#step:3:10)/30 18:44:59 failed to list the commits: object not found
Matplotlib created a temporary config/cache directory at /tmp/matplotlib-4mo5y30j because the default path (/.config/matplotlib) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing.
Traceback (most recent call last):
  File "/usr/local/bin/labours", line 33, in <module>
    sys.exit(load_entry_point('labours==10.7.2', 'console_scripts', 'labours')())
  File "/usr/local/lib/python3.6/dist-packages/labours/cli.py", line [15](https://github.com/EgoPingvina/TravianFarmBot/actions/runs/11599670059/job/32298317693#step:3:15)4, in main
    reader = read_input(args)
  File "/usr/local/lib/python3.6/dist-packages/labours/readers.py", line 439, in read_input
    reader.read(ins)
  File "/usr/local/lib/python3.6/dist-packages/labours/readers.py", line 230, in read
    raise ValueError("empty input")
ValueError: empty input
Reading the input... 
Error: Process completed with exit code 1.
chneau commented 3 weeks ago

Could you try the command directly through the command line without GitHub Action? I'm not sure of the specifics on GitHub Action but the first docker command seems to not output anything to the hercule docker command as per the error.

it works well for me on a linux machine on the bash command.

As well, your artifact output might be ./git/project.png