From daada0760d54cacaa0684f5d4557326583225d8d Mon Sep 17 00:00:00 2001 From: Achmad Hadi Kurnia Date: Thu, 4 Jul 2024 20:50:41 +0700 Subject: [PATCH] test(action): update run-tests.yml --- .github/workflows/run-tests.yml | 85 ++++++++++++++++++++++++--------- 1 file changed, 62 insertions(+), 23 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 7d24c2e..27decce 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -57,29 +57,68 @@ jobs: - name: Copy phpunit.xml.dist to phpunit.xml run: cp phpunit.xml.dist phpunit.xml - - name: Add secrets to phpunit.xml - run: | - if [[ "$RUNNER_OS" == "Windows" ]]; then - sed `-i 's/{{SIASN_MODE}}/${{ secrets.SIASN_MODE }}/g' phpunit.xml - sed -i 's/{{SIASN_APIM_USERNAME}}/${{ secrets.SIASN_APIM_USERNAME }}/g' phpunit.xml - sed -i 's/{{SIASN_APIM_PASSWORD}}/${{ secrets.SIASN_APIM_PASSWORD }}/g' phpunit.xml - sed -i 's/{{SIASN_SSO_CLIENT_ID}}/${{ secrets.SIASN_SSO_CLIENT_ID }}/g' phpunit.xml - sed -i 's/{{SIASN_SSO_USERNAME}}/${{ secrets.SIASN_SSO_USERNAME }}/g' phpunit.xml - sed -i 's/{{SIASN_SSO_PASSWORD}}/${{ secrets.SIASN_SSO_PASSWORD }}/g' phpunit.xml - sed -i 's/{{SIASN_CONST_INSTANSI_ID}}/${{ secrets.SIASN_CONST_INSTANSI_ID }}/g' phpunit.xml - sed -i 's/{{SIASN_CONST_SATUAN_KERJA_ID}}/${{ secrets.SIASN_CONST_SATUAN_KERJA_ID }}/g' phpunit.xml - sed -i '`s/{{SIASN_CONST_PNS_ORANG_ID}}/${{ secrets.SIASN_CONST_PNS_ORANG_ID }}/g' phpunit.xml - else - sed -i 's@{{SIASN_MODE}}@${{ secrets.SIASN_MODE }}@g' phpunit.xml - sed -i 's@{{SIASN_APIM_USERNAME}}@${{ secrets.SIASN_APIM_USERNAME }}@g' phpunit.xml - sed -i 's@{{SIASN_APIM_PASSWORD}}@${{ secrets.SIASN_APIM_PASSWORD }}@g' phpunit.xml - sed -i 's@{{SIASN_SSO_CLIENT_ID}}@${{ secrets.SIASN_SSO_CLIENT_ID }}@g' phpunit.xml - sed -i 's@{{SIASN_SSO_USERNAME}}@${{ secrets.SIASN_SSO_USERNAME }}@g' phpunit.xml - sed -i 's@{{SIASN_SSO_PASSWORD}}@${{ secrets.SIASN_SSO_PASSWORD }}@g' phpunit.xml - sed -i 's@{{SIASN_CONST_INSTANSI_ID}}@${{ secrets.SIASN_CONST_INSTANSI_ID }}@g' phpunit.xml - sed -i 's@{{SIASN_CONST_SATUAN_KERJA_ID}}@${{ secrets.SIASN_CONST_SATUAN_KERJA_ID }}@g' phpunit.xml - sed -i 's@{{SIASN_CONST_PNS_ORANG_ID}}@${{ secrets.SIASN_CONST_PNS_ORANG_ID }}@g' phpunit.xml - fi + - name: Replace SIASN_MODE in phpunit.xml + uses: jacobtomlinson/gha-find-replace@v3 + with: + files: 'phpunit.xml' + find: '{{SIASN_MODE}}' + replace: ${{ secrets.SIASN_MODE }} + + - name: Replace SIASN_APIM_USERNAME in phpunit.xml + uses: jacobtomlinson/gha-find-replace@v3 + with: + files: 'phpunit.xml' + find: '{{SIASN_APIM_USERNAME}}' + replace: ${{ secrets.SIASN_APIM_USERNAME }} + + - name: Replace SIASN_APIM_PASSWORD in phpunit.xml + uses: jacobtomlinson/gha-find-replace@v3 + with: + files: 'phpunit.xml' + find: '{{SIASN_APIM_PASSWORD}}' + replace: ${{ secrets.SIASN_APIM_PASSWORD }} + + - name: Replace SIASN_SSO_CLIENT_ID in phpunit.xml + uses: jacobtomlinson/gha-find-replace@v3 + with: + files: 'phpunit.xml' + find: '{{SIASN_SSO_CLIENT_ID}}' + replace: ${{ secrets.SIASN_SSO_CLIENT_ID }} + + - name: Replace SIASN_SSO_USERNAME in phpunit.xml + uses: jacobtomlinson/gha-find-replace@v3 + with: + files: 'phpunit.xml' + find: '{{SIASN_SSO_USERNAME}}' + replace: ${{ secrets.SIASN_SSO_USERNAME }} + + - name: Replace SIASN_SSO_PASSWORD in phpunit.xml + uses: jacobtomlinson/gha-find-replace@v3 + with: + files: 'phpunit.xml' + find: '{{SIASN_SSO_PASSWORD}}' + replace: ${{ secrets.SIASN_SSO_PASSWORD }} + + - name: Replace SIASN_CONST_INSTANSI_ID in phpunit.xml + uses: jacobtomlinson/gha-find-replace@v3 + with: + files: 'phpunit.xml' + find: '{{SIASN_CONST_INSTANSI_ID}}' + replace: ${{ secrets.SIASN_CONST_INSTANSI_ID }} + + - name: Replace SIASN_CONST_SATUAN_KERJA_ID in phpunit.xml + uses: jacobtomlinson/gha-find-replace@v3 + with: + files: 'phpunit.xml' + find: '{{SIASN_CONST_SATUAN_KERJA_ID}}' + replace: ${{ secrets.SIASN_CONST_SATUAN_KERJA_ID }} + + - name: Replace SIASN_CONST_PNS_ORANG_ID in phpunit.xml + uses: jacobtomlinson/gha-find-replace@v3 + with: + files: 'phpunit.xml' + find: '{{SIASN_CONST_PNS_ORANG_ID}}' + replace: ${{ secrets.SIASN_CONST_PNS_ORANG_ID }} - name: Execute tests run: vendor/bin/pest --ci