adding health check to staging deployment #47
This file contains 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
name: Deploy ADL LRS Application (Python) | |
on: | |
push: | |
branches: | |
- master | |
- adding-nodejs-tests | |
jobs: | |
deploy-staging: | |
runs-on: ubuntu-latest | |
environment: staging | |
steps: | |
- name: Configure SSH | |
run: | | |
echo "Configuring SSH to reach staging instance." | |
mkdir -p ~/.ssh | |
echo "${{ secrets.ADLNET_STAGING_SSH_KEY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan "${{ secrets.ADLNET_STAGING_HOST }}" >> ~/.ssh/known_hosts | |
- name: Deploy code on Staging | |
run: | | |
echo "SSH into staging machine." | |
ssh ${{ secrets.ADLNET_STAGING_HOST_USER }}@${{ secrets.ADLNET_STAGING_HOST }} " | |
cd ${{ secrets.ADLNET_STAGING_PROJECT_DIR }} | |
echo 'Pulling Latest Code from Repository...' | |
git pull | |
echo 'Rebuilding Docker Containers..' | |
sudo docker-compose stop | |
sudo docker-compose build --no-cache | |
sudo docker-compose up -d | |
echo 'deployed successfully on server' " | |
- name: Check the deployed service URL | |
uses: jtalk/url-health-check-action@v4 | |
with: | |
url: ${{ secrets.ADLNET_STAGING_HOST }} | |
max-attempts: 10 | |
retry-delay: 10s | |
cypress-testing: | |
name: Cypress run | |
environment: staging | |
needs: | |
- deploy-staging | |
runs-on: ubuntu-22.04 | |
env: | |
LRS_USERNAME: ${{ secrets.ADLNET_STAGING_LRS_USERNAME }} | |
LRS_PASSWORD: ${{ secrets.ADLNET_STAGING_LRS_PASSWORD }} | |
LRS_HOST_URL: ${{ secrets.ADLNET_STAGING_LRS_HOST_URL }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Cypress run | |
uses: cypress-io/github-action@v6 | |
with: | |
working-directory: ./tests/cypress | |
conformance-testing: | |
runs-on: ubuntu-latest | |
environment: staging | |
needs: | |
- deploy-staging | |
steps: | |
- name: Setup NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Clone the CTS Repo | |
uses: GuillaumeFalourd/clone-github-repo-action@main | |
with: | |
owner: adlnet | |
repository: lrs-conformance-test-suite | |
depth: 1 | |
branch: master | |
- name: Run LRS Conformance Suite | |
run: | | |
cd lrs-conformance-test-suite | |
npm install | |
node ./bin/console_runner.js --basicAuth --authUser ${{ secrets.ADLNET_STAGING_LRS_USERNAME }} --authPassword ${{ secrets.ADLNET_STAGING_LRS_PASSWORD }} --endpoint ${{ secrets.ADLNET_STAGING_LRS_ENDPOINT }} |