Skip to content

Commit

Permalink
refactor: get_ostree_data.sh use env shebang - remove from .sanity*
Browse files Browse the repository at this point in the history
Use the `#!/usr/bin/env bash` shebang which is ansible-test friendly.
This means we can remove get_ostree_data.sh from the .sanity* files.
This also means we can remove the .sanity* files if we do not need
them otherwise.

Rename `pth` to `path` in honor of nscott

Signed-off-by: Rich Megginson <[email protected]>
  • Loading branch information
richm committed Dec 6, 2023
1 parent 243dbed commit f86f91f
Show file tree
Hide file tree
Showing 22 changed files with 647 additions and 31 deletions.
1 change: 1 addition & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ skip_list:
exclude_paths:
- tests/roles/
- .github/
- .markdownlint.yaml
- examples/roles/
mock_roles:
- linux-system-roles.fapolicyd
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ updates:
directory: /
schedule:
interval: monthly
commit-message:
prefix: ci
2 changes: 1 addition & 1 deletion .github/workflows/ansible-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
sed "/galaxy_info:/a\ namespace: linux_system_roles" -i "$mm"
fi
if ! grep -q '^ *role_name:' "$mm"; then
sed "/galaxy_info:/a\ role_name: template" -i "$mm"
sed "/galaxy_info:/a\ role_name: fapolicyd" -i "$mm"
fi
fi
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ansible-managed-var-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Install tox, tox-lsr
run: |
set -euxo pipefail
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.0.0"
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.1.1"
- name: Run ansible-plugin-scan
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ansible-plugin-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Install tox, tox-lsr
run: |
set -euxo pipefail
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.0.0"
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.1.1"
- name: Run ansible-plugin-scan
run: |
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/ansible-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ jobs:
- name: Install tox, tox-lsr
run: |
set -euxo pipefail
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.0.0"
pip3 install "git+https://github.com/linux-system-roles/tox-lsr@3.1.1"
- name: Convert role to collection format
run: |
set -euxo pipefail
# Remove to avoid running ansible-test on unrelated file
rm -f .pandoc_template.html5
TOXENV=collection lsr_ci_runtox
# copy the ignore files
coll_dir=".tox/ansible_collections/$LSR_ROLE2COLL_NAMESPACE/$LSR_ROLE2COLL_NAME"
Expand Down
104 changes: 104 additions & 0 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
# yamllint disable rule:line-length
name: Convert README.md to HTML and push to docs branch
on: # yamllint disable-line rule:truthy
push:
branches:
- main
paths:
- README.md
release:
types:
- published
permissions:
contents: read
jobs:
build_docs:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Update pip, git
run: |
set -euxo pipefail
sudo apt update
sudo apt install -y git
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Ensure the docs branch
run: |
set -euxo pipefail
branch=docs
existed_in_remote=$(git ls-remote --heads origin $branch)
if [ -z "${existed_in_remote}" ]; then
echo "Creating $branch branch"
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git checkout --orphan $branch
git reset --hard
git commit --allow-empty -m "Initializing $branch branch"
git push origin $branch
echo "Created $branch branch"
else
echo "Branch $branch already exists"
fi
- name: Checkout the docs branch
uses: actions/checkout@v4
with:
ref: docs

- name: Fetch README.md and .pandoc_template.html5 template from the workflow branch
uses: actions/checkout@v4
with:
sparse-checkout: |
README.md
.pandoc_template.html5
sparse-checkout-cone-mode: false
path: ref_branch
- name: Set RELEASE_VERSION based on whether run on release or on push
run: |
set -euxo pipefail
if [ ${{ github.event_name }} = release ]; then
echo "RELEASE_VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
elif [ ${{ github.event_name }} = push ]; then
echo "RELEASE_VERSION=latest" >> $GITHUB_ENV
else
echo Unsupported event
exit 1
fi
- name: Ensure that version and docs directories exist
run: mkdir -p ${{ env.RELEASE_VERSION }} docs

- name: Remove badges from README.md prior to converting to HTML
run: sed -i '1,8 {/^\[\!.*actions\/workflows/d}' ref_branch/README.md

- name: Convert README.md to HTML and save to the version directory
uses: docker://pandoc/core:latest
with:
args: >-
--from gfm --to html5 --toc --shift-heading-level-by=-1
--template ref_branch/.pandoc_template.html5
--output ${{ env.RELEASE_VERSION }}/README.html ref_branch/README.md
- name: Copy latest README.html to docs/index.html for GitHub pages
if: env.RELEASE_VERSION == 'latest'
run: cp ${{ env.RELEASE_VERSION }}/README.html docs/index.html

