Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable perlcritic checks in CI #31

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Enable yaml checks in CI
Signed-off-by: ybonatakis <ybonatakis@suse.com>
b10n1k committed Feb 8, 2024
commit 4d56c6de8d0d6a9c3eb6efc171eb8c0ce782c2b1
7 changes: 6 additions & 1 deletion .github/workflows/isotovideo-check-all-test-modules.yml
Original file line number Diff line number Diff line change
@@ -13,4 +13,9 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Run isotovideo against test code, fail if any test module failed
run: podman run --rm -it -v .:/tests:Z --entrypoint '' registry.opensuse.org/devel/openqa/containers/isotovideo:qemu-x86-jq /bin/sh -c 'isotovideo qemu_no_kvm=1 casedir=/tests && jq .result testresults/result-*.json | grep -v ok && echo "Test modules failed" && exit 1'
env:
image: registry.opensuse.org/devel/openqa/containers/isotovideo:qemu-x86-jq
isotovideo: isotovideo qemu_no_kvm=1 casedir=/tests
jq_filter: jq .result testresults/result-*.json
err_msg: Test modules failed
run: docker run --rm -it -v .:/tests:Z --entrypoint '' $image /bin/sh -c '$isotovideo && $jq_filter | grep ok || (echo "$err_msg" && exit 1)'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this change related to perlcritic checks?

Is the switch from podman to docker intended? I thought podman is the preferred way.

Also, you probably do not want the exit in subshell and rather use grep ok || { echo "$err_msg" && exit 1; }

15 changes: 15 additions & 0 deletions .github/workflows/yaml-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: yamllint
on: [push, pull_request]

jobs:
yamllint:
runs-on: ubuntu-latest
container:
image: registry.opensuse.org/devel/openqa/containers/os-autoinst_dev
steps:
- uses: actions/checkout@v4
- name: Validate yamls
run: |
git config --global --add safe.directory '*'
yamllint --strict $(git ls-files "*.yml" "*.yaml" 2> /dev/null || find . -name '*.y*ml')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*.y*ml will match a lot of different things, maybe you want find . -name '*.yaml' -o -name '*.yml' to have closer match to the list used in git? Also 2> /dev/null might be good addition for the find as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yamllint actually has a configuration file where you can specify the matching glob, and by default it will match .yaml and .yml.
You only need to pass it a directory name.
Please just use the same as in here https://github.com/os-autoinst/os-autoinst-common/blob/master/.github/workflows/yamllint.yml

Empty file added .gitignore
Empty file.
Empty file added .yamlignore
Empty file.
1 change: 1 addition & 0 deletions .yamllint