-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Felix Matouschek <[email protected]>
- Loading branch information
0 parents
commit 6e21051
Showing
8 changed files
with
447 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
--- | ||
name: Integration tests | ||
# yamllint disable-line rule:truthy | ||
on: | ||
workflow_call: | ||
inputs: | ||
ansible_versions: | ||
required: true | ||
type: string | ||
python_versions: | ||
required: true | ||
type: string | ||
matrix_exclude: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
integration: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
test-target: | ||
- kubevirt_vm | ||
- kubevirt_vm_info | ||
- inventory_kubevirt | ||
ansible-version: ${{ fromJSON(inputs.ansible_versions) }} | ||
python-version: ${{ fromJSON(inputs.python_versions) }} | ||
exclude: ${{ fromJSON(inputs.matrix_exclude) }} | ||
runs-on: ubuntu-latest | ||
name: ${{ matrix.ansible-version }}, py${{ matrix.python-version }}, ${{ matrix.test-target }} | ||
env: | ||
collection_dir: ansible_collections/redhat/openshift_virtualization | ||
work_dir: /home/runner/.ansible/collections | ||
steps: | ||
- name: Download artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: collection-tarball | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install ansible-core ${{ matrix.ansible-version }} | ||
run: | | ||
pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz --disable-pip-version-check | ||
- name: Install collections | ||
run: | | ||
ansible-galaxy collection install -p ${{ env.work_dir }} redhat-openshift_virtualization-*.tar.gz | ||
# Install ansible.posix to have the ansible.posix.profile_task callback available | ||
ansible-galaxy collection install -p ${{ env.work_dir }} --force-with-deps ansible.posix | ||
- name: Install collection python requirements | ||
working-directory: ${{ env.work_dir }}/${{ env.collection_dir }} | ||
run: | | ||
pip install -r requirements.txt | ||
- name: Install kind / kubectl | ||
uses: helm/[email protected] | ||
with: | ||
install_only: true | ||
|
||
- name: Deploy KubeVirt | ||
run: | | ||
wget https://raw.githubusercontent.com/kubevirt/kubevirt.core/${{ github.ref_name}}/hack/e2e-setup.sh | ||
chmod +x e2e-setup.sh | ||
./e2e-setup.sh \ | ||
-v \ | ||
--configure-inotify-limits \ | ||
--configure-secondary-network \ | ||
--deploy-kubevirt \ | ||
--deploy-kubevirt-cdi \ | ||
--deploy-kubevirt-common-instancetypes \ | ||
--deploy-cnao \ | ||
--create-cluster \ | ||
--create-nad | ||
env: | ||
KIND: kind | ||
KUBECTL: kubectl | ||
|
||
- name: Run integration tests | ||
working-directory: ${{ env.work_dir }}/${{ env.collection_dir }} | ||
run: | | ||
ansible-test integration --requirements --python ${{ matrix.python-version }} ${{ matrix.test-target }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
name: Transform, test and release collection | ||
# yamllint disable-line rule:truthy | ||
on: | ||
push: | ||
tags: | ||
- "*.*.*" | ||
|
||
jobs: | ||
transform: | ||
uses: ./.github/workflows/transform.yml | ||
|
||
sanity: | ||
needs: transform | ||
uses: ./.github/workflows/sanity.yml | ||
with: | ||
ansible_versions: ${{ vars.ANSIBLE_VERSIONS }} | ||
python_versions: ${{ vars.PYTHON_VERSIONS }} | ||
matrix_exclude: ${{ vars.MATRIX_EXCLUDE }} | ||
|
||
unit: | ||
needs: transform | ||
uses: ./.github/workflows/unit.yml | ||
with: | ||
ansible_versions: ${{ vars.ANSIBLE_VERSIONS }} | ||
python_versions: ${{ vars.PYTHON_VERSIONS }} | ||
matrix_exclude: ${{ vars.MATRIX_EXCLUDE }} | ||
|
||
integration: | ||
needs: | ||
- sanity | ||
- unit | ||
uses: ./.github/workflows/integration.yml | ||
with: | ||
ansible_versions: ${{ vars.ANSIBLE_VERSIONS }} | ||
python_versions: ${{ vars.PYTHON_VERSIONS }} | ||
matrix_exclude: ${{ vars.MATRIX_EXCLUDE }} | ||
|
||
release: | ||
needs: integration | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Download artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: collection-tarball | ||
|
||
- name: Publish release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
body: | | ||
Version ${{ github.ref_name }} of the `redhat.openshift_virtualization` collection. | ||
fail_on_unmatched_files: true | ||
files: | | ||
redhat-openshift_virtualization-*.tar.gz |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
name: Sanity tests | ||
# yamllint disable-line rule:truthy | ||
on: | ||
workflow_call: | ||
inputs: | ||
ansible_versions: | ||
required: true | ||
type: string | ||
python_versions: | ||
required: true | ||
type: string | ||
matrix_exclude: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
sanity: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
ansible-version: ${{ fromJSON(inputs.ansible_versions) }} | ||
python-version: ${{ fromJSON(inputs.python_versions) }} | ||
exclude: ${{ fromJSON(inputs.matrix_exclude) }} | ||
runs-on: ubuntu-latest | ||
name: ${{ matrix.ansible-version }}, py${{ matrix.python-version }} | ||
env: | ||
collection_dir: ansible_collections/redhat/openshift_virtualization | ||
work_dir: /home/runner/.ansible/collections | ||
steps: | ||
- name: Download artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: collection-tarball | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install ansible-core ${{ matrix.ansible-version }} | ||
run: | | ||
pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz --disable-pip-version-check | ||
- name: Install collection | ||
run: | | ||
ansible-galaxy collection install -p ${{ env.work_dir }} redhat-openshift_virtualization-*.tar.gz | ||
- name: Run sanity tests | ||
working-directory: ${{ env.work_dir }}/${{ env.collection_dir }} | ||
run: | | ||
ansible-test sanity --requirements --python ${{ matrix.python-version }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
name: Transform collection | ||
# yamllint disable-line rule:truthy | ||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
transform: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.x | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt update | ||
sudo apt install -y rsync | ||
pip install ansible | ||
- name: Install community.fqcn_migration | ||
run: | | ||
ansible-galaxy collection install community.fqcn_migration | ||
# Make fqcn_migration compatible with Ubuntu | ||
TASK_PATH=~/.ansible/collections/ansible_collections/community/fqcn_migration/roles/fqcn_migration/tasks/utils/convert_rst_to_md.yml | ||
sed -i 's/ansible\.builtin\.yum\|ansible\.builtin\.dnf/ansible.builtin.package/g' "${TASK_PATH}" | ||
sed -i '/use_backend/d' "${TASK_PATH}" | ||
- name: Transform collection | ||
env: | ||
GIT_REPOSITORY_BRANCH: ${{ github.ref_name }} | ||
run: | | ||
ansible-playbook build-collection.yml | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: collection-tarball | ||
path: downstream/openshift_virtualization/redhat-openshift_virtualization-*.tar.gz |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
name: Unit tests | ||
# yamllint disable-line rule:truthy | ||
on: | ||
workflow_call: | ||
inputs: | ||
ansible_versions: | ||
required: true | ||
type: string | ||
python_versions: | ||
required: true | ||
type: string | ||
matrix_exclude: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
unit: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
ansible-version: ${{ fromJSON(inputs.ansible_versions) }} | ||
python-version: ${{ fromJSON(inputs.python_versions) }} | ||
exclude: ${{ fromJSON(inputs.matrix_exclude) }} | ||
runs-on: ubuntu-latest | ||
name: ${{ matrix.ansible-version }}, py${{ matrix.python-version }} | ||
env: | ||
collection_dir: ansible_collections/redhat/openshift_virtualization | ||
work_dir: /home/runner/.ansible/collections | ||
steps: | ||
- name: Download artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: collection-tarball | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install ansible-core ${{ matrix.ansible-version }} | ||
run: | | ||
pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz --disable-pip-version-check | ||
- name: Install collection | ||
run: | | ||
ansible-galaxy collection install -p ${{ env.work_dir }} redhat-openshift_virtualization-*.tar.gz | ||
- name: Run unit tests | ||
working-directory: ${{ env.work_dir }}/${{ env.collection_dir }} | ||
run: | | ||
ansible-test units --requirements --python ${{ matrix.python-version }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
extends: default | ||
|
||
rules: | ||
line-length: | ||
max: 140 | ||
ignore: | ||
- /build-collection.yml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Transform Ansible collection kubevirt.core to redhat.openshift_virtualization |
Oops, something went wrong.