- name: Commit changes
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git add ${{ env.RELEASE_VERSION }}/README.html docs/index.html
git commit -m "Update README.html for ${{ env.RELEASE_VERSION }}"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: docs
38 changes: 38 additions & 0 deletions .github/workflows/markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
# yamllint disable rule:line-length
name: Markdown Lint
on: # yamllint disable-line rule:truthy
pull_request:
merge_group:
branches:
- main
types:
- checks_requested
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
jobs:
markdownlint:
runs-on: ubuntu-latest
steps:
- name: Update pip, git
run: |
set -euxo pipefail
sudo apt update
sudo apt install -y git
- name: Check out code
uses: actions/checkout@v4

# CHANGELOG.md is generated automatically from PR titles and descriptions
# It might have issues but they are not critical
- name: Lint all markdown files except for CHANGELOG.md
uses: docker://avtodev/markdown-lint:master
with:
args: >-
--ignore=CHANGELOG.md
**/*.md
config: .markdownlint.yaml
46 changes: 46 additions & 0 deletions .github/workflows/test_converting_readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
# yamllint disable rule:line-length
name: Test converting README.md to README.html
on: # yamllint disable-line rule:truthy
pull_request:
merge_group:
branches:
- main
types:
- checks_requested
push:
branches:
- main
permissions:
contents: read
jobs:
test_converting_readme:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Update pip, git
run: |
set -euxo pipefail
sudo apt update
sudo apt install -y git
- name: Check out code
uses: actions/checkout@v4

- name: Remove badges from README.md prior to converting to HTML
run: sed -i '1,8 {/^\[\!.*actions\/workflows/d}' README.md

- name: Convert README.md to HTML
uses: docker://pandoc/core:latest
with:
args: >-
--from gfm --to html5 --toc --shift-heading-level-by=-1
--template .pandoc_template.html5
--output README.html README.md
- name: Upload README.html as an artifact
uses: actions/upload-artifact@master
with:
name: README.html
path: README.html
11 changes: 8 additions & 3 deletions .github/workflows/weekly_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ name: Weekly CI trigger
on: # yamllint disable-line rule:truthy
workflow_dispatch:
schedule:
- cron: 0 0 * * 6
- cron: 0 12 * * 6
env:
BRANCH_NAME: weekly-ci
COMMIT_MESSAGE: This PR is to trigger periodic CI testing
COMMIT_MESSAGE: "ci: This PR is to trigger periodic CI testing"
BODY_MESSAGE: >-
This PR is for the purpose of triggering periodic CI testing.
We don't currently have a way to trigger CI without a PR,
Expand All @@ -33,14 +33,19 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create and push empty commit
- name: Create or rebase commit, add dump_packages callback
run: |
set -euxo pipefail
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout ${{ env.BRANCH_NAME }} || git checkout -b ${{ env.BRANCH_NAME }}
git rebase main
if [ ! -d tests/callback_plugins ]; then
mkdir -p tests/callback_plugins
fi
curl -L -s -o tests/callback_plugins/dump_packages.py https://raw.githubusercontent.com/linux-system-roles/auto-maintenance/main/callback_plugins/dump_packages.py
git add tests/callback_plugins
git commit --allow-empty -m "${{ env.COMMIT_MESSAGE }}"
git push -f --set-upstream origin ${{ env.BRANCH_NAME }}
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/woke.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# yamllint disable rule:line-length
name: Check for non-inclusive language
name: Woke
on: # yamllint disable-line rule:truthy
- pull_request
jobs:
woke:
name: woke
name: Detect non-inclusive language
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: woke
uses: get-woke/woke-action@v0
- name: Run lsr-woke-action
# Originally, uses: get-woke/woke-action@v0
uses: linux-system-roles/lsr-woke-action@main
with:
woke-args: "-c https://raw.githubusercontent.com/linux-system-roles/tox-lsr/main/src/tox_lsr/config_files/woke.yml"
woke-args: "-c https://raw.githubusercontent.com/linux-system-roles/tox-lsr/main/src/tox_lsr/config_files/woke.yml --count-only-error-for-failure"
# Cause the check to fail on any broke rules
fail-on-error: true
Loading

0 comments on commit f86f91f

Please sign in to comment.