Skip to content

Commit 8214cf6

Browse files
committed
More refactoring WIP
1 parent 965a59b commit 8214cf6

File tree

7 files changed

+203
-175
lines changed

7 files changed

+203
-175
lines changed

.github/workflows/build-artifacts.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,9 @@ on:
99
staging:
1010
type: boolean
1111
required: true
12-
default: true
1312
go-integration-tests:
1413
type: boolean
1514
required: true
16-
default: true
17-
18-
env:
19-
BUILD_INCREMENT: 150
20-
PIP_DISABLE_PIP_VERSION_CHECK: on
21-
PIP_DEFAULT_TIMEOUT: 10
22-
PIP_PROGRESS_BAR: off
2315

2416
jobs:
2517
code-lint:
@@ -64,6 +56,7 @@ jobs:
6456
with:
6557
name: frontend-build
6658
path: frontend/build
59+
retention-days: 1
6760

6861
python-test:
6962
needs: [code-lint, frontend-build]
@@ -126,10 +119,13 @@ jobs:
126119
# Only run slow tests if requested by workflow call inputs.
127120
run: |
128121
SHORT="-short"
129-
if [[ "${{ github.event_name }}" == "workflow_call" ]]; then
130-
if [[ "${{ github.event.inputs.go-integration-tests }}" == "true" ]]; then
131-
SHORT=""
132-
fi
122+
if [[ "${{ inputs.go-integration-tests }}" == "true" ]]; then
123+
SHORT=""
124+
fi
125+
# Skip failing integration tests on macOS for release builds.
126+
# TODO: remove after fixing https://github.com/dstackai/dstack/issues/3005
127+
if [[ "${{ inputs.staging }}" == "false" && "${{ startsWith(matrix.os, 'macos') }}" == "true" ]]; then
128+
SHORT="-short"
133129
fi
134130
go version
135131
go fmt $(go list ./... | grep -v /vendor/)
@@ -235,6 +231,7 @@ jobs:
235231
with:
236232
name: python-build
237233
path: dist
234+
retention-days: 1
238235

239236
generate-json-schema:
240237
needs: [code-lint]
@@ -255,3 +252,4 @@ jobs:
255252
with:
256253
name: json-schemas
257254
path: /tmp/json-schemas
255+
retention-days: 1

.github/workflows/build-docs.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build Docs
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
release_tag:
7+
type: string
8+
required: false
9+
10+
jobs:
11+
docs-deploy:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: astral-sh/setup-uv@v5
16+
with:
17+
python-version: 3.11
18+
- name: Install dstack
19+
run: |
20+
uv pip install examples/plugins/example_plugin_server
21+
if [ -n "${{ inputs.release_tag }}" ]; then
22+
uv pip install "dstack[server]==${{ inputs.release_tag }}"
23+
else
24+
uv pip install -e '.[server]'
25+
fi
26+
- name: Build
27+
run: |
28+
uv pip install pillow cairosvg
29+
sudo apt-get update && sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev
30+
uv pip install mkdocs-material "mkdocs-material[imaging]" mkdocs-material-extensions mkdocs-redirects mkdocs-gen-files "mkdocstrings[python]" mkdocs-render-swagger-plugin --upgrade
31+
uv pip install git+https://${{ secrets.GH_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git
32+
uv run mkdocs build -s
33+
- uses: actions/upload-artifact@v4
34+
with:
35+
name: site
36+
path: site
37+
retention-days: 1

.github/workflows/build.yml

Lines changed: 27 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ on:
1616
type: boolean
1717
required: true
1818
default: false
19+
description: Go integration tests
1920

2021
env:
2122
BUILD_INCREMENT: 150
22-
PIP_DISABLE_PIP_VERSION_CHECK: on
23-
PIP_DEFAULT_TIMEOUT: 10
24-
PIP_PROGRESS_BAR: off
2523

