diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:03:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:03:42 +0000 |
commit | 66cec45960ce1d9c794e9399de15c138acb18aed (patch) | |
tree | 59cd19d69e9d56b7989b080da7c20ef1a3fe2a5a /ansible_collections/cloudscale_ch/cloud/.github | |
parent | Initial commit. (diff) | |
download | ansible-66cec45960ce1d9c794e9399de15c138acb18aed.tar.xz ansible-66cec45960ce1d9c794e9399de15c138acb18aed.zip |
Adding upstream version 7.3.0+dfsg.upstream/7.3.0+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/cloudscale_ch/cloud/.github')
5 files changed, 222 insertions, 0 deletions
diff --git a/ansible_collections/cloudscale_ch/cloud/.github/dependabot.yml b/ansible_collections/cloudscale_ch/cloud/.github/dependabot.yml new file mode 100644 index 00000000..607e7e1a --- /dev/null +++ b/ansible_collections/cloudscale_ch/cloud/.github/dependabot.yml @@ -0,0 +1,8 @@ +# Set update schedule for GitHub Actions +--- +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/ansible_collections/cloudscale_ch/cloud/.github/workflows/cleanup.yml b/ansible_collections/cloudscale_ch/cloud/.github/workflows/cleanup.yml new file mode 100644 index 00000000..f2333cff --- /dev/null +++ b/ansible_collections/cloudscale_ch/cloud/.github/workflows/cleanup.yml @@ -0,0 +1,35 @@ +name: Scheduled Cleanup + +on: + schedule: + - cron: '0 2 * * *' # UTC + +jobs: + cleanup: + name: Cleanup possible leftovers + runs-on: ubuntu-latest + steps: + - name: Ensure no other integration test is currently running + uses: softprops/turnstyle@v1 + timeout-minutes: 60 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + same-branch-only: false + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.8' + + - name: Run cleanup + run: | + pip install cloudscale-cli + for resource in objects-user server floating-ip server-group network; + do + echo "cleaning up $resource..."; + cloudscale $resource list --delete --force; + echo "...done"; + done + env: + CLOUDSCALE_API_TOKEN: ${{ secrets.CLOUDSCALE_API_TOKEN }} diff --git a/ansible_collections/cloudscale_ch/cloud/.github/workflows/publish-ansible-galaxy.yml b/ansible_collections/cloudscale_ch/cloud/.github/workflows/publish-ansible-galaxy.yml new file mode 100644 index 00000000..bf7e5e7b --- /dev/null +++ b/ansible_collections/cloudscale_ch/cloud/.github/workflows/publish-ansible-galaxy.yml @@ -0,0 +1,33 @@ +name: Publish release on Ansible Galaxy + +on: + release: + types: [published] + +jobs: + deploy: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ansible_collections/cloudscale_ch/cloud + steps: + - uses: actions/checkout@v3 + with: + path: ansible_collections/cloudscale_ch/cloud + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ansible + + - name: Build and publish + env: + ANSIBLE_GALAXY_API_KEY: ${{ secrets.ANSIBLE_GALAXY_API_KEY }} + run: | + ansible-galaxy collection build . + ansible-galaxy collection publish *.tar.gz --api-key $ANSIBLE_GALAXY_API_KEY diff --git a/ansible_collections/cloudscale_ch/cloud/.github/workflows/test-integration.yml b/ansible_collections/cloudscale_ch/cloud/.github/workflows/test-integration.yml new file mode 100644 index 00000000..a8510a39 --- /dev/null +++ b/ansible_collections/cloudscale_ch/cloud/.github/workflows/test-integration.yml @@ -0,0 +1,107 @@ +name: Collection Integration tests + +on: + schedule: + - cron: "0 5 * * *" # UTC + push: + tags: "v*" + branches: + - "test/**" +jobs: + integration-test: + name: Integration test using Python ${{ matrix.python-version }} + runs-on: ubuntu-20.04 + defaults: + run: + working-directory: ansible_collections/cloudscale_ch/cloud + strategy: + max-parallel: 1 + fail-fast: false + matrix: + ansible: + - stable-2.14 + python: + - 3.10 + steps: + - name: Check out code + uses: actions/checkout@v3 + with: + path: ansible_collections/cloudscale_ch/cloud + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install ansible and collection dependencies + run: | + python -m pip install --upgrade pip + pip install ansible + pip install -r tests/requirements.txt + + - name: Build and install collection + run: | + ansible-galaxy collection build . + ansible-galaxy collection install *.gz + + - name: Add config file + env: + CONFIG_FILE: ${{ secrets.CONFIG_FILE }} + INI_FILE: tests/integration/cloud-config-cloudscale.ini + run: | + echo -n "$CONFIG_FILE" > $INI_FILE && [ -s $INI_FILE ] || (>&2 echo no secrets provided; exit 1) + + - name: Ensure no other integration test is currently running + uses: softprops/turnstyle@v1 + timeout-minutes: 60 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + same-branch-only: false + + - name: Run the tests + run: >- + ansible-test + integration + --docker + -v + --diff + --color + --allow-unsupported + --continue-on-error + --coverage + cloud/cloudscale/ + + - name: Generate coverage report. + run: >- + ansible-test + coverage xml + -v + --requirements + --group-by command + --group-by version + + - uses: codecov/codecov-action@v3 + with: + fail_ci_if_error: false + + - name: Send mail in case of failure + id: send_mail + if: ${{ failure() && github.event_name == 'schedule' }} + shell: python3 {0} + run: | + from smtplib import SMTP + from email.message import EmailMessage + + email = EmailMessage() + email['TO'] = '${{ secrets.CRON_RCPT }}' + email['FROM'] = 'noreply@github.com' + email['Subject'] = 'Ansible Cloud Module Integration Test Failure' + email.set_content(""" + Integration tests using Python ${{ matrix.python-version }} failed: + https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + """) + + with SMTP('${{ secrets.MAILSERVER }}') as smtp: + smtp.starttls() + smtp.send_message(email) diff --git a/ansible_collections/cloudscale_ch/cloud/.github/workflows/test-sanity.yml b/ansible_collections/cloudscale_ch/cloud/.github/workflows/test-sanity.yml new file mode 100644 index 00000000..02f26ff0 --- /dev/null +++ b/ansible_collections/cloudscale_ch/cloud/.github/workflows/test-sanity.yml @@ -0,0 +1,39 @@ +name: Sanity tests +on: + schedule: + - cron: "32 5 * * *" + pull_request: + +jobs: + sanity: + name: Sanity tests (${{ matrix.ansible }}) + defaults: + run: + working-directory: ansible_collections/cloudscale_ch/cloud + strategy: + matrix: + ansible: + - stable-2.9 + - stable-2.10 + - stable-2.11 + - stable-2.12 + - stable-2.13 + - stable-2.14 + - devel + runs-on: ubuntu-20.04 + steps: + - name: Check out code + uses: actions/checkout@v3 + with: + path: ansible_collections/cloudscale_ch/cloud + + - name: Set up Python 3 + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install ansible-base (${{ matrix.ansible }}) + run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check + + - name: Run sanity tests + run: ansible-test sanity --docker -v --color |