[SECURESIGN-1659] Add AAP testing scenario for collection #800
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: Test the collection using Ansible Molecule | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
jobs: | |
molecule: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
scenario: | |
- default | |
- user_provided | |
max-parallel: 1 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
python -m pip install --upgrade pip | |
pip install -r testing-requirements.txt | |
ansible-galaxy install -r requirements.yml | |
ansible-galaxy install -r molecule/requirements.yml | |
- name: Set up SSH key | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.AWS_SSH_KEY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
- name: Run molecule | |
env: | |
TAS_SINGLE_NODE_REGISTRY_USERNAME: ${{ secrets.TAS_SINGLE_NODE_REGISTRY_USERNAME }} | |
TAS_SINGLE_NODE_REGISTRY_PASSWORD: ${{ secrets.TAS_SINGLE_NODE_REGISTRY_PASSWORD }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | |
GITHUB_RUN_ID: ${{ github.run_id }} | |
run: | | |
source venv/bin/activate | |
molecule reset | |
molecule -v test --scenario-name ${{ matrix.scenario }} | |
- name: Destroy molecule infrastructure | |
env: | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | |
if: always() | |
run: | | |
source venv/bin/activate | |
molecule destroy |