@@ -3,147 +3,90 @@ name: ci
33on :
44 push :
55 branches : [main, develop]
6- pull_request_target :
7- types : [assigned, opened, synchronize, reopened]
8-
9- env :
10- REGISTRY : ghcr.io
6+ pull_request :
7+ types : [opened, synchronize, reopened]
118
129jobs :
13- setup :
14- runs-on : ubuntu-latest
15- outputs :
16- ci_name_ref_slug : ${{ steps.set_env.outputs.ci_name_ref_slug }}
17- image_name : ${{ steps.set_env.outputs.image_name }}
18- steps :
19- - uses : FranzDiebold/github-env-vars-action@v2
20- - name : Generate global env vars
21- id : set_env
22- run : |
23- echo "::set-output name=ci_name_ref_slug::$CI_REF_NAME_SLUG"
24- echo "::set-output name=image_name::$REGISTRY/$CI_REPOSITORY_OWNER_SLUG/$CI_REPOSITORY_NAME_SLUG"
25-
26- build :
27- needs : [setup]
10+ style :
2811 runs-on : ubuntu-latest
29-
30- permissions :
31- contents : read
32- packages : write
33-
3412 steps :
3513 - name : Checkout
36- uses : actions/checkout@v3
37- if : ${{ github.event_name == 'push' }}
38-
39- - name : Checkout
40- uses : actions/checkout@v3
41- if : ${{ github.event_name == 'pull_request_target' }}
42- with :
43- ref : ${{ github.event.pull_request.head.sha }}
44-
45- - name : Set up Docker Buildx
46- id : buildx
47- uses : docker/setup-buildx-action@v2
48- with :
49- install : true
50-
51- - name : Log in to the Container registry
52- uses : docker/login-action@v2
53- with :
54- registry : ${{ env.REGISTRY }}
55- username : ${{ github.actor }}
56- password : ${{ secrets.GITHUB_TOKEN }}
57-
58- - name : Extract metadata (tags, labels) for Docker
59- id : meta
60- uses : docker/metadata-action@v4
61- with :
62- images : ${{ needs.setup.outputs.image_name }}
63-
64- # - name: Build and push Docker image
65- # uses: docker/build-push-action@v3
66- # with:
67- # context: .
68- # file: dev.Dockerfile
69- # push: true
70- # tags: ${{ steps.meta.outputs.tags }}
71- # labels: ${{ steps.meta.outputs.labels }}
72- # cache-from: type=gha
73- # cache-to: type=gha,mode=max
74-
75- - name : Build and push test Docker image
76- uses : docker/build-push-action@v4
77- with :
78- context : .
79- file : dev.Dockerfile
80- push : true
81- target : test-image
82- tags : " ${{ needs.setup.outputs.image_name }}/test:${{ github.sha }},${{ needs.setup.outputs.image_name }}/test:${{ needs.setup.outputs.ci_name_ref_slug }}"
83- labels : ${{ steps.meta.outputs.labels }}
84- cache-from : type=gha
85- cache-to : type=gha,mode=max
14+ uses : actions/checkout@v4
8615
87- - name : Build and push tool Docker image
88- uses : docker/build-push-action@v4
16+ - name : Set up Python
17+ uses : actions/setup-python@v5
8918 with :
90- context : .
91- file : tool.Dockerfile
92- push : true
93- tags : " ${{ needs.setup.outputs.image_name }}/tool:${{ github.sha }},${{ needs.setup.outputs.image_name }}/tool:${{ needs.setup.outputs.ci_name_ref_slug }}"
94- labels : ${{ steps.meta.outputs.labels }}
95- cache-from : type=gha
96- cache-to : type=gha,mode=max
19+ python-version : ' 3.11'
9720
98- style :
99- needs : [build]
100- runs-on : ubuntu-latest
101- container :
102- image : ghcr.io/${{ github.repository_owner }}/qdax/tool:${{ github.sha }}
103- credentials :
104- username : ${{ github.actor }}
105- password : ${{ secrets.GITHUB_TOKEN }}
106-
107- steps :
108- - name : Checkout
109- uses : actions/checkout@v3
110- if : ${{ github.event_name == 'push' }}
21+ - name : Install system dependencies
22+ run : |
23+ sudo apt-get update
24+ sudo apt-get install -y --no-install-recommends \
25+ ffmpeg \
26+ libgl1-mesa-dev \
27+ libgl1-mesa-glx \
28+ libglfw3 \
29+ libosmesa6-dev \
30+ patchelf \
31+ python3-opengl \
32+ xvfb
33+
34+ - name : Install uv
35+ run : |
36+ curl -LsSf https://astral.sh/uv/install.sh | sh
37+ echo "/home/runner/.local/bin" >> $GITHUB_PATH
11138
112- - name : Checkout
113- uses : actions/checkout@v3
114- if : ${{ github.event_name == 'pull_request_target' }}
115- with :
116- ref : ${{ github.event.pull_request.head.sha }}
39+ - name : Install project (dev)
40+ run : |
41+ uv pip install .[dev]
11742
118- - name : Run pre-commits
43+ - name : Run pre-commit
11944 run : |
12045 git config --global --add safe.directory $GITHUB_WORKSPACE
121- pre-commit run --all-files
46+ pre-commit run --all-files --show-diff-on-failure
12247
12348 tests :
124- needs : [build]
12549 runs-on : ubuntu-latest
126- container :
127- image : ghcr.io/${{ github.repository_owner }}/qdax/test:${{ github.sha }}
128- credentials :
129- username : ${{ github.actor }}
130- password : ${{ secrets.GITHUB_TOKEN }}
131-
50+ strategy :
51+ matrix :
52+ python-version : ['3.11', '3.12', '3.13']
13253 steps :
13354 - name : Checkout
134- uses : actions/checkout@v3
135- if : ${{ github.event_name == 'push' }}
55+ uses : actions/checkout@v4
13656
137- - name : Checkout
138- uses : actions/checkout@v3
139- if : ${{ github.event_name == 'pull_request_target' }}
57+ - name : Set up Python
58+ uses : actions/setup-python@v5
14059 with :
141- ref : ${{ github.event.pull_request.head.sha }}
60+ python-version : ${{ matrix.python-version }}
14261
143- - name : Run pytests
62+ - name : Install system dependencies
63+ run : |
64+ sudo apt-get update
65+ sudo apt-get install -y --no-install-recommends \
66+ ffmpeg \
67+ libgl1-mesa-dev \
68+ libgl1-mesa-glx \
69+ libglfw3 \
70+ libosmesa6-dev \
71+ patchelf \
72+ python3-opengl \
73+ xvfb
74+
75+ - name : Install uv
76+ run : |
77+ curl -LsSf https://astral.sh/uv/install.sh | sh
78+ echo "/home/runner/.local/bin" >> $GITHUB_PATH
79+
80+ - name : Install project (dev + examples)
81+ run : |
82+ uv pip install .[dev,examples]
83+
84+ - name : Run tests (coverage)
14485 run : |
14586 coverage run -m pytest -vv tests
14687 coverage xml
14788
14889 - name : Upload Coverage to Codecov
149- uses : codecov/codecov-action@v2
90+ uses : codecov/codecov-action@v4
91+ with :
92+ token : ${{ secrets.CODECOV_TOKEN }}
0 commit comments