Skip to content

SmokeTests

SmokeTests #26

Workflow file for this run

name: SmokeTests
on:
workflow_run:
workflows: [UnitTests]
types:
- completed
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
if: (github.event_name == 'workflow_dispatch') || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
runs-on: ubuntu-latest
steps:
- name: Download branch and run_id artifacts
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: unit-tests.yml
name: branch-info-${{ github.event_name == 'workflow_run' && github.event.workflow_run.id || github.run_id }}
path: ./artifacts
continue-on-error: true # Allow the step to fail without stopping the workflow
- name: Determine branch for checkout
id: determine_branch
run: |
if [[ -f ./artifacts/branch.txt && -f ./artifacts/run_id.txt ]]; then
echo "branch=$(cat ./artifacts/branch.txt)" >> $GITHUB_ENV
echo "original_run_id=$(cat ./artifacts/run_id.txt)" >> $GITHUB_ENV
else
BRANCH_NAME=$(echo $GITHUB_REF | cut -d "/" -f 3)
echo "branch=$BRANCH_NAME" >> $GITHUB_ENV
fi
- name: Print branch to be checked out
run: |
echo "Branch to checkout: ${{ env.branch }}"
- name: Checkout the code
uses: actions/checkout@v4
with:
ref: ${{ env.branch }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip' # caching pip stuff
- name: Install Swirl
run: ./install.sh
- name: Update apt
run: sudo apt -o Acquire::Retries=3 update
- name: Upgrade Ubuntu to latest patches
run: sudo apt upgrade -y
- name: Install redis-server
run: sudo apt install -y redis-server
- name: Set up Swirl
run: python swirl.py setup
- name: Start Swirl
run: python swirl.py start
- name: Run smoke tests
run: docker run --net=host -t swirlai/swirl-testing:latest-smoke-test sh -c "behave **/docker_container/*.feature --tags=docker_api_smoke"
- name: Ensure artifacts directory exists and write branch and run_id again
run: |
mkdir -p ./artifacts
echo "${{ env.branch }}" > ./artifacts/branch.txt
echo "${{ env.original_run_id }}" > ./artifacts/run_id.txt
- name: Re-upload branch and run_id for subsequent workflows
uses: actions/upload-artifact@v3
with:
name: branch-info-${{ github.run_id }}
path: |
./artifacts/branch.txt
./artifacts/run_id.txt
- name: Upload log files
if: always()
uses: actions/upload-artifact@v3
with:
name: log-files
path: |
logs/
/var/log/syslog*