|
1 | 1 | name: QA Suite
|
2 | 2 |
|
3 | 3 | on:
|
4 |
| - # workflow_run: |
5 |
| - # workflows: [Unit Tests] |
6 |
| - # types: |
7 |
| - # - completed |
8 |
| - # Allows you to run this workflow manually from the Actions tab |
| 4 | + # Manual trigger only |
9 | 5 | workflow_dispatch:
|
10 | 6 |
|
11 | 7 | jobs:
|
12 | 8 |
|
13 | 9 | build:
|
14 |
| - if: (github.event_name == 'workflow_dispatch') || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') |
15 | 10 | runs-on: ubuntu-latest
|
16 | 11 |
|
17 | 12 | steps:
|
18 |
| - - name: Download Branch and run_id Artifacts |
19 |
| - uses: dawidd6/action-download-artifact@v3 |
20 |
| - with: |
21 |
| - github_token: ${{ secrets.GITHUB_TOKEN }} |
22 |
| - workflow: unit-tests.yml |
23 |
| - name: branch-info-${{ github.event_name == 'workflow_run' && github.event.workflow_run.id || github.run_id }} |
24 |
| - path: ./artifacts |
25 |
| - continue-on-error: true # Allow the step to fail without stopping the workflow |
26 |
| - - name: Determine Branch for Checkout |
27 |
| - id: determine_branch |
28 |
| - run: | |
29 |
| - if [[ -f ./artifacts/branch.txt && -f ./artifacts/run_id.txt ]]; then |
30 |
| - echo "branch=$(cat ./artifacts/branch.txt)" >> $GITHUB_ENV |
31 |
| - echo "original_run_id=$(cat ./artifacts/run_id.txt)" >> $GITHUB_ENV |
32 |
| - else |
33 |
| - BRANCH_NAME=$(echo $GITHUB_REF | cut -d "/" -f 3) |
34 |
| - echo "branch=$BRANCH_NAME" >> $GITHUB_ENV |
35 |
| - fi |
36 |
| - - name: Print Branch to be Checked Out |
37 |
| - run: | |
38 |
| - echo "Branch to checkout: ${{ env.branch }}" |
39 |
| - - name: Checkout the Code |
40 |
| - uses: actions/checkout@v4 |
41 |
| - with: |
42 |
| - ref: ${{ env.branch }} |
43 |
| - - name: Set Up Python |
44 |
| - uses: actions/setup-python@v5 |
45 |
| - with: |
46 |
| - python-version: '3.12.2' |
47 |
| - cache: 'pip' # caching pip stuff |
48 |
| - - name: Install Chromium |
49 |
| - uses: browser-actions/setup-chrome@v1 |
50 |
| - - name: Chromium Binary Details |
51 |
| - run: | |
52 |
| - which chromedriver |
53 |
| - which chromium |
54 |
| - - name: Update apt |
55 |
| - run: sudo apt -o Acquire::Retries=3 update |
56 |
| - - name: Upgrade Ubuntu to Latest Patches |
57 |
| - run: sudo apt upgrade -y |
58 |
| - - name: Install redis-server |
59 |
| - run: sudo apt install -y redis-server |
60 |
| - - name: Install Swirl |
61 |
| - run: ./install.sh |
62 |
| - - name: Set Up Swirl |
63 |
| - run: python swirl.py setup |
64 |
| - - name: Start Swirl |
65 |
| - run: python swirl.py start |
66 |
| - - name: Check UI Availability |
67 |
| - run: curl http://localhost:8000/galaxy/login |
68 |
| - - name: Login to Docker Hub |
69 |
| - uses: docker/login-action@v3 |
70 |
| - with: |
71 |
| - username: ${{ secrets.DOCKER_USERNAME }} |
72 |
| - password: ${{ secrets.DOCKER_PASSWORD }} |
73 |
| - - name: Run the QA Suite |
74 |
| - run: docker run --net=host -e SWIRL_TEST_HOST=localhost -t swirlai/swirl-search-qa:automated-tests-master sh -c "behave --tags=qa_suite,community" |
75 |
| - - name: Ensure Artifacts Directory Exists and Write Branch and run_id Again |
76 |
| - run: | |
77 |
| - mkdir -p ./artifacts |
78 |
| - echo "${{ env.branch }}" > ./artifacts/branch.txt |
79 |
| - echo "${{ env.original_run_id }}" > ./artifacts/run_id.txt |
80 |
| - - name: Re-upload Branch and run_id for Subsequent Workflows |
81 |
| - uses: actions/upload-artifact@v4 |
82 |
| - with: |
83 |
| - name: branch-info-${{ github.run_id }} |
84 |
| - path: | |
85 |
| - ./artifacts/branch.txt |
86 |
| - ./artifacts/run_id.txt |
87 |
| - - name: Upload Log Files |
88 |
| - if: always() |
89 |
| - uses: actions/upload-artifact@v4 |
90 |
| - with: |
91 |
| - name: log-files |
92 |
| - path: | |
93 |
| - logs/ |
94 |
| - /var/log/syslog* |
| 13 | + - name: Checkout the Code |
| 14 | + uses: actions/checkout@v4 |
| 15 | + - name: Start Application Environment |
| 16 | + run: docker-compose up -d |
| 17 | + - name: Login to Docker Hub |
| 18 | + uses: docker/login-action@v3 |
| 19 | + with: |
| 20 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 21 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 22 | + - name: Wait for Application to be Ready |
| 23 | + run: | |
| 24 | + echo "Waiting for the application to become ready..." |
| 25 | + max_attempts=10 |
| 26 | + count=0 |
| 27 | + until curl --output /dev/null --silent --head --fail http://localhost:8000/galaxy/login; do |
| 28 | + count=$(($count+1)) |
| 29 | + if [ $count -ge $max_attempts ]; then |
| 30 | + echo "Application did not become ready in time." |
| 31 | + exit 1 |
| 32 | + fi |
| 33 | + printf '.' |
| 34 | + sleep 30 |
| 35 | + done |
| 36 | + echo "Application is ready." |
| 37 | + - name: Create env File |
| 38 | + run: | |
| 39 | + echo "SWIRL_TEST_HOST=localhost" > .env |
| 40 | + echo "QA_ADMIN_USER=${{ secrets.QA_ADMIN_USER }}" >> .env |
| 41 | + echo "QA_ADMIN_PW=${{ secrets.QA_ADMIN_PW }}" >> .env |
| 42 | + - name: Run the QA Suite |
| 43 | + run: docker run --net=host --env-file .env -t swirlai/swirl-search-qa:automated-tests-master sh -c "behave --tags=qa_suite,community" |
| 44 | + - name: Cleanup Application Environment |
| 45 | + run: docker-compose down |
| 46 | + - name: Upload Log Files |
| 47 | + if: always() |
| 48 | + uses: actions/upload-artifact@v4 |
| 49 | + with: |
| 50 | + name: log-files |
| 51 | + path: | |
| 52 | + logs/ |
| 53 | + /var/log/syslog* |
0 commit comments