Add site_type
to test and doc (#485)
#361
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: Run Integration Tests | |
on: | |
workflow_dispatch: null | |
push: | |
branches: | |
- main | |
- dev | |
jobs: | |
run-tests: | |
runs-on: ubuntu-latest | |
env: | |
EXIT_STATUS: 0 | |
defaults: | |
run: | |
working-directory: .ansible/collections/ansible_collections/linode/cloud | |
steps: | |
- name: checkout repo | |
uses: actions/checkout@v3 | |
with: | |
path: .ansible/collections/ansible_collections/linode/cloud | |
fetch-depth: 0 | |
submodules: 'recursive' | |
- name: update packages | |
run: sudo apt-get update -y | |
- name: install make | |
run: sudo apt-get install -y build-essential | |
- name: setup python 3 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: install dependencies | |
run: make deps | |
- name: install ansible dependencies | |
run: ansible-galaxy collection install amazon.aws:==6.0.1 | |
- name: install collection | |
run: make install | |
- name: replace existing keys | |
run: rm -rf ~/.ansible/test && mkdir -p ~/.ansible/test && ssh-keygen -m PEM -q -t rsa -N '' -f ~/.ansible/test/id_rsa | |
- name: run tests | |
run: | | |
if ! make testall > test_output.txt; then | |
echo "EXIT_STATUS=1" >> $GITHUB_ENV | |
fi | |
cat test_output.txt | |
env: | |
LINODE_API_TOKEN: ${{ secrets.DX_LINODE_TOKEN }} | |
ANSIBLE_CALLBACKS_ENABLED: "junit" | |
- name: Set release version env | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Merge all test xmls in output directory | |
run: | | |
python tod_scripts/merge_ansible_results.py | |
- name: Add additional information to XML report | |
run: | | |
filename=$(ls | grep -E '^[0-9]{12}_ansible_merged\.xml$') | |
python tod_scripts/add_to_xml_test_report.py \ | |
--branch_name "${{ env.RELEASE_VERSION }}" \ | |
--gha_run_id "$GITHUB_RUN_ID" \ | |
--gha_run_number "$GITHUB_RUN_NUMBER" \ | |
--xmlfile "${filename}" | |
- name: Upload test results to the bucket | |
run: | | |
filename=$(ls | grep -E '^[0-9]{12}_ansible_merged\.xml$') | |
python3 tod_scripts/test_report_upload_script.py "${filename}" | |
env: | |
LINODE_CLI_OBJ_ACCESS_KEY: ${{ secrets.LINODE_CLI_OBJ_ACCESS_KEY }} | |
LINODE_CLI_OBJ_SECRET_KEY: ${{ secrets.LINODE_CLI_OBJ_SECRET_KEY }} | |
- name: Test Execution Status Handler | |
run: | | |
if [[ "$EXIT_STATUS" != 0 ]]; then | |
echo "Test execution contains failure(s), check Run Integration tests step above" | |
exit $EXIT_STATUS | |
else | |
echo "Tests passed!" | |
fi | |