Skip to content

Commit c78bf4c

Browse files
authored
chore: Upgrade ci pipeline (#157)
- upgrade actions used in Github workflow - upgrade python version from 3.11 to 3.12 (in Dockerfile) and 3.7 to 3.12 (in workflow) - replace `docker-compose` with `docker compose` - remove obsolete `version` in dockerfile fixes #154
1 parent e1b1a51 commit c78bf4c

16 files changed

+41
-46
lines changed

.github/workflows/autoblack.yml

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
# GitHub Action that uses Black to reformat the Python code in an incoming pull request.
42
# If all Python code in the pull request is compliant with Black then this Action does nothing.
53
# Otherwise, Black is run and its changes are committed back to the incoming pull request.
@@ -11,13 +9,13 @@ jobs:
119
black:
1210
runs-on: ubuntu-latest
1311
steps:
14-
- uses: actions/checkout@v3
15-
- name: Set up Python 3.7
16-
uses: actions/setup-python@v3
12+
- uses: actions/checkout@v4
13+
- name: Set up Python 3.12
14+
uses: actions/setup-python@v5
1715
with:
18-
python-version: 3.7
16+
python-version: 3.12
1917
- name: Install Black
20-
run: pip install black==21.12b0 click==7.1.2
18+
run: pip install black==25.1.0 click==8.1.8
2119
- name: Run black --check .
2220
run: black --check .
2321
- name: If needed, commit black changes to the pull request

.github/workflows/codeql-analysis.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
steps:
1515
- name: Checkout repository
16-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
1717
with:
1818
# We must fetch at least the immediate parents so that if this is
1919
# a pull request then we can checkout the head.
@@ -26,15 +26,15 @@ jobs:
2626

2727
# Initializes the CodeQL tools for scanning.
2828
- name: Initialize CodeQL
29-
uses: github/codeql-action/init@v1
29+
uses: github/codeql-action/init@v3
3030
# Override language selection by uncommenting this and choosing your languages
3131
# with:
3232
# languages: go, javascript, csharp, python, cpp, java
3333

3434
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
3535
# If this step fails, then you should remove it and run the build manually (see below)
3636
- name: Autobuild
37-
uses: github/codeql-action/autobuild@v1
37+
uses: github/codeql-action/autobuild@v3
3838

3939
# ℹ️ Command-line programs to run using the OS shell.
4040
# 📚 https://git.io/JvXDl
@@ -48,4 +48,4 @@ jobs:
4848
# make release
4949

5050
- name: Perform CodeQL Analysis
51-
uses: github/codeql-action/analyze@v1
51+
uses: github/codeql-action/analyze@v3

.github/workflows/container-build.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,26 @@ jobs:
1212
build:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v4
1616
with:
1717
fetch-depth: 1
1818

1919
- name: Set up Docker Buildx
20-
uses: docker/setup-buildx-action@v1
20+
uses: docker/setup-buildx-action@v3
2121
with:
22-
version: v0.6.0
22+
version: v0.21.2
2323
buildkitd-flags: --debug
2424

2525
- name: Login to DockerHub
26-
uses: docker/login-action@v1
26+
uses: docker/login-action@v3
2727
with:
2828
registry: ghcr.io
2929
username: ${{ github.actor }}
3030
password: ${{ secrets.GITHUB_TOKEN }}
3131

3232
- name: Docker meta
3333
id: meta
34-
uses: docker/metadata-action@v3
34+
uses: docker/metadata-action@v5
3535
with:
3636
images: |
3737
ghcr.io/${{ github.repository }}
@@ -42,7 +42,7 @@ jobs:
4242
type=sha,format=long
4343
4444
- name: Build and push
45-
uses: docker/build-push-action@v2
45+
uses: docker/build-push-action@v6
4646
with:
4747
context: .
4848
push: true

.github/workflows/crowdin.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
steps:
1313

1414
- name: Checkout
15-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1616

1717
- name: crowdin action
18-
uses: crowdin/github-action@1.4.10
18+
uses: crowdin/github-action@v2
1919
with:
2020
upload_translations: true # default is false
2121
# Use this option to upload translations for a single specified language

.github/workflows/generate-docs.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ jobs:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: Check out the repo
23-
uses: actions/checkout@v2
24-
- uses: actions/setup-python@v2
23+
uses: actions/checkout@v4
24+
- uses: actions/setup-python@v5
2525
with:
2626
python-version: 3.x
2727
- name: Install mkdocs requirements

.github/workflows/label.yml

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
pull-requests: write
1818

1919
steps:
20+
- uses: actions/checkout@v4
2021
- uses: actions/labeler@v4
2122
with:
2223
repo-token: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/pull_request.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ jobs:
1313
# check-out repo and set-up python
1414
#----------------------------------------------
1515
- name: Check out repository
16-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
1717
- name: build docker
1818
run: |
1919
export USER_UID=$(id -u)
2020
export USER_GID=$(id -g)
21-
DOCKER_BUILDKIT=1 docker-compose build
21+
DOCKER_BUILDKIT=1 docker compose build
2222
- name: build languages
2323
run: make build_lang
2424
- name: Make checks

.github/workflows/semantic-pr.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ jobs:
1212
name: Validate PR title
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: amannn/action-semantic-pull-request@v4
15+
- uses: amannn/action-semantic-pull-request@v5
1616
env:
1717
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
ARG USER_UID=1000
44
ARG USER_GID=1000
55

6-
FROM python:3.11
6+
FROM python:3.12
77

88
# install gettext-tools
99
RUN apt-get update && apt-get -y install gettext

Makefile

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
# buildkit is more efficient
44
DOCKER_BUILDKIT=1
5-
DOCKER_RUN=docker-compose run --rm --no-deps facets-api
5+
DOCKER_COMPOSE=docker compose
6+
DOCKER_RUN=${DOCKER_COMPOSE} run --rm --no-deps facets-api
67

78

89
build:
9-
docker-compose build
10+
${DOCKER_COMPOSE} build
1011

1112
up:
12-
docker-compose up
13+
${DOCKER_COMPOSE} up
1314

1415
# recompile languages files
1516
build_lang:

app/i18n.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""i18n handling
2-
"""
1+
"""i18n handling"""
32

43
import contextlib
54
import contextvars

app/main.py

+11-9
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,17 @@
2525
"description": "Render html based on knowledge panels.",
2626
},
2727
]
28-
description = """
29-
Providing knowledge panels for a particular Open Food Facts facet (category, brand, etc...)
30-
31-
A standardized way for clients to get semi-structured but generic data that they can present
32-
to users on product pages.
33-
You can contribute at https://github.com/openfoodfacts/facets-knowledge-panels
34-
You should also read https://openfoodfacts.github.io/openfoodfacts-server/api/explain-knowledge-panels/
35-
for the Product Page knowledge panels which follow the same syntax (the docs provides a conceptual overview).
36-
""" # noqa: E501
28+
description = (
29+
"Providing knowledge panels for a particular Open Food Facts facet "
30+
"(category, brand, etc...)\n\n"
31+
"A standardized way for clients to get semi-structured "
32+
"but generic data that they can present to users on product pages.\n"
33+
"You can contribute at https://github.com/openfoodfacts/facets-knowledge-panels\n"
34+
"You should also read "
35+
"https://openfoodfacts.github.io/openfoodfacts-server/api/explain-knowledge-panels/ "
36+
"for the Product Page knowledge panels "
37+
"which follow the same syntax (the docs provides a conceptual overview)."
38+
) # noqa: E501
3739

3840
app = FastAPI(
3941
title="Open Food Facts knowledge Panels API",

docker-compose.yml

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3'
2-
31
services:
42
facets-api:
53
image: ghcr.io/openfoodfacts/facets-knowledge-panels:${TAG:-dev}

docker/dev.yml

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3'
2-
31
services:
42
facets-api:
53
build:

docker/prod.yml

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3'
2-
31
services:
42
facets-api:
53
environment:

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ openfoodfacts==0.1.5
1515
prometheus-fastapi-instrumentator==6.1.0
1616

1717
# dev
18-
black==24.3.0
18+
black==25.1.0
1919
pytest==7.4.0
2020
pytest-mock==3.11.1
2121
pytest-asyncio==0.21.1

0 commit comments

Comments
 (0)