|
1 | 1 | name: CI |
2 | 2 |
|
3 | | -'on': |
| 3 | +"on": |
| 4 | + merge_group: {} |
| 5 | + pull_request: {} |
4 | 6 | push: |
5 | 7 | branches-ignore: |
6 | | - # These should always correspond to pull requests, so ignore them for |
7 | | - # the push trigger and let them be triggered by the pull_request |
8 | | - # trigger, avoiding running the workflow twice. This is a minor |
9 | | - # optimization so there's no need to ensure this is comprehensive. |
10 | | - - 'dependabot/**' |
11 | | - - 'renovate/**' |
12 | | - - 'tickets/**' |
13 | | - - 'u/**' |
| 8 | + - "dependabot/**" |
| 9 | + - "renovate/**" |
| 10 | + - "u/**" |
14 | 11 | tags: |
15 | | - - '*' |
16 | | - pull_request: {} |
| 12 | + - "[0-9]*" |
| 13 | + - "client/[0-9]*" |
17 | 14 |
|
18 | 15 | jobs: |
19 | 16 | lint: |
20 | 17 | runs-on: ubuntu-latest |
| 18 | + timeout-minutes: 10 |
21 | 19 |
|
22 | 20 | steps: |
23 | | - - uses: actions/checkout@v3 |
| 21 | + - uses: actions/checkout@v4 |
24 | 22 |
|
25 | 23 | - name: Set up Python |
26 | | - uses: actions/setup-python@v4 |
| 24 | + uses: actions/setup-python@v5 |
27 | 25 | with: |
28 | | - python-version: "3.10" |
| 26 | + python-version-file: ".python-version" |
29 | 27 |
|
30 | | - - name: Run pre-commit |
31 | | - uses: pre-commit/action@v3.0.0 |
| 28 | + - name: Install uv |
| 29 | + uses: astral-sh/setup-uv@v5 |
| 30 | + |
| 31 | + - name: Run linters |
| 32 | + run: uv run --only-group=lint pre-commit run --all-files |
32 | 33 |
|
33 | 34 | test: |
34 | 35 | runs-on: ubuntu-latest |
35 | | - needs: [lint] |
36 | | - |
37 | | - strategy: |
38 | | - matrix: |
39 | | - python: |
40 | | - - "3.10" |
41 | | - db: |
42 | | - - sqlite |
43 | | - - postgres |
44 | | - # - mysql |
| 36 | + timeout-minutes: 10 |
45 | 37 |
|
46 | 38 | steps: |
47 | | - - uses: actions/checkout@v3 |
48 | | - |
49 | | - - name: Install build tools |
50 | | - run: sudo apt-get install build-essential |
| 39 | + - uses: actions/checkout@v4 |
| 40 | + with: |
| 41 | + fetch-depth: 0 |
51 | 42 |
|
52 | 43 | - name: Set up Python |
53 | | - uses: actions/setup-python@v4 |
| 44 | + uses: actions/setup-python@v5 |
54 | 45 | with: |
55 | | - python-version: ${{ matrix.python }} |
| 46 | + python-version-file: ".python-version" |
56 | 47 |
|
57 | | - - name: Install tox |
58 | | - run: | |
59 | | - pip install 'requests<2.32.0' |
60 | | - pip install tox |
61 | | - pip install --pre tox-docker |
| 48 | + - name: Install uv |
| 49 | + uses: astral-sh/setup-uv@v5 |
62 | 50 |
|
63 | | - - name: Cache tox environments |
64 | | - id: cache-tox |
65 | | - uses: actions/cache@v3 |
66 | | - with: |
67 | | - path: .tox |
68 | | - # requirements/*.txt and pyproject.toml have versioning info |
69 | | - # that would impact the tox environment. |
70 | | - key: tox-${{ matrix.python }}--${{ matrix.db }}-${{ hashFiles('requirements/*.txt') }}-${{ hashFiles('pyproject.toml') }} |
71 | | - restore-keys: | |
72 | | - tox-${{ matrix.python }}-${{ matrix.db }}-${{ hashFiles('requirements/*.txt') }}- |
73 | | -
|
74 | | - - name: Run tox with external services |
75 | | - if: ${{ matrix.python == '3.10' && matrix.db == 'postgres' }} |
76 | | - env: |
77 | | - LTD_KEEPER_TEST_AWS_ID: ${{ secrets.LTD_KEEPER_TEST_AWS_ID }} |
78 | | - LTD_KEEPER_TEST_AWS_SECRET: ${{ secrets.LTD_KEEPER_TEST_AWS_SECRET }} |
79 | | - LTD_KEEPER_TEST_BUCKET: ${{ secrets.LTD_KEEPER_TEST_BUCKET }} |
80 | | - # run: tox -e typing,${{matrix.db}},coverage-report # run tox using Python in path |
81 | | - run: tox -e ${{matrix.db}},coverage-report # run tox using Python in path |
82 | | - |
83 | | - - name: Run tox without external services |
84 | | - if: ${{ !(matrix.python != '3.10' && matrix.db != 'postgres') }} |
85 | | - # run: tox -e typing,${{matrix.db}},coverage-report # run tox using Python in path |
86 | | - run: tox -e ${{matrix.db}},coverage-report # run tox using Python in path |
87 | | - |
88 | | - docs: |
| 51 | + - name: Run typing |
| 52 | + run: uv run --only-group=nox nox -s typing |
| 53 | + |
| 54 | + - name: Run tests |
| 55 | + run: uv run --only-group=nox nox -s test |
| 56 | + |
| 57 | + client-test: |
89 | 58 | runs-on: ubuntu-latest |
90 | | - needs: [lint] |
| 59 | + timeout-minutes: 10 |
91 | 60 |
|
92 | 61 | steps: |
93 | | - - uses: actions/checkout@v3 |
| 62 | + - uses: actions/checkout@v4 |
94 | 63 | with: |
95 | 64 | fetch-depth: 0 |
96 | 65 |
|
97 | 66 | - name: Set up Python |
98 | | - uses: actions/setup-python@v4 |
| 67 | + uses: actions/setup-python@v5 |
99 | 68 | with: |
100 | | - python-version: "3.10" |
| 69 | + python-version: | |
| 70 | + 3.12 |
| 71 | + 3.13 |
101 | 72 |
|
102 | | - - name: Install Python dependencies |
103 | | - run: pip install tox ltd-conveyor |
| 73 | + - name: Install uv |
| 74 | + uses: astral-sh/setup-uv@v5 |
104 | 75 |
|
105 | | - - name: Cache tox environment for docs |
106 | | - id: cache-tox |
107 | | - uses: actions/cache@v3 |
108 | | - with: |
109 | | - path: .tox |
110 | | - # requirements/*.txt, pyproject.toml, and .pre-commit-config.yaml |
111 | | - # have versioning info that would impact the tox environment. |
112 | | - key: tox-docs-${{ hashFiles('requirements/*.txt') }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('.pre-commit-config.yaml') }} |
113 | | - |
114 | | - - name: Run tox |
115 | | - run: tox -e docs |
116 | | - |
117 | | - - name: Upload documentation |
118 | | - if: ${{ github.event_name == 'push' }} |
119 | | - env: |
120 | | - LTD_PASSWORD: ${{ secrets.LTD_PASSWORD }} |
121 | | - LTD_USERNAME: ${{ secrets.LTD_USERNAME }} |
122 | | - run: | |
123 | | - ltd upload --gh --dir docs/_build/html --product ltd-keeper |
| 76 | + - name: Run client tests |
| 77 | + run: >- |
| 78 | + uv run --only-group=nox nox -s |
| 79 | + client_test |
| 80 | + client_test_compat |
| 81 | + client_test_oldest |
124 | 82 |
|
125 | 83 | build: |
126 | 84 | runs-on: ubuntu-latest |
127 | | - needs: [test] |
| 85 | + needs: [test, client-test] |
| 86 | + timeout-minutes: 15 |
128 | 87 |
|
129 | | - # Only do Docker builds of ticket branches and tagged releases, as well |
130 | | - # as J.Sick Codes branches. |
131 | | - # if: > |
132 | | - # (startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/tickets/')) || startsWith(github.ref, 'refs/heads/u/jsickcodes/') |
| 88 | + # Build on server tags and ticket branch PRs (exclude client tags) |
| 89 | + if: > |
| 90 | + (startsWith(github.ref, 'refs/tags/') |
| 91 | + && !startsWith(github.ref, 'refs/tags/client/')) |
| 92 | + || github.event_name == 'pull_request' |
133 | 93 |
|
134 | 94 | steps: |
135 | | - - uses: actions/checkout@v3 |
| 95 | + - uses: actions/checkout@v4 |
136 | 96 | with: |
137 | 97 | fetch-depth: 0 |
138 | 98 |
|
139 | 99 | - name: Define the Docker tag |
140 | 100 | id: vars |
141 | | - run: echo ::set-output name=tag::$(bin/docker-tag.sh) |
142 | | - |
143 | | - - name: Print the tag |
144 | | - id: print |
145 | | - run: echo ${{ steps.vars.outputs.tag }} |
| 101 | + run: | |
| 102 | + if [[ "$GITHUB_REF" == refs/tags/* ]]; then |
| 103 | + echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT" |
| 104 | + elif [[ "$GITHUB_HEAD_REF" != "" ]]; then |
| 105 | + echo "tag=${GITHUB_HEAD_REF}" >> "$GITHUB_OUTPUT" |
| 106 | + else |
| 107 | + echo "tag=${GITHUB_REF#refs/heads/}" >> "$GITHUB_OUTPUT" |
| 108 | + fi |
146 | 109 |
|
147 | 110 | - name: Set up Docker Buildx |
148 | | - uses: docker/setup-buildx-action@v2 |
| 111 | + uses: docker/setup-buildx-action@v3 |
149 | 112 |
|
150 | 113 | - name: Log in to GitHub Container Registry |
151 | | - uses: docker/login-action@v2 |
| 114 | + uses: docker/login-action@v3 |
152 | 115 | with: |
153 | 116 | registry: ghcr.io |
154 | 117 | username: ${{ github.repository_owner }} |
155 | 118 | password: ${{ secrets.GITHUB_TOKEN }} |
156 | 119 |
|
157 | 120 | - name: Build and push |
158 | | - uses: docker/build-push-action@v3 |
| 121 | + uses: docker/build-push-action@v6 |
159 | 122 | with: |
160 | 123 | context: . |
161 | 124 | push: true |
162 | 125 | tags: | |
163 | | - ghcr.io/lsst-sqre/ltd-keeper:${{ steps.vars.outputs.tag }} |
| 126 | + ghcr.io/lsst-sqre/docverse:${{ steps.vars.outputs.tag }} |
164 | 127 | cache-from: type=gha |
165 | 128 | cache-to: type=gha,mode=max |
| 129 | + |
| 130 | + client-publish: |
| 131 | + runs-on: ubuntu-latest |
| 132 | + needs: [test, client-test] |
| 133 | + timeout-minutes: 10 |
| 134 | + |
| 135 | + if: startsWith(github.ref, 'refs/tags/client/') |
| 136 | + |
| 137 | + environment: pypi |
| 138 | + |
| 139 | + permissions: |
| 140 | + id-token: write |
| 141 | + |
| 142 | + steps: |
| 143 | + - uses: actions/checkout@v4 |
| 144 | + with: |
| 145 | + fetch-depth: 0 |
| 146 | + |
| 147 | + - name: Set up Python |
| 148 | + uses: actions/setup-python@v5 |
| 149 | + with: |
| 150 | + python-version-file: ".python-version" |
| 151 | + |
| 152 | + - name: Install uv |
| 153 | + uses: astral-sh/setup-uv@v5 |
| 154 | + |
| 155 | + - name: Build client package |
| 156 | + working-directory: client |
| 157 | + run: uv build |
| 158 | + |
| 159 | + - name: Publish to PyPI |
| 160 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 161 | + with: |
| 162 | + packages-dir: client/dist/ |
0 commit comments