Experts,
Please help me with this, I just can’t get it to work… Thanks!
First step in workflow yml runs jUnit tests in docker container which generates report in /github/workspace/metrics.csv. I need to upload this report in next step. However it’s not able to read that file that was in docker container. Following is workflow.
jobs:
jmeter_job:
runs-on: ubuntu-latest
name: A job to run junit test
steps:
- name: Run java junit test step
uses: kamipatel/junitaction@v1
with:
name: result
path: /github/workspace/metrics.csv
- name: Archive code coverage results
uses: actions/upload-artifact@v1
with:
name: result
path: /github/workspace/
@kamipatel ,
Looks like your action kamipatel/junitaction@v1 is a Docker container action.
Here are some things you need to know:
-
When running a Docker container action, it will automatically mount volumes on the container and the hosted runner. If you view the logs of the step, you can find the logs like as below example:
/usr/bin/docker run … -v “/home/runner/work/TestClock/TestClock”:"/github/workspace" …
-
In my above example, the path “/home/runner/work/TestClock/TestClock” is the default workspace of the hsoted runner, and the path “/github/workspace” is the default workspace on the container. This will share files between these two paths, that means any change in one of the two paths will be synced to another one. For example, if create file “/github/workspace/metrics.csv”, it will be synced to “/home/runner/work/TestClock/TestClock/metrics.csv”.
-
By default, all the steps are executed in their default workspaces, if you want to create or access files in the workspace, you just need to provide the relative path instead of absolute path. In your example, it actually will create the CSV to the absolute path “/github/workspace/github/workspace/metrics.csv” instead of in the root like as “/github/workspace/metrics.csv”.
According to the above points, if you want to generate the CSV file in the root of the workspace, you can try update your workflow like as the following:
jobs:
jmeter_job:
runs-on: ubuntu-latest
name: A job to run junit test
steps:
- name: Run java junit test step
uses: kamipatel/junitaction@v1
with:
name: result
path: metrics.csv
- name: Archive code coverage results
uses: actions/upload-artifact@v1
with:
name: result
path: metrics.csv
Hope this can help you.
@kamipatel ,
As I mentioned in previous reply, you need to pay attention to the relative paths in the workspace, and the mount volumes between the container and the runner hosted machine.
Is my suggestion helpful to you? Have you tried it? Any progress, please feel free to tell us.