2624
jobs:
2725
compute-version:
@@ -39,81 +37,33 @@ jobs:
3937
with:
4038
version: ${{ needs.compute-version.outputs.version }}
4139
staging: true
42-
go-integration-tests: ${{ github.event_name == 'workflow_dispatch' && inputs.go-integration-tests || true }}
43-
44-
upload-artifacts:
40+
# TODO: run integration tests on every 'push' event
41+
# once they are fixed: https://github.com/dstackai/dstack/issues/3005
42+
go-integration-tests: ${{ github.event_name == 'workflow_dispatch' && inputs.go-integration-tests }}
43+
44+
upload-pre-pypi-artifacts:
4545
needs: [compute-version, build-artifacts]
46-
# Skip for PRs from forks, where AWS credentials are not available
46+
# Skip for PRs from forks, where AWS S3 credentials are not available
4747
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
48-
runs-on: ubuntu-latest
49-
env:
50-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
51-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
52-
steps:
53-
- uses: astral-sh/setup-uv@v5
54-
with:
55-
python-version: 3.11
56-
- name: Install AWS
57-
run: uv tool install awscli
58-
- name: Download dstack-gateway
59-
uses: actions/download-artifact@v4
60-
with:
61-
name: dstack-gateway
62-
path: gateway
63-
- name: Upload dstack-gateway to S3
64-
working-directory: gateway
65-
run: |
66-
pwd
67-
ls -a
68-
ls -a ..
69-
WHEEL=dstack_gateway-${{ needs.compute-version.outputs.version }}-py3-none-any.whl
70-
aws s3 cp $WHEEL "s3://dstack-gateway-downloads/stgn/$WHEEL"
71-
echo "${{ needs.compute-version.outputs.version }}" | aws s3 cp - "s3://dstack-gateway-downloads/stgn/latest-version"
72-
- name: Download dstack-runner
73-
uses: actions/download-artifact@v4
74-
with:
75-
pattern: dstack-runner-*
76-
merge-multiple: true
77-
path: runner
78-
- name: Upload dstack-runner to S3
79-
working-directory: runner
80-
run: |
81-
aws s3 cp . "s3://dstack-runner-downloads-stgn/${{ needs.compute-version.outputs.version }}/binaries/" --recursive --exclude "*" --include "dstack-*" --acl public-read
82-
aws s3 cp . "s3://dstack-runner-downloads-stgn/latest/binaries/" --recursive --exclude "*" --include "dstack-*" --acl public-read
83-
- name: Download JSON schemas
84-
uses: actions/download-artifact@v4
85-
with:
86-
name: json-schemas
87-
path: json-schemas
88-
- name: Upload JSON schemas to S3
89-
working-directory: json-schemas
90-
run: |
91-
aws s3 cp configuration.json "s3://dstack-runner-downloads-stgn/${{ needs.compute-version.outputs.version }}/schemas/configuration.json" --acl public-read
92-
aws s3 cp configuration.json "s3://dstack-runner-downloads-stgn/latest/schemas/configuration.json" --acl public-read
93-
aws s3 cp profiles.json "s3://dstack-runner-downloads-stgn/${{ needs.compute-version.outputs.version }}/schemas/profiles.json" --acl public-read
94-
aws s3 cp profiles.json "s3://dstack-runner-downloads-stgn/latest/schemas/profiles.json" --acl public-read
95-
- name: Set latest version in S3
96-
run: |
97-
echo ${{ needs.compute-version.outputs.version }} | aws s3 cp - s3://get-dstack/stgn-cli/latest-version --acl public-read
48+
uses: ./.github/workflows/upload-pre-pypi-artifacts.yml
49+
with:
50+
version: ${{ needs.compute-version.outputs.version }}
51+
staging: true
52+
secrets: inherit
53+
54+
upload-post-pypi-artifacts:
55+
needs: [compute-version, build-artifacts]
56+
# Skip for PRs from forks, where AWS S3 credentials are not available
57+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
58+
uses: ./.github/workflows/upload-post-pypi-artifacts.yml
59+
with:
60+
version: ${{ needs.compute-version.outputs.version }}
61+
is-latest-version: true
62+
staging: true
63+
secrets: inherit
9864

99-
docs-build:
100-
# Skip for PRs from forks since mkdocs-material-insiders is not available in forks
65+
build-docs:
66+
# Skip for PRs from forks, where mkdocs-material-insiders is not available
10167
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
102-
runs-on: ubuntu-latest
103-
steps:
104-
- uses: actions/checkout@v4
105-
- uses: astral-sh/setup-uv@v5
106-
with:
107-
python-version: 3.11
108-
- name: Install dstack
109-
run: |
110-
uv pip install examples/plugins/example_plugin_server
111-
uv pip install -e '.[server]'
112-
# Move these deps into an extra and install that way
113-
- name: Build
114-
run: |
115-
uv pip install pillow cairosvg
116-
sudo apt-get update && sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev
117-
uv pip install mkdocs-material "mkdocs-material[imaging]" mkdocs-material-extensions mkdocs-redirects mkdocs-gen-files "mkdocstrings[python]" mkdocs-render-swagger-plugin --upgrade
118-
uv pip install git+https://${{ secrets.GH_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git
119-
uv run mkdocs build -s
68+
uses: ./.github/workflows/build-docs.yml
69+
secrets: inherit

.github/workflows/docs.yaml

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,25 @@
1-
name: Deploy Docs
1+
name: Build & Deploy Docs
22

33
on:
44
workflow_dispatch:
55
inputs:
6-
release_tag:
6+
release-tag:
77
description: "dstack version"
88

99
jobs:
10-
docs-deploy:
10+
build-docs:
11+
uses: ./.github/workflows/build-docs.yml
12+
with:
13+
release-tag: ${{ inputs.release-tag }}
14+
secrets: inherit
15+
16+
deploy-docs:
17+
needs: [build-docs]
1118
runs-on: ubuntu-latest
1219
steps:
13-
- uses: actions/checkout@v4
14-
- uses: astral-sh/setup-uv@v5
20+
- uses: actions/download-artifact@v4
1521
with:
16-
python-version: 3.11
17-
- name: Install dstack
18-
run: |
19-
uv pip install examples/plugins/example_plugin_server
20-
if [ -n "${{ inputs.release_tag }}" ]; then
21-
uv pip install "dstack[server]==${{ inputs.release_tag }}"
22-
else
23-
uv pip install -e '.[server]'
24-
fi
25-
- name: Build
26-
run: |
27-
uv pip install pillow cairosvg
28-
sudo apt-get update && sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev
29-
uv pip install mkdocs-material "mkdocs-material[imaging]" mkdocs-material-extensions mkdocs-redirects mkdocs-gen-files "mkdocstrings[python]" mkdocs-render-swagger-plugin --upgrade
30-
uv pip install git+https://${{ secrets.GH_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git
31-
uv run mkdocs build -s
22+
name: site
3223
- name: Deploy
3324
uses: JamesIves/github-pages-deploy-action@v4.6.4
3425
with:

