From ef65993412e8eb924838018a0b61d627579cf687 Mon Sep 17 00:00:00 2001 From: Abdul Rabbani Date: Mon, 18 Apr 2022 17:01:34 -0400 Subject: [PATCH] Update on-pr.yaml --- .github/workflows/on-pr.yaml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/on-pr.yaml b/.github/workflows/on-pr.yaml index bd4d5e08..6c92e97f 100644 --- a/.github/workflows/on-pr.yaml +++ b/.github/workflows/on-pr.yaml @@ -25,14 +25,11 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Install sshpass - run: sudo apt-get install -y sshpass - # Passed experience with GHA has taught me to store variables in files instead of passing them as variables. - name: Output variables run: | - echo ${{ env.GITHUB_REPOSITORY}} > /tmp/git_repository - echo ${{ env.GITHUB_HEAD_REF}} > /tmp/git_head_ref + echo ${{ env.GITHUB_REPOSITORY }} > /tmp/git_repository + echo ${{ env.GITHUB_HEAD_REF }} > /tmp/git_head_ref # echo ${{ env.BUILD_KEY }} | tr '\n' ''| sshpass -p ${{ env.BUILD_PASSWORD }} scp -i /dev/stdin /tmp/git_repository {{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/git_repository # echo ${{ env.BUILD_KEY }} | tr '\n' ''| sshpass -p ${{ env.BUILD_PASSWORD }} scp -i /dev/stdin /tmp/git_head_ref {{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/git_head_ref # echo ${{ env.BUILD_KEY }} | tr '\n' ''| sshpass -p ${{ env.BUILD_PASSWORD }} scp -i /dev/stdin ./github/workflows/run_unit_test.sh {{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/run_unit_test.sh @@ -42,23 +39,28 @@ jobs: with: host: ${{ env.BUILD_HOSTNAME }} username: ${{ env.BUILD_USERNAME }} - passphrase: $ {{ env.BUILD_PASSWORD }} key: ${{ env.BUILD_KEY }} port: 22 source: "/tmp/git_repository,/tmp/git_head_ref,./github/workflows/run_unit_test.sh" target: "/tmp/" - name: Trigger Unit Test - run: echo ${{ env.BUILD_KEY }} | sshpass -p ${{ env.BUILD_PASSWORD }} ssh {{ env.BUILD_USERNAME }}@{{ env.BUILD_HOSTNAME }} -i /dev/stdin /tmp/run_unit_test.sh + uses: appleboy/ssh-action@master + with: + host: ${{ env.BUILD_HOSTNAME }} + username: ${{ env.BUILD_USERNAME }} + key: ${{ env.BUILD_KEY }} + port: 22 + script: /tmp/run_unit_test.sh - name: Get the logs and cat them run: | - echo ${{ env.BUILD_KEY }} | sshpass -p ${{ env.BUILD_PASSWORD }} scp -i /dev/stdin {{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/test.log . + echo ${{ env.BUILD_KEY }} | scp -i /dev/stdin {{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/test.log . cat ./test.log - name: Check Error Code run: | - echo ${{ env.BUILD_KEY }} | sshpass -p ${{ env.BUILD_PASSWORD }} scp -i /dev/stdin {{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/return_test.txt . + echo ${{ env.BUILD_KEY }} | scp -i /dev/stdin {{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/return_test.txt . [ $(cat ./return_test.txt) -eq 0 ] integrationtest: