forked from linux-system-roles/kdump
-
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.
Create separate github actions for various checks; get rid of monolit…
…hic tox.yml (linux-system-roles#125) * Create separate github actions for various checks; get rid of monolithic tox.yml There are now separate github actions for the various tests, instead of all of them being done as part of the tox tests in tox.yml - ansible-lint, ansible-test, etc. Use the officially supported github actions e.g. for ansible-lint, ansible-test, rather than using our own from `tox-lsr` and trying to keep up with the latest changes. Developers will still be able to use `tox-lsr` on their local development environments to run these tests in the same way that they are run in github actions, so that errors found when submitting PRs can be reproduced and corrected locally without too many github UI roundtrips. Using separate github actions, and especially the official github actions which generally have support for in-line comments, should help greatly with readability and troubleshooting test results. Python tests are removed from roles that do not use python. Python tests are now done by python-unit-tests.yml which also does the black, flake8, and pylint tests. Signed-off-by: Rich Megginson <[email protected]> * Create separate github actions for various checks; get rid of monolithic tox.yml There are now separate github actions for the various tests, instead of all of them being done as part of the tox tests in tox.yml - ansible-lint, ansible-test, etc. Use the officially supported github actions e.g. for ansible-lint, ansible-test, rather than using our own from `tox-lsr` and trying to keep up with the latest changes. Developers will still be able to use `tox-lsr` on their local development environments to run these tests in the same way that they are run in github actions, so that errors found when submitting PRs can be reproduced and corrected locally without too many github UI roundtrips. Using separate github actions, and especially the official github actions which generally have support for in-line comments, should help greatly with readability and troubleshooting test results. Python tests are removed from roles that do not use python. Python tests are now done by python-unit-tests.yml which also does the black, flake8, and pylint tests. Signed-off-by: Rich Megginson <[email protected]> * Create separate github actions for various checks; get rid of monolithic tox.yml There are now separate github actions for the various tests, instead of all of them being done as part of the tox tests in tox.yml - ansible-lint, ansible-test, etc. Use the officially supported github actions e.g. for ansible-lint, ansible-test, rather than using our own from `tox-lsr` and trying to keep up with the latest changes. Developers will still be able to use `tox-lsr` on their local development environments to run these tests in the same way that they are run in github actions, so that errors found when submitting PRs can be reproduced and corrected locally without too many github UI roundtrips. Using separate github actions, and especially the official github actions which generally have support for in-line comments, should help greatly with readability and troubleshooting test results. Python tests are removed from roles that do not use python. Python tests are now done by python-unit-tests.yml which also does the black, flake8, and pylint tests. Signed-off-by: Rich Megginson <[email protected]> Signed-off-by: Rich Megginson <[email protected]>
- Loading branch information
Showing
10 changed files
with
199 additions
and
91 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
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,33 @@ | ||
--- | ||
name: Ansible Lint | ||
on: # yamllint disable-line rule:truthy | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
jobs: | ||
ansible_lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Update pip, git | ||
run: | | ||
set -euxo pipefail | ||
sudo apt-get update | ||
sudo apt-get install -y git | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
- name: Fix up role meta/main.yml namespace and name | ||
run: | | ||
set -euxo pipefail | ||
mm=meta/main.yml | ||
if [ -f "$mm" ]; then | ||
if ! grep -q '^ *namespace:' "$mm"; then | ||
sed "/galaxy_info:/a\ namespace: linux_system_roles" -i "$mm" | ||
fi | ||
if ! grep -q '^ *role_name:' "$mm"; then | ||
sed "/galaxy_info:/a\ role_name: kdump" -i "$mm" | ||
fi | ||
fi | ||
- name: Run ansible-lint | ||
uses: ansible-community/ansible-lint-action@v6 |
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,28 @@ | ||
--- | ||
name: Check for ansible_managed variable use in comments | ||
on: # yamllint disable-line rule:truthy | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
jobs: | ||
ansible_managed_var_comment: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Update pip, git | ||
run: | | ||
set -euxo pipefail | ||
python3 -m pip install --upgrade pip | ||
sudo apt-get update | ||
sudo apt-get install -y git | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
- name: Install tox, tox-lsr | ||
run: | | ||
set -euxo pipefail | ||
pip3 install "git+https://github.com/linux-system-roles/[email protected]" | ||
- name: Run ansible-plugin-scan | ||
run: | | ||
set -euxo pipefail | ||
TOXENV=ansible-managed-var-comment lsr_ci_runtox |
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,28 @@ | ||
--- | ||
name: Ansible Plugin Scan | ||
on: # yamllint disable-line rule:truthy | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
jobs: | ||
ansible_plugin_scan: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Update pip, git | ||
run: | | ||
set -euxo pipefail | ||
python3 -m pip install --upgrade pip | ||
sudo apt-get update | ||
sudo apt-get install -y git | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
- name: Install tox, tox-lsr | ||
run: | | ||
set -euxo pipefail | ||
pip3 install "git+https://github.com/linux-system-roles/[email protected]" | ||
- name: Run ansible-plugin-scan | ||
run: | | ||
set -euxo pipefail | ||
TOXENV=ansible-plugin-scan lsr_ci_runtox |
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,50 @@ | ||
--- | ||
name: Ansible Test | ||
on: # yamllint disable-line rule:truthy | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
env: | ||
LSR_ROLE2COLL_NAMESPACE: fedora | ||
LSR_ROLE2COLL_NAME: linux_system_roles | ||
jobs: | ||
ansible_test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Update pip, git | ||
run: | | ||
set -euxo pipefail | ||
python3 -m pip install --upgrade pip | ||
sudo apt-get update | ||
sudo apt-get install -y git | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
- name: Install tox, tox-lsr | ||
run: | | ||
set -euxo pipefail | ||
pip3 install "git+https://github.com/linux-system-roles/[email protected]" | ||
- name: Convert role to collection format | ||
run: | | ||
set -euxo pipefail | ||
TOXENV=collection lsr_ci_runtox | ||
# copy the ignore files | ||
coll_dir=".tox/ansible_collections/$LSR_ROLE2COLL_NAMESPACE/$LSR_ROLE2COLL_NAME" | ||
# wokeignore:rule=sanity | ||
ignore_dir="$coll_dir/tests/sanity" | ||
if [ ! -d "$ignore_dir" ]; then | ||
mkdir -p "$ignore_dir" | ||
fi | ||
# wokeignore:rule=sanity | ||
for file in .sanity-ansible-ignore-*.txt; do | ||
if [ -f "$file" ]; then | ||
# wokeignore:rule=sanity | ||
cp "$file" "$ignore_dir/${file//*.sanity-ansible-}" | ||
fi | ||
done | ||
- name: Run ansible-test | ||
uses: ansible-community/ansible-test-gh-action@release/v1 | ||
with: | ||
testing-type: sanity # wokeignore:rule=sanity | ||
collection-src-directory: .tox/ansible_collections/${{ env.LSR_ROLE2COLL_NAMESPACE }}/${{ env.LSR_ROLE2COLL_NAME }} |
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
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,29 @@ | ||
--- | ||
name: ShellCheck | ||
on: # yamllint disable-line rule:truthy | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
env: | ||
# some scripts source tox-lsr scripts - suppress that check | ||
SHELLCHECK_OPTS: -e SC1091 | ||
jobs: | ||
shellcheck: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Update git | ||
run: | | ||
set -euxo pipefail | ||
sudo apt-get update | ||
sudo apt-get install -y git | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
- name: Run ShellCheck | ||
id: shellcheck_id | ||
uses: ludeeus/action-shellcheck@master | ||
- name: Show file paths scanned | ||
run: | | ||
echo Files scanned: | ||
echo "${{ steps.shellcheck_id.outputs.files }}" |
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# SPDX-License-Identifier: MIT | ||
--- | ||
extends: default | ||
ignore: | | ||
/.tox/ | ||
extends: default |