|
1 | | -# name: ci |
2 | | -# |
3 | | -# on: |
4 | | -# push: |
5 | | -# branches: [main, develop] |
6 | | -# pull_request_target: |
7 | | -# types: [assigned, opened, synchronize, reopened] |
8 | | -# |
9 | | -# env: |
10 | | -# REGISTRY: ghcr.io |
11 | | -# |
12 | | -# jobs: |
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 | | -# build: |
26 | | -# needs: [setup] |
27 | | -# runs-on: ubuntu-latest |
28 | | -# permissions: |
29 | | -# contents: read |
30 | | -# packages: write |
31 | | -# steps: |
32 | | -# - name: Checkout |
33 | | -# uses: actions/checkout@v3 |
34 | | -# if: ${{ github.event_name == 'push' }} |
35 | | -# - name: Checkout |
36 | | -# uses: actions/checkout@v3 |
37 | | -# if: ${{ github.event_name == 'pull_request_target' }} |
38 | | -# with: |
39 | | -# ref: ${{ github.event.pull_request.head.sha }} |
40 | | -# - name: Set up Docker Buildx |
41 | | -# id: buildx |
42 | | -# uses: docker/setup-buildx-action@v2 |
43 | | -# with: |
44 | | -# install: true |
45 | | -# - name: Log in to the Container registry |
46 | | -# uses: docker/login-action@v2 |
47 | | -# with: |
48 | | -# registry: ${{ env.REGISTRY }} |
49 | | -# username: ${{ github.actor }} |
50 | | -# password: ${{ secrets.GITHUB_TOKEN }} |
51 | | -# - name: Extract metadata (tags, labels) for Docker |
52 | | -# id: meta |
53 | | -# uses: docker/metadata-action@v4 |
54 | | -# with: |
55 | | -# images: ${{ needs.setup.outputs.image_name }} |
56 | | -# - name: Build and push test Docker image |
57 | | -# uses: docker/build-push-action@v4 |
58 | | -# with: |
59 | | -# context: . |
60 | | -# file: dev.Dockerfile |
61 | | -# push: true |
62 | | -# target: test-image |
63 | | -# tags: "${{ needs.setup.outputs.image_name }}/test:${{ github.sha }},${{ needs.setup.outputs.image_name }}/test:${{ needs.setup.outputs.ci_name_ref_slug }}" |
64 | | -# labels: ${{ steps.meta.outputs.labels }} |
65 | | -# cache-from: type=gha |
66 | | -# cache-to: type=gha,mode=max |
67 | | -# - name: Build and push tool Docker image |
68 | | -# uses: docker/build-push-action@v4 |
69 | | -# with: |
70 | | -# context: . |
71 | | -# file: tool.Dockerfile |
72 | | -# push: true |
73 | | -# tags: "${{ needs.setup.outputs.image_name }}/tool:${{ github.sha }},${{ needs.setup.outputs.image_name }}/tool:${{ needs.setup.outputs.ci_name_ref_slug }}" |
74 | | -# labels: ${{ steps.meta.outputs.labels }} |
75 | | -# cache-from: type=gha |
76 | | -# cache-to: type=gha,mode=max |
77 | | -# style: |
78 | | -# needs: [build] |
79 | | -# runs-on: ubuntu-latest |
80 | | -# container: |
81 | | -# image: ghcr.io/${{ github.repository_owner }}/qdax/tool:${{ github.sha }} |
82 | | -# credentials: |
83 | | -# username: ${{ github.actor }} |
84 | | -# password: ${{ secrets.GITHUB_TOKEN }} |
85 | | -# steps: |
86 | | -# - name: Checkout |
87 | | -# uses: actions/checkout@v3 |
88 | | -# if: ${{ github.event_name == 'push' }} |
89 | | -# - name: Checkout |
90 | | -# uses: actions/checkout@v3 |
91 | | -# if: ${{ github.event_name == 'pull_request_target' }} |
92 | | -# with: |
93 | | -# ref: ${{ github.event.pull_request.head.sha }} |
94 | | -# - name: Run pre-commits |
95 | | -# run: | |
96 | | -# git config --global --add safe.directory $GITHUB_WORKSPACE |
97 | | -# pre-commit run --all-files |
98 | | -# tests: |
99 | | -# needs: [build] |
100 | | -# runs-on: ubuntu-latest |
101 | | -# container: |
102 | | -# image: ghcr.io/${{ github.repository_owner }}/qdax/test:${{ github.sha }} |
103 | | -# credentials: |
104 | | -# username: ${{ github.actor }} |
105 | | -# password: ${{ secrets.GITHUB_TOKEN }} |
106 | | -# steps: |
107 | | -# - name: Checkout |
108 | | -# uses: actions/checkout@v3 |
109 | | -# if: ${{ github.event_name == 'push' }} |
110 | | -# - name: Checkout |
111 | | -# uses: actions/checkout@v3 |
112 | | -# if: ${{ github.event_name == 'pull_request_target' }} |
113 | | -# with: |
114 | | -# ref: ${{ github.event.pull_request.head.sha }} |
115 | | -# - name: Run pytests |
116 | | -# run: | |
117 | | -# coverage run -m pytest -vv tests |
118 | | -# coverage xml |
119 | | -# - name: Upload Coverage to Codecov |
120 | | -# uses: codecov/codecov-action@v2 |
| 1 | +name: ci |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, develop] |
| 6 | + pull_request: |
| 7 | + types: [opened, synchronize, reopened] |
| 8 | + |
| 9 | +jobs: |
| 10 | + style: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - name: Checkout |
| 14 | + uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Set up Python |
| 17 | + uses: actions/setup-python@v5 |
| 18 | + with: |
| 19 | + python-version: "3.13" |
| 20 | + |
| 21 | + - name: Install uv |
| 22 | + run: | |
| 23 | + curl -LsSf https://astral.sh/uv/install.sh | sh |
| 24 | + echo "/home/runner/.local/bin" >> $GITHUB_PATH |
| 25 | +
|
| 26 | + - name: Install project (dev) |
| 27 | + run: | |
| 28 | + uv pip install --system .[dev] |
| 29 | +
|
| 30 | + - name: Run pre-commit |
| 31 | + run: | |
| 32 | + git config --global --add safe.directory $GITHUB_WORKSPACE |
| 33 | + pre-commit run --all-files --show-diff-on-failure |
| 34 | +
|
| 35 | + tests: |
| 36 | + runs-on: ubuntu-latest |
| 37 | + strategy: |
| 38 | + matrix: |
| 39 | + python-version: ['3.11', '3.12', '3.13'] |
| 40 | + steps: |
| 41 | + - name: Checkout |
| 42 | + uses: actions/checkout@v4 |
| 43 | + |
| 44 | + - name: Set up Python |
| 45 | + uses: actions/setup-python@v5 |
| 46 | + with: |
| 47 | + python-version: ${{ matrix.python-version }} |
| 48 | + |
| 49 | + - name: Install uv |
| 50 | + run: | |
| 51 | + curl -LsSf https://astral.sh/uv/install.sh | sh |
| 52 | + echo "/home/runner/.local/bin" >> $GITHUB_PATH |
| 53 | +
|
| 54 | + - name: Install project (dev + examples) |
| 55 | + run: | |
| 56 | + uv pip install --system .[dev,examples] |
| 57 | +
|
| 58 | + - name: Run tests (coverage) |
| 59 | + run: | |
| 60 | + coverage run -m pytest -vv tests |
| 61 | + coverage xml |
| 62 | +
|
| 63 | + - name: Upload Coverage to Codecov |
| 64 | + uses: codecov/codecov-action@v4 |
| 65 | + with: |
| 66 | + token: ${{ secrets.CODECOV_TOKEN }} |
0 commit comments