.github/workflows/release.yml

Lines changed: 11 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ on:
88
- "[0-9]+.[0-9]+.[0-9]+"
99
- "[0-9]+.[0-9]+.[0-9]+.post[0-9]+"
1010

11-
env:
12-
BUILD_INCREMENT: 150
13-
PIP_DISABLE_PIP_VERSION_CHECK: on
14-
PIP_DEFAULT_TIMEOUT: 10
15-
PIP_PROGRESS_BAR: off
16-
1711
jobs:
1812
compute-version:
1913
runs-on: ubuntu-latest
@@ -45,38 +39,11 @@ jobs:
4539

4640
upload-pre-pypi-artifacts:
4741
needs: [compute-version, build-artifacts]
48-
runs-on: ubuntu-latest
49-
env:
50-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
51-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
52-
steps:
53-
- uses: astral-sh/setup-uv@v5
54-
with:
55-
python-version: 3.11
56-
- name: Install AWS
57-
run: uv tool install awscli
58-
- name: Download dstack-gateway
59-
uses: actions/download-artifact@v4
60-
with:
61-
name: dstack-gateway
62-
path: gateway
63-
- name: Upload dstack-gateway to S3
64-
working-directory: gateway
65-
run: |
66-
WHEEL=dstack_gateway-${{ needs.compute-version.outputs.version }}-py3-none-any.whl
67-
aws s3 cp $WHEEL "s3://dstack-gateway-downloads/release/$WHEEL"
68-
echo "${{ needs.compute-version.outputs.version }}" | aws s3 cp - "s3://dstack-gateway-downloads/release/latest-version"
69-
- name: Download dstack-runner
70-
uses: actions/download-artifact@v4
71-
with:
72-
pattern: dstack-runner-*
73-
merge-multiple: true
74-
path: runner
75-
- name: Upload dstack-runner to S3
76-
working-directory: runner
77-
run: |
78-
aws s3 cp . "s3://dstack-runner-downloads/${{ needs.compute-version.outputs.version }}/binaries/" --recursive --exclude "*" --include "dstack-*" --acl public-read
79-
aws s3 cp . "s3://dstack-runner-downloads/latest/binaries/" --recursive --exclude "*" --include "dstack-*" --acl public-read
42+
uses: ./.github/workflows/upload-pre-pypi-artifacts.yml
43+
with:
44+
version: ${{ needs.compute-version.outputs.version }}
45+
staging: false
46+
secrets: inherit
8047

8148
pypi-upload:
8249
needs: [compute-version, build-artifacts]
@@ -97,33 +64,12 @@ jobs:
9764
9865
upload-post-pypi-artifacts:
9966
needs: [compute-version, pypi-upload]
100-
runs-on: ubuntu-latest
101-
env:
102-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
103-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
104-
steps:
105-
- uses: astral-sh/setup-uv@v5
106-
with:
107-
python-version: 3.11
108-
- name: Install AWS
109-
run: uv tool install awscli
110-
- name: Download JSON schemas
111-
uses: actions/download-artifact@v4
112-
with:
113-
name: json-schemas
114-
path: json-schemas
115-
- name: Upload JSON schemas to S3
116-
working-directory: json-schemas
117-
run: |
118-
aws s3 cp configuration.json "s3://dstack-runner-downloads/${{ needs.compute-version.outputs.version }}/schemas/configuration.json" --acl public-read
119-
aws s3 cp profiles.json "s3://dstack-runner-downloads/${{ needs.compute-version.outputs.version }}/schemas/profiles.json" --acl public-read
120-
if [ -n "${{ needs.compute-version.outputs.latest }}" ]; then
121-
aws s3 cp configuration.json "s3://dstack-runner-downloads/latest/schemas/configuration.json" --acl public-read
122-
aws s3 cp profiles.json "s3://dstack-runner-downloads/latest/schemas/profiles.json" --acl public-read
123-
fi
124-
- name: Set latest version in S3
125-
run: |
126-
echo ${{ needs.compute-version.outputs.version }} | aws s3 cp - s3://get-dstack/cli/latest-version --acl public-read
67+
uses: ./.github/workflows/upload-post-pypi-artifacts.yml
68+
with:
69+
version: ${{ needs.compute-version.outputs.version }}
70+
is-latest-version: ${{ needs.compute-version.outputs.latest == '1' }}
71+
staging: false
72+
secrets: inherit
12773

12874
server-docker-upload:
12975
needs: [compute-version, pypi-upload]

0 commit comments

Comments
 (0)