Skip to content

Commit 07fe006

Browse files
committed
GHA: misc maintenance
- shellcheck: check all (future) shell scripts. Suggested-by: Arthur Diniz Fixes #38 - drop permissions where missing. - do not persist credentials after checkout. - install prereqs first, then checkout source. - bump checkout action to v5. - bump REUSE action to v6. - omit recommended/suggested packages in debian container to save install time. - bump to latest shellcheck, checkbashisms, shfmt versions via Linuxbrew. Also making the install step 2-6x faster. - reduce `apt` log noise. - run spellcheckers: codespell and typos. - run zizmor in pedantic mode, fix minor issues. Silence two warnings about unpinned Debian (pedantic) and Fedora (non-pedantic) container images. - replace REUSE action with pip install. - enable Dependabot for pip and GHA (quarterly). Closes #68
1 parent ea05bb5 commit 07fe006

File tree

4 files changed

+99
-49
lines changed

4 files changed

+99
-49
lines changed

.github/dependabot.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright (C) Viktor Szakats. See LICENSE.md
2+
# SPDX-License-Identifier: curl
3+
4+
# https://docs.github.com/code-security/dependabot/working-with-dependabot/dependabot-options-reference
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: 'github-actions'
9+
directory: '/'
10+
schedule:
11+
interval: 'quarterly'
12+
cooldown:
13+
default-days: 30
14+
groups:
15+
actions-deps:
16+
patterns:
17+
- '*'
18+
19+
- package-ecosystem: 'pip'
20+
directories:
21+
- '.github/workflows'
22+
schedule:
23+
interval: 'quarterly'
24+
cooldown:
25+
default-days: 7
26+
semver-major-days: 15
27+
semver-minor-days: 7
28+
semver-patch-days: 3

.github/workflows/requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (C) Viktor Szakats. See LICENSE.md
2+
# SPDX-License-Identifier: curl
3+
4+
codespell==2.4.1
5+
reuse==6.1.2

.github/workflows/reuse.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 66 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,40 +38,82 @@ concurrency:
3838
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
3939
cancel-in-progress: true
4040

41+
permissions: {}
42+
4143
jobs:
4244
lint:
45+
name: lint
4346
runs-on: ubuntu-latest
4447
steps:
4548
- name: Checkout repository
46-
uses: actions/checkout@v4
49+
uses: actions/checkout@v5
50+
with:
51+
persist-credentials: false
4752

4853
- name: Install tools
4954
run: |
50-
sudo apt-get update
51-
sudo apt-get install -y shellcheck devscripts shfmt
55+
/home/linuxbrew/.linuxbrew/bin/brew install zizmor shellcheck checkbashisms shfmt typos-cli
56+
python3 -m venv ~/venv
57+
~/venv/bin/pip --disable-pip-version-check --no-input --no-cache-dir install --progress-bar off --prefer-binary \
58+
-r .github/workflows/requirements.txt
59+
60+
- name: 'REUSE check'
61+
run: |
62+
source ~/venv/bin/activate
63+
reuse lint
64+
65+
- name: Run zizmor
66+
env:
67+
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
68+
run: |
69+
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
70+
zizmor --pedantic .github/workflows/*.yml
5271
5372
- name: Run shellcheck
54-
run: shellcheck wcurl tests/*
73+
run: |
74+
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
75+
shellcheck --version
76+
shellcheck $(grep -l '^#!/bin/sh' $(git ls-files))
5577
5678
- name: Run checkbashisms
57-
run: checkbashisms wcurl tests/*
79+
run: |
80+
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
81+
checkbashisms --version
82+
checkbashisms $(grep -l '^#!/bin/sh' $(git ls-files))
5883
5984
- name: Run shfmt
60-
run: shfmt --func-next-line --space-redirects --case-indent --binary-next-line --indent 4 --posix --diff .
85+
run: |
86+
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
87+
shfmt --version
88+
shfmt --func-next-line --space-redirects --case-indent --binary-next-line --indent 4 --posix --diff .
89+
90+
- name: Run codespell
91+
run: |
92+
source ~/venv/bin/activate
93+
codespell --version
94+
codespell
95+
96+
- name: Run typos
97+
run: |
98+
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
99+
typos --version
100+
typos
61101
62102
debian:
63103
name: debian
64104
runs-on: ubuntu-latest
65105
container:
66-
image: debian:stable
106+
image: debian:stable # zizmor: ignore[unpinned-images]
67107
steps:
68-
- name: Checkout repository
69-
uses: actions/checkout@v4
70-
71108
- name: Install curl and shunit2
72109
run: |
73-
apt-get update
74-
apt-get install -y curl shunit2
110+
apt-get -o Dpkg::Use-Pty=0 update
111+
apt-get -o Dpkg::Use-Pty=0 install -y --no-install-suggests --no-install-recommends curl shunit2
112+
113+
- name: Checkout repository
114+
uses: actions/checkout@v5
115+
with:
116+
persist-credentials: false
75117

76118
- name: Run shunit2 tests
77119
run: ./tests/tests.sh
@@ -80,11 +122,8 @@ jobs:
80122
name: fedora
81123
runs-on: ubuntu-latest
82124
container:
83-
image: fedora:latest
125+
image: fedora:latest # zizmor: ignore[unpinned-images]
84126
steps:
85-
- name: Checkout repository
86-
uses: actions/checkout@v4
87-
88127
- name: Install git and shunit2
89128
run: |
90129
dnf install -y git
@@ -94,18 +133,25 @@ jobs:
94133
cd shunit2
95134
cp shunit2 /usr/local/bin/shunit2
96135
136+
- name: Checkout repository
137+
uses: actions/checkout@v5
138+
with:
139+
persist-credentials: false
140+
97141
- name: Run shunit2 tests
98142
run: ./tests/tests.sh
99143

100144
macos:
101145
name: macos
102146
runs-on: macos-latest
103147
steps:
104-
- name: Checkout repository
105-
uses: actions/checkout@v4
106-
107148
- name: Install shunit2
108-
run: brew install shunit2
149+
run: HOMEBREW_NO_AUTO_UPDATE=1 brew install shunit2
150+
151+
- name: Checkout repository
152+
uses: actions/checkout@v5
153+
with:
154+
persist-credentials: false
109155

110156
- name: Run shunit2 tests
111157
run: ./tests/tests.sh

0 commit comments

Comments
 (0)