Skip to content

Commit

Permalink
test outputs in extra steps
Browse files Browse the repository at this point in the history
Signed-off-by: jparisu <[email protected]>
  • Loading branch information
jparisu committed May 11, 2023
1 parent f205d6e commit d8aeb96
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 9 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/pr_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,31 @@ jobs:
with:
workspace: ${{ github.workspace }}

- name: Test outputs
id: test1
shell: bash
run: |
echo "$GITHUB_OUTPUT"
cat $GITHUB_OUTPUT
echo "test1-output=false" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
- name: Test outputs reception
shell: bash
run: |
echo "$GITHUB_OUTPUT"
cat $GITHUB_OUTPUT
echo "${{ steps.test1.outputs.test1-output }}"
- name: Get diff file of version file
id: diff
uses: eProsima/eProsima-CI/ubuntu/git_diff@feature/versions-update
with:
file-path: ${{ github.workspace }}/${{ inputs.version-file-path }}


- name: Check if file change
shell: bash
run: |
Expand Down
74 changes: 71 additions & 3 deletions ubuntu/check_version_update/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,87 @@ runs:
with:
workspace: ${{ github.workspace }}

- name: Test outputs
shell: bash
id: test1
run: |
echo "::group::Test"
echo "$GITHUB_OUTPUT"
cat $GITHUB_OUTPUT
echo "test1-output=false" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
echo "::endgroup::"
- name: Test outputs reception
shell: bash
run: |
echo "$GITHUB_OUTPUT"
cat $GITHUB_OUTPUT
echo "${{ steps.test1.outputs.test1-output }}"
- name: Get diff file of version file
id: diff
id: diff2
uses: eProsima/eProsima-CI/ubuntu/git_diff@feature/versions-update
with:
file-path: ${{ github.workspace }}/${{ inputs.version-file-path }}
outputs:
have-changes: ${{ steps.diff2.outputs.have-changes }}

- name: get_git_diff_files
id: diff1
shell: bash
run: |
echo "::group::Get git modifications of file ${{ inputs.file-path }}"
echo "have-changes=false" >> $GITHUB_OUTPUT
echo "diff-file-result=" >> $GITHUB_OUTPUT
echo "::endgroup::"
- name: Check if file change
shell: bash
run: |
cat $GITHUB_OUTPUT
if [[ "${{ steps.git_diff.outputs.have-changes }}" != "true" ]]; then
echo "Version file ${{ inputs.version-file-path }} has not been updated"
echo "T.T"
else
echo "Version file ${{ inputs.version-file-path }} updated."
echo "HURRAY! ^.^"
fi
if [[ "${{ steps.diff3.outputs.have-changes }}" != "true" ]]; then
echo "Version file ${{ inputs.version-file-path }} has not been updated"
echo "T.T"
else
echo "Version file ${{ inputs.version-file-path }} updated."
echo "HURRAY! ^.^"
fi
if [[ "${{ steps.diff2.outputs.have-changes }}" != "true" ]]; then
echo "Version file ${{ inputs.version-file-path }} has not been updated"
echo "T.T"
else
echo "Version file ${{ inputs.version-file-path }} updated."
echo "HURRAY! ^.^"
fi
if [[ "${{ steps.diff2.outputs.have-change }}" != "true" ]]; then
echo "Version file ${{ inputs.version-file-path }} has not been updated"
echo "T.T"
else
echo "Version file ${{ inputs.version-file-path }} updated."
echo "HURRAY! ^.^"
fi
if [[ "${{ steps.diff.outputs.have-changes }}" != "true" ]]; then
if [[ "${{ steps.diff1.outputs.have-changes }}" != "true" ]]; then
echo "Version file ${{ inputs.version-file-path }} has not been updated"
echo "T.T"
exit 1
Expand Down
12 changes: 6 additions & 6 deletions ubuntu/git_diff/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,31 +40,31 @@ runs:
steps:

- name: get_git_diff_files
id: diff3
shell: bash
run: |
echo "::group::Get git modifications of file ${{ inputs.file-path }}"
git diff "${{ inputs.base-ref }}" "${{ inputs.head-ref }}" ${{ inputs.diff-args }} -- "${{ inputs.file-path }}" > "${{ inputs.result-file }}"
echo "Diff file result:"
cat "${{ inputs.result-file }}"
if [ -s "${{ inputs.result-file }}" ]; then
echo "::set-output name=have-changes::true"
echo "have-changes=true" >> $GITHUB_OUTPUT
echo "have-change=true" >> $GITHUB_OUTPUT
echo "File has changes"
else
echo "::set-output name=have-changes::false"
echo "have-changes=false" >> $GITHUB_OUTPUT
echo "have-change=false" >> $GITHUB_OUTPUT
echo "File has not changes"
fi
# echo "::set-output name=diff-file-result::$(cat "${{ inputs.result-file }}")"
# echo "diff-file-result=$(cat "${{ inputs.result-file }}")" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
echo "diff-file-result=$(cat "${{ inputs.result-file }}")" >> $GITHUB_OUTPUT
echo "::endgroup::"

0 comments on commit d8aeb96

Please sign in to comment.