CI Script - APIUtils - Slightly better handling if the response didn't have a JSON body. #116
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Workflow to build and test the APIUtils project | |
| name: CI Script - APIUtils | |
| run-name: ${{ format('{0} - {1}', github.workflow, github.event_name == 'push' && github.event.head_commit.message || 'Manual Run') }} | |
| on: | |
| workflow_dispatch: | |
| push: | |
| paths: | |
| - '.github/workflows/CI_APIUtils.yml' | |
| - '.github/workflows/BUILD_APIUtils.yml' | |
| - '.github/actions/**' | |
| - 'requirements.txt' | |
| - 'src/**' | |
| - 'tests/utils/**' | |
| env: | |
| DEPLOY_HOST: ${{ vars.OGD_STAGING_HOST }} | |
| DEPLOY_DIR: ${{ vars.API_BASE_PATH }}/${{ github.event.repository.name }}/${{ github.ref_name }} | |
| DEPLOY_URL: ${{ vars.OGD_STAGING_HOST }}/${{ vars.API_BASE_URL }}/${{ github.event.repository.name }}/${{ github.ref_name }}/app.wsgi | |
| jobs: | |
| build: | |
| name: Build Python Package | |
| uses: ./.github/workflows/BUILD_APIUtils.yml | |
| with: | |
| with_caching: false | |
| testbed_hello_local: | |
| name: HelloAPI Local Testbed | |
| needs: build | |
| uses: ./.github/workflows/TEST_HelloAPI_local.yml | |
| testbed_server_config: | |
| name: ServerConfig Testbed | |
| needs: build | |
| uses: ./.github/workflows/TEST_ServerConfig.yml | |
| testbed_api_response: | |
| name: APIResponse Testbed | |
| needs: build | |
| uses: ./.github/workflows/TEST_APIResponse.yml | |
| testbed_api_utils: | |
| name: APIUtils Testbed | |
| needs: build | |
| uses: ./.github/workflows/TEST_APIUtils.yml | |
| deploy_helloapi: | |
| name: Create a test deploy of HelloAPI for remote tests. | |
| needs: [testbed_hello_local, testbed_server_config, testbed_api_response, testbed_api_utils] | |
| runs-on: ubuntu-22.04 | |
| concurrency: | |
| group: ${{ github.repository }}-${{ github.ref }}-${{ github.workflow }}-deploy | |
| cancel-in-progress: true | |
| steps: | |
| # 1. Local checkout & config | |
| - uses: actions/checkout@v4 | |
| - name: Set Deploy Dir in app.wsgi | |
| run: sed -i 's@DEPLOY_DIR@${{ env.DEPLOY_DIR }}@g' ./tests/utils/app.wsgi | |
| shell: bash | |
| # 2. Build | |
| # 3. Remote config & deploy | |
| - name: Connect to VPN | |
| uses: opengamedata/actions-openconnect-vpn@v1.1 | |
| with: | |
| username: ${{ secrets.VPN_USER }} | |
| password: ${{ secrets.VPN_PASS }} | |
| endpoint: "soe.vpn.wisc.edu" | |
| - name: Deploy HelloAPI to Server | |
| uses: opengamedata/actions-deploy-project@v1.1 | |
| with: | |
| local_path: ./src/ogd/apis/ | |
| remote_path: ${{ env.DEPLOY_DIR }}/ogd/apis | |
| remote_host: ${{ env.DEPLOY_HOST }} | |
| remote_user: ${{ secrets.DEPLOY_USER }} | |
| remote_key: ${{ secrets.DEPLOY_KEY }} | |
| - name: Upload testing app.wsgi via rsync | |
| uses: Burnett01/rsync-deployments@7.0.1 | |
| with: | |
| switches: -vrct --delete --exclude-from 'rsync-exclude' --chmod=Du=rwx,Dg=rwx,Do=rx,Fu=rwx,Fg=rwx,Fo=r | |
| path: ./tests/utils/app.wsgi | |
| remote_path: ${{ env.DEPLOY_DIR }} | |
| remote_host: ${{ env.DEPLOY_HOST }} | |
| remote_user: ${{ secrets.DEPLOY_USER }} | |
| remote_key: ${{ secrets.DEPLOY_KEY }} | |
| # 4. Cleanup & complete | |
| - name: Restart httpd via ssh | |
| run: ssh -o StrictHostKeyChecking=no -T -i ./key.txt ${{ secrets.DEPLOY_USER }}@${{ env.DEPLOY_HOST }} "sudo systemctl restart apache2" | |
| - name: Announce deploy | |
| run: echo "Deployed to ${{ env.DEPLOY_URL }}" | |
| testbed_hello_remote: | |
| name: HelloAPI Remote Testbed | |
| needs: deploy_helloapi | |
| uses: ./.github/workflows/TEST_HelloAPI_remote.yml |