|
| 1 | +name: Podman API container |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + paths: |
| 6 | + - '.github/workflows/podman_container_api.yml' |
| 7 | + - 'ci/*.yml' |
| 8 | + - 'ci/run_containers_tests.sh' |
| 9 | + - 'ci/playbooks/containers/podman_container_api.yml' |
| 10 | + #- 'plugins/modules/podman_container.py' |
| 11 | + - 'plugins/module_utils/podman/podman_container_lib.py' |
| 12 | + - 'plugins/module_utils/podman/podman_api.py' |
| 13 | + - 'plugins/module_utils/podman/common.py' |
| 14 | + - 'tests/integration/targets/podman_container_api/**' |
| 15 | + branches: |
| 16 | + - master |
| 17 | + pull_request: |
| 18 | + paths: |
| 19 | + - '.github/workflows/podman_container_api.yml' |
| 20 | + - 'ci/*.yml' |
| 21 | + - 'ci/run_containers_tests.sh' |
| 22 | + - 'ci/playbooks/containers/podman_container_api.yml' |
| 23 | + #- 'plugins/modules/podman_container.py' |
| 24 | + - 'plugins/module_utils/podman/podman_container_lib.py' |
| 25 | + - 'plugins/module_utils/podman/podman_api.py' |
| 26 | + - 'plugins/module_utils/podman/common.py' |
| 27 | + - 'tests/integration/targets/podman_container_api/**' |
| 28 | + schedule: |
| 29 | + - cron: 4 0 * * * # Run daily at 0:03 UTC |
| 30 | + |
| 31 | +jobs: |
| 32 | + |
| 33 | + test_podman_container_api: |
| 34 | + name: Podman API container ${{ matrix.ansible-version }}-${{ matrix.os || 'ubuntu-latest' }} |
| 35 | + runs-on: ${{ matrix.os || 'ubuntu-latest' }} |
| 36 | + defaults: |
| 37 | + run: |
| 38 | + shell: bash |
| 39 | + strategy: |
| 40 | + fail-fast: false |
| 41 | + matrix: |
| 42 | + ansible-version: |
| 43 | + - ansible<2.10 |
| 44 | + - git+https://github.com/ansible/ansible.git@stable-2.11 |
| 45 | + - git+https://github.com/ansible/ansible.git@devel |
| 46 | + os: |
| 47 | + - ubuntu-20.04 |
| 48 | + python-version: |
| 49 | + - 3.7 |
| 50 | + |
| 51 | + steps: |
| 52 | + |
| 53 | + - name: Check out repository |
| 54 | + uses: actions/checkout@v2 |
| 55 | + |
| 56 | + - name: Set up Python ${{ matrix.python-version }} |
| 57 | + uses: actions/setup-python@v2 |
| 58 | + with: |
| 59 | + python-version: ${{ matrix.python-version }} |
| 60 | + |
| 61 | + - name: Upgrade pip and display Python and PIP versions |
| 62 | + run: | |
| 63 | + sudo apt-get update |
| 64 | + sudo apt-get install -y python*-wheel python*-yaml |
| 65 | + python -m pip install --upgrade pip |
| 66 | + python -V |
| 67 | + pip --version |
| 68 | +
|
| 69 | + - name: Set up pip cache |
| 70 | + uses: actions/cache@v1 |
| 71 | + with: |
| 72 | + path: ~/.cache/pip |
| 73 | + key: ${{ runner.os }}-pip-${{ github.ref }}-units-VMs |
| 74 | + restore-keys: | |
| 75 | + ${{ runner.os }}-pip- |
| 76 | + ${{ runner.os }}- |
| 77 | +
|
| 78 | + - name: Install Ansible ${{ matrix.ansible-version }} |
| 79 | + run: python3 -m pip install --user --force-reinstall --upgrade '${{ matrix.ansible-version }}' |
| 80 | + |
| 81 | + - name: Build and install the collection tarball |
| 82 | + run: | |
| 83 | + export PATH=~/.local/bin:$PATH |
| 84 | +
|
| 85 | + echo "Run ansible version" |
| 86 | + command -v ansible |
| 87 | + ansible --version |
| 88 | + rm -rf /tmp/just_new_collection |
| 89 | + ~/.local/bin/ansible-galaxy collection build --output-path /tmp/just_new_collection --force |
| 90 | + ~/.local/bin/ansible-galaxy collection install -vvv --force /tmp/just_new_collection/*.tar.gz |
| 91 | +
|
| 92 | + - name: Run collection tests for podman container API |
| 93 | + run: | |
| 94 | + export PATH=~/.local/bin:$PATH |
| 95 | +
|
| 96 | + if [[ '${{ matrix.ansible-version }}' == 'git+https://github.com/ansible/ansible.git@devel' ]]; then |
| 97 | + export ANSIBLE_CONFIG=$(pwd)/ci/ansible-dev.cfg |
| 98 | + elif [[ '${{ matrix.ansible-version }}' == 'ansible<2.10' ]]; then |
| 99 | + export ANSIBLE_CONFIG=$(pwd)/ci/ansible-2.9.cfg |
| 100 | + fi |
| 101 | + python3 -m pip install --user requests |
| 102 | + podman system service --time=0 unix:///tmp/podman.sock & |
| 103 | +
|
| 104 | + echo $ANSIBLE_CONFIG |
| 105 | + command -v ansible-playbook |
| 106 | + pip --version |
| 107 | + python --version |
| 108 | + ansible-playbook --version |
| 109 | +
|
| 110 | + ansible-playbook -vv ci/playbooks/pre.yml \ |
| 111 | + -e host=localhost \ |
| 112 | + -i localhost, \ |
| 113 | + -e ansible_connection=local \ |
| 114 | + -e setup_python=false |
| 115 | +
|
| 116 | + TEST2RUN=podman_container_api ./ci/run_containers_tests.sh |
| 117 | + shell: bash |
0 commit comments