Skip to content

[GHA] Add integration test job #57

[GHA] Add integration test job

[GHA] Add integration test job #57

Workflow file for this run

---
name: platform collection tests
on:
push:
pull_request:
jobs:
integration:
name: collection integration test
runs-on: ubuntu-latest
env:
HEADLESS: "yes"
steps:
- uses: actions/checkout@v3
with:
repository: NilashishC/aap-gateway
token: ${{ secrets.AAP_GATEWAY_REPO_TOKEN }}
- name: Checkout DAB branch if needed
env:
PR_BODY: ${{ github.event.pull_request.body }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: tools/scripts/get_dab_for_pr.py
- name: Build the image
run: make docker-compose-build
- name: Spin up the dev env
run: |
ansible-playbook -v tools/ansible/smoke-test-no-services.yml \
-e repo_root=$(pwd) \
-e gateway_vars=$(readlink -f container-startup.yml)
- name: Cleanup services
run: make cleanup-services
- name: Extract gateway_admin_password and write to config
run: |
ADMIN_PW=$(awk '/gateway_admin_password/{print $2}' container-startup.yml | xargs echo) &&
echo "gateway_password=$ADMIN_PW" >> $GITHUB_ENV
- name: Echo gateway password
run: |
echo $gateway_password && \
ls $GITHUB_WORKSPACE
- name: Verify AAP is running
run: |
curl -k https://localhost:8000/api/gateway/v1/ping/
- uses: actions/checkout@v3
with:
path: ansible-platform
- name: Echo gateway password
run: |
cd ansible-platform && \
echo $gateway_password && \
ls $GITHUB_WORKSPACE
- name: Verify AAP is running (post checkout)
run: |
curl -k https://localhost:8000/api/gateway/v1/ping/
- name: Perform integration tests
run: cd ansible-platform && make collection-test
- name: Dump the container logs on failure
run: docker compose -f tools/generated/docker-compose.yml logs
if: failure()
sanity:
name: platform collection sanity
runs-on: ubuntu-latest
env:
HEADLESS: "yes"
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
ansible:
- stable-2.16
- stable-2.17
- stable-2.18
- stable-2.19
steps:
- uses: actions/checkout@v3
- name: Perform sanity testing
uses: ansible-community/ansible-test-gh-action@release/v1
with:
ansible-core-version: ${{ matrix.ansible }}
collection-root: .
testing-type: sanity
target-python-version: 3.11
# TO-DO
# - name: Upload gateway jUnit test reports to the unified dashboard
# if: >-
# !cancelled()
# && steps.make-run.outputs.test-result-files != ''
# && github.event_name == 'push'
# && env.UPSTREAM_REPOSITORY_ID == github.repository_id
# && github.ref_name == github.event.repository.default_branch
# run: |
# for junit_file in $(echo '${{ steps.make-run.outputs.test-result-files }}' | sed 's/,/ /')
# do
# curl \
# -v \
# --user "${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_USER }}:${{ secrets.PDE_ORG_RESULTS_UPLOAD_PASSWORD }}" \
# --form "xunit_xml=@${junit_file}" \
# --form "component_name=gateway" \
# --form "git_commit_sha=${{ github.sha }}" \
# --form "git_repository_url=https://github.com/${{ github.repository }}" \
# "${{ vars.PDE_ORG_RESULTS_AGGREGATOR_UPLOAD_URL }}/api/results/upload/"
# done
docs:
name: Check module doc strings
runs-on: ubuntu-latest
env:
HEADLESS: "yes"
steps:
- name: Install python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install requirements
run: pip3.11 install --upgrade ansible
- uses: actions/checkout@v3
- name: Run ansible-doc
run: make collection-docs
- name: Get ansible-doc version
run: ansible-doc --version
if: failure()
lint:
name: Lint module
runs-on: ubuntu-latest
env:
HEADLESS: "yes"
steps:
- name: Install python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install requirements
run: pip3.11 install --upgrade ansible-lint
- uses: actions/checkout@v3
- name: Run ansible-lint
run: make collection-lint
- name: Get ansible-lint version
run: ansible-lint --version
if: failure()
...