From 0172cf38354f6e5af4b9f0c65bfb594825f6d50d Mon Sep 17 00:00:00 2001 From: Andrey Gubarev Date: Wed, 21 Feb 2024 12:51:23 +0400 Subject: [PATCH 1/5] added separate github actions for ansible and python linting and testing, removed them from python-package.yml --- .github/workflows/ansible-lint.yml | 24 +++++++++++++ .github/workflows/ansible-test.yml | 26 ++++++++++++++ .github/workflows/python-lint.yml | 25 +++++++++++++ .github/workflows/python-package.yml | 53 ---------------------------- 4 files changed, 75 insertions(+), 53 deletions(-) create mode 100644 .github/workflows/ansible-lint.yml create mode 100644 .github/workflows/ansible-test.yml create mode 100644 .github/workflows/python-lint.yml diff --git a/.github/workflows/ansible-lint.yml b/.github/workflows/ansible-lint.yml new file mode 100644 index 0000000..d52d50c --- /dev/null +++ b/.github/workflows/ansible-lint.yml @@ -0,0 +1,24 @@ +name: Ansible - Lint + +on: [push, pull_request] + +permissions: + contents: read + +jobs: + lint-ansible: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install dependencies + run: pip install ansible-lint + + - name: Lint with ansible-lint + run: ansible-lint -v diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml new file mode 100644 index 0000000..7428109 --- /dev/null +++ b/.github/workflows/ansible-test.yml @@ -0,0 +1,26 @@ +name: Ansible - Test + +on: [push, pull_request] + +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -yq --no-install-recommends mkisofs qemu-system-x86 qemu-utils + + - name: Run test + run: make test-platform-amd64 diff --git a/.github/workflows/python-lint.yml b/.github/workflows/python-lint.yml new file mode 100644 index 0000000..779113a --- /dev/null +++ b/.github/workflows/python-lint.yml @@ -0,0 +1,25 @@ +name: Python Package - Lint + +on: [push, pull_request] + +permissions: + contents: read + +jobs: + lint-python: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install dependencies + run: pip install pycodestyle + + - name: Lint with pycodestyle + run: python -m pycodestyle molecule_qemu + diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 6581011..fa80cb4 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -6,59 +6,6 @@ permissions: contents: read jobs: - lint-ansible: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - - name: Install dependencies - run: pip install ansible-lint - - - name: Lint with ansible-lint - run: ansible-lint -v - - lint-python: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - - name: Install dependencies - run: pip install pycodestyle - - - name: Lint with pycodestyle - run: python -m pycodestyle molecule_qemu - - test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - - name: Install system dependencies - run: | - sudo apt-get update - sudo apt-get install -yq --no-install-recommends mkisofs qemu-system-x86 qemu-utils - - - name: Run test - run: make test-platform-amd64 - build: runs-on: ubuntu-latest needs: [lint-ansible, lint-python, test] From 92f574e2a7c2ca693391b4afc2adedd66f193a25 Mon Sep 17 00:00:00 2001 From: Andrey Gubarev Date: Wed, 21 Feb 2024 12:52:46 +0400 Subject: [PATCH 2/5] removed unnecessary newline in python-lint workflow --- .github/workflows/python-lint.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/python-lint.yml b/.github/workflows/python-lint.yml index 779113a..282a0c4 100644 --- a/.github/workflows/python-lint.yml +++ b/.github/workflows/python-lint.yml @@ -22,4 +22,3 @@ jobs: - name: Lint with pycodestyle run: python -m pycodestyle molecule_qemu - From 464930ec13c8d806129c80d1c32911edeba54004 Mon Sep 17 00:00:00 2001 From: Andrey Gubarev Date: Wed, 21 Feb 2024 13:00:17 +0400 Subject: [PATCH 3/5] updated kvm support check to include read and write permissions --- molecule_qemu/playbooks/create.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/molecule_qemu/playbooks/create.yml b/molecule_qemu/playbooks/create.yml index 9ed63e8..e932e52 100644 --- a/molecule_qemu/playbooks/create.yml +++ b/molecule_qemu/playbooks/create.yml @@ -130,7 +130,7 @@ - name: Check kvm support when: ansible_system == 'Linux' - ansible.builtin.shell: (egrep -m1 -w '^flags[[:blank:]]*:' /proc/cpuinfo | egrep -wo '(vmx|svm)') && test -e /dev/kvm + ansible.builtin.shell: (egrep -m1 -w '^flags[[:blank:]]*:' /proc/cpuinfo | egrep -wo '(vmx|svm)') && test -e /dev/kvm && test -r /dev/kvm && test -w /dev/kvm register: kvm_support changed_when: false ignore_errors: true From b1513ca26f2414be3c1190a7e6923261faa64281 Mon Sep 17 00:00:00 2001 From: Andrey Gubarev Date: Wed, 21 Feb 2024 13:07:04 +0400 Subject: [PATCH 4/5] removed non-essential -x permissions, based on reports only -r -w are required --- molecule_qemu/playbooks/create.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/molecule_qemu/playbooks/create.yml b/molecule_qemu/playbooks/create.yml index e932e52..63be9dd 100644 --- a/molecule_qemu/playbooks/create.yml +++ b/molecule_qemu/playbooks/create.yml @@ -130,7 +130,7 @@ - name: Check kvm support when: ansible_system == 'Linux' - ansible.builtin.shell: (egrep -m1 -w '^flags[[:blank:]]*:' /proc/cpuinfo | egrep -wo '(vmx|svm)') && test -e /dev/kvm && test -r /dev/kvm && test -w /dev/kvm + ansible.builtin.shell: (egrep -m1 -w '^flags[[:blank:]]*:' /proc/cpuinfo | egrep -wo '(vmx|svm)') && test -r /dev/kvm && test -w /dev/kvm register: kvm_support changed_when: false ignore_errors: true From bfac28c4abccca3e67953a1b58539b13dc7c8731 Mon Sep 17 00:00:00 2001 From: Andrey Gubarev Date: Wed, 21 Feb 2024 13:09:53 +0400 Subject: [PATCH 5/5] renamed workflow file and updated to trigger on main branch and version tag pushes --- .../{python-package.yml => python-release.yml} | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) rename .github/workflows/{python-package.yml => python-release.yml} (94%) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-release.yml similarity index 94% rename from .github/workflows/python-package.yml rename to .github/workflows/python-release.yml index fa80cb4..05f2d76 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-release.yml @@ -1,6 +1,12 @@ -name: Python Package +name: Python Package - Release + +on: + push: + branches: + - main + tags: + - 'v*.*.*' -on: [push] permissions: contents: read