Skip to content

Commit d84d919

Browse files
authored
Add more and fix linting (#259)
2 parents c55f849 + 5efdec4 commit d84d919

File tree

49 files changed

+174
-84
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+174
-84
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Docker images
33

44
on: [push, pull_request, workflow_dispatch]
55

6+
permissions: {}
7+
68
concurrency:
79
group: ${{ github.workflow }}-${{ github.ref }}
810
cancel-in-progress: true
@@ -75,7 +77,7 @@ jobs:
7577
git submodule update --remote Pillow
7678
fi
7779
(cd Pillow && git checkout main)
78-
sudo chown -R 1001 $(pwd)
80+
sudo chown -R 1001 "$(pwd)"
7981
8082
- name: Test Image Build
8183
if: "matrix.test-image"
@@ -91,7 +93,7 @@ jobs:
9193
run: |
9294
cd "${{ matrix.image }}" && sudo chmod a+w . && make update
9395
if [[ -n "$DOCKER_USERNAME" ]]; then
94-
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin && echo "logged_in=true" >> $GITHUB_OUTPUT
96+
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin && echo "logged_in=true" >> "$GITHUB_OUTPUT"
9597
fi
9698
make build BRANCH=main
9799
env:
@@ -120,7 +122,7 @@ jobs:
120122

121123
- name: Post build
122124
if: always()
123-
run: sudo chown -R $(id -u) $(pwd)
125+
run: sudo chown -R "$(id -u)" "$(pwd)"
124126

125127
success:
126128
needs: build

.github/workflows/lint.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Lint
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
permissions: {}
6+
7+
env:
8+
FORCE_COLOR: 1
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
lint:
16+
name: Lint
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v6
20+
with:
21+
persist-credentials: false
22+
- uses: j178/prek-action@v1

.github/zizmor.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# https://docs.zizmor.sh/configuration/
2+
rules:
3+
unpinned-uses:
4+
config:
5+
policies:
6+
"*": ref-pin

.hadolint.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ignored:
2+
- DL3003 # Use WORKDIR to switch to a directory
3+
- DL3006 # Always tag the version of an image explicitly
4+
- DL3007 # Using latest is prone to errors
5+
- DL3008 # Pin versions in apt-get install
6+
- DL3013 # Pin versions in pip
7+
- DL3018 # Pin versions in apk add
8+
- DL3033 # Pin versions in yum install
9+
- DL3041 # Pin versions in dnf install
10+
- DL3059 # Multiple consecutive RUN instructions
11+
- SC2016 # Expressions don't expand in single quotes

.pre-commit-config.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,40 @@ repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
33
rev: v6.0.0
44
hooks:
5+
- id: check-added-large-files
6+
- id: check-case-conflict
57
- id: check-merge-conflict
68
- id: check-json
79
- id: check-yaml
10+
- id: end-of-file-fixer
11+
- id: trailing-whitespace
12+
13+
- repo: https://github.com/python-jsonschema/check-jsonschema
14+
rev: 0.36.2
15+
hooks:
16+
- id: check-github-workflows
17+
- id: check-renovate
18+
19+
- repo: https://github.com/rhysd/actionlint
20+
rev: v1.7.11
21+
hooks:
22+
- id: actionlint
23+
24+
- repo: https://github.com/zizmorcore/zizmor-pre-commit
25+
rev: v1.22.0
26+
hooks:
27+
- id: zizmor
28+
29+
- repo: https://github.com/AleksaC/hadolint-py
30+
rev: v2.14.0
31+
hooks:
32+
- id: hadolint
33+
exclude: ^archive/
34+
35+
- repo: meta
36+
hooks:
37+
- id: check-hooks-apply
38+
- id: check-useless-excludes
839

940
ci:
1041
autoupdate_schedule: quarterly

Makefile.sub

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,3 @@ clean:
3434
.PHONY: shell
3535
shell:
3636
docker run --rm -it -v $(ROOT):/Pillow $(IMAGENAME):$(BRANCH) /bin/bash
37-

alpine/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ RUN apk --no-cache add \
3535
tk-dev \
3636
zlib-dev
3737

38-
ADD depends /depends
38+
COPY depends /depends
3939
RUN cd /depends \
4040
&& ./install_webp.sh \
4141
&& ./install_raqm.sh

alpine/update.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
#!/bin/sh
22
docker pull alpine
3-
4-

amazon-2-amd64/Dockerfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
FROM amazonlinux:2
22

3+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
4+
35
RUN yum install -y \
46
cmake \
5-
curl \
67
findutils \
78
fribidi-devel \
89
gcc \
@@ -30,20 +31,20 @@ RUN yum install -y \
3031
zlib-devel \
3132
&& yum clean all
3233

33-
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
34+
RUN wget -qO- https://sh.rustup.rs | sh -s -- -y
3435
ENV PATH="/root/.cargo/bin:${PATH}"
3536

3637
RUN useradd --uid 1001 pillow
3738

38-
ADD depends /depends
39+
COPY depends /depends
3940
RUN cd /depends \
4041
&& ./install_imagequant.sh
4142

4243
RUN yum remove -y openssl-devel && \
4344
yum install -y openssl11-devel && \
4445
yum clean all
4546

46-
RUN wget https://www.python.org/ftp/python/3.10.18/Python-3.10.18.tgz \
47+
RUN wget --no-verbose https://www.python.org/ftp/python/3.10.18/Python-3.10.18.tgz \
4748
&& tar xzf Python-3.10.18.tgz \
4849
&& cd Python-3.10.18 \
4950
&& ./configure \
@@ -61,10 +62,10 @@ RUN bash -c "python3.10 -m pip install virtualenv \
6162
&& /vpy3/bin/pip install numpy --only-binary=:all: || true \
6263
&& chown -R pillow:pillow /vpy3"
6364

64-
RUN wget https://github.com/ninja-build/ninja/releases/download/v1.13.2/ninja-linux.zip \
65+
RUN wget --no-verbose https://github.com/ninja-build/ninja/releases/download/v1.13.2/ninja-linux.zip \
6566
&& unzip ninja-linux.zip \
6667
&& mv ninja /usr/bin
67-
RUN python3.10 -m pip install meson
68+
RUN python3.10 -m pip install --no-cache-dir meson
6869
RUN ln -s /usr/local/bin/python3.10 /usr/bin/python3
6970
RUN cd /depends \
7071
&& ./install_openjpeg.sh \

amazon-2023-amd64/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
FROM amazonlinux:2023
22

3+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
4+
35
RUN yum install -y \
46
cmake \
57
findutils \
@@ -33,7 +35,7 @@ RUN yum install -y \
3335
zlib-devel \
3436
&& yum clean all
3537

36-
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
38+
RUN wget -qO- https://sh.rustup.rs | sh -s -- -y
3739
ENV PATH="/root/.cargo/bin:${PATH}"
3840

3941
RUN useradd --uid 1001 pillow
@@ -48,8 +50,8 @@ RUN bash -c "/usr/bin/python3.11 -m pip install virtualenv \
4850
&& /vpy3/bin/pip install numpy --only-binary=:all: || true \
4951
&& chown -R pillow:pillow /vpy3"
5052

51-
ADD depends /depends
52-
RUN wget https://github.com/ninja-build/ninja/releases/download/v1.13.2/ninja-linux.zip \
53+
COPY depends /depends
54+
RUN wget --no-verbose https://github.com/ninja-build/ninja/releases/download/v1.13.2/ninja-linux.zip \
5355
&& unzip ninja-linux.zip \
5456
&& mv ninja /usr/bin
5557
RUN /usr/bin/python3.11 -m pip install meson

0 commit comments

Comments
 (0)