Skip to content

Commit 6f56006

Browse files
committed
upd: use UV
1 parent b850377 commit 6f56006

6 files changed

Lines changed: 439 additions & 699 deletions

File tree

.github/workflows/docker_auto.yml

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

.github/workflows/main.yml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
push:
7+
branches: [master]
8+
9+
jobs:
10+
pre-commit:
11+
runs-on: ubuntu-latest
12+
env:
13+
DEBIAN_FRONTEND: noninteractive
14+
PYTHONDONTWRITEBYTECODE: 1
15+
PYTHONUNBUFFERED: 1
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
- name: Switch to current branch
22+
run: git checkout ${{ env.BRANCH }}
23+
- name: "Set up Python"
24+
uses: actions/setup-python@v6
25+
with:
26+
python-version-file: "pyproject.toml"
27+
- name: Restore pre-commit cache
28+
uses: actions/cache@v5
29+
with:
30+
path: ~/.cache/pre-commit
31+
key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
32+
restore-keys: |
33+
pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
34+
pre-commit-${{ runner.os }}
35+
- uses: pre-commit/action@v3.0.1
36+
37+
pytest:
38+
strategy:
39+
matrix:
40+
odoo_version: ["6.0", "6.1", "7.0", "8.0", "9.0", "10.0", "11.0", "12.0", "13.0", "14.0", "15.0", "16.0", "17.0", "18.0", "19.0"]
41+
fail-fast: false
42+
runs-on: ubuntu-latest
43+
needs: pre-commit
44+
env:
45+
DEBIAN_FRONTEND: noninteractive
46+
PYTHONDONTWRITEBYTECODE: 1
47+
PYTHONUNBUFFERED: 1
48+
49+
steps:
50+
- uses: actions/checkout@v4
51+
with:
52+
fetch-depth: 0
53+
- name: Switch to current branch
54+
run: git checkout ${{ env.BRANCH }}
55+
- name: "Set up Python"
56+
uses: actions/setup-python@v6
57+
with:
58+
python-version-file: "pyproject.toml"
59+
- name: Install uv
60+
uses: astral-sh/setup-uv@v7
61+
- name: Restore uv cache
62+
uses: actions/cache@v5
63+
with:
64+
path: /tmp/.uv-cache
65+
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
66+
restore-keys: |
67+
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
68+
uv-${{ runner.os }}
69+
- name: Install the project
70+
run: uv sync --locked --all-extras --dev
71+
- name: Run pytest
72+
run: uv run pytest --odoo-version ${{ matrix.odoo_version }} --no-cache -v
73+
- name: Minimize uv cache
74+
run: uv cache prune --ci
75+
76+
build-and-push:
77+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
78+
runs-on: ubuntu-latest
79+
needs: pytest
80+
permissions:
81+
contents: read
82+
packages: write
83+
attestations: write
84+
id-token: write
85+
86+
strategy:
87+
matrix:
88+
version: ["6.0", "6.1", "7.0", "8.0", "9.0", "10.0", "11.0", "12.0", "13.0", "14.0", "15.0", "16.0", "17.0", "18.0", "19.0"]
89+
90+
steps:
91+
- name: Checkout
92+
uses: actions/checkout@v6
93+
94+
- name: Docker meta
95+
id: meta
96+
uses: docker/metadata-action@v5
97+
with:
98+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
99+
tags: |
100+
type=raw,value=${{ matrix.version }}
101+
type=raw,value=latest,enable=${{ matrix.version == env.LATEST_VERSION }}
102+
labels: |
103+
org.opencontainers.image.title=Odoo ${{ matrix.version }}
104+
org.opencontainers.image.description=Odoo Community ${{ matrix.version }} - isOdoo Image
105+
org.opencontainers.image.source=https://github.com/${{ github.repository }}
106+
org.opencontainers.image.vendor=GrupoIsonor
107+
odoo.version=${{ matrix.version }}
108+
109+
- name: Login to GHCR
110+
uses: docker/login-action@v3
111+
with:
112+
registry: ${{ env.REGISTRY }}
113+
username: ${{ github.actor }}
114+
password: ${{ secrets.GITHUB_TOKEN }}
115+
116+
- name: Build & Push
117+
id: build-and-push
118+
uses: docker/build-push-action@v6
119+
with:
120+
context: .
121+
file: ./${{ matrix.version }}.Dockerfile
122+
push: true
123+
tags: ${{ steps.meta.outputs.tags }}
124+
labels: ${{ steps.meta.outputs.labels }}
125+
cache-from: type=gha
126+
cache-to: type=gha,mode=max
127+
128+
- name: Attest build provenance
129+
uses: actions/attest-build-provenance@v2
130+
with:
131+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
132+
subject-digest: ${{ steps.build-and-push.outputs.digest }}
133+
push-to-registry: true

.github/workflows/test.yml

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

0 commit comments

Comments
 (0)