Skip to content

Commit 3e785d6

Browse files
committed
More refactoring WIP
1 parent 965a59b commit 3e785d6

File tree

5 files changed

+141
-135
lines changed

5 files changed

+141
-135
lines changed

.github/workflows/build-artifacts.yml

Lines changed: 3 additions & 13 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:
@@ -106,7 +98,7 @@ jobs:
10698
runs-on: ${{ matrix.os }}
10799
strategy:
108100
matrix:
109-
os: [ubuntu-latest, macos-latest]
101+
os: [ubuntu-latest] # TODO: , macos-latest]
110102
steps:
111103
- uses: actions/checkout@v4
112104
- name: Set up Go
@@ -126,10 +118,8 @@ jobs:
126118
# Only run slow tests if requested by workflow call inputs.
127119
run: |
128120
SHORT="-short"
129-
if [[ "${{ github.event_name }}" == "workflow_call" ]]; then
130-
if [[ "${{ github.event.inputs.go-integration-tests }}" == "true" ]]; then
131-
SHORT=""
132-
fi
121+
if [[ "${{ inputs.go-integration-tests }}" == "true" ]]; then
122+
SHORT=""
133123
fi
134124
go version
135125
go fmt $(go list ./... | grep -v /vendor/)

.github/workflows/build.yml

Lines changed: 21 additions & 57 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,62 +37,28 @@ 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+
go-integration-tests: ${{ github.event_name == 'workflow_dispatch' && inputs.go-integration-tests || github.event_name == 'push' }}
41+
42+
upload-pre-pypi-artifacts:
4543
needs: [compute-version, build-artifacts]
46-
# Skip for PRs from forks, where AWS credentials are not available
44+
# Skip for PRs from forks, where AWS S3 credentials are not available
4745
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
46+
uses: ./.github/workflows/upload-pre-pypi-artifacts.yml
47+
with:
48+
version: ${{ needs.compute-version.outputs.version }}
49+
staging: true
50+
secrets: inherit
51+
52+
upload-post-pypi-artifacts:
53+
needs: [compute-version, build-artifacts]
54+
# Skip for PRs from forks, where AWS S3 credentials are not available
55+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
56+
uses: ./.github/workflows/upload-post-pypi-artifacts.yml
57+
with:
58+
version: ${{ needs.compute-version.outputs.version }}
59+
is-latest-version: true
60+
staging: true
61+
secrets: inherit
9862

9963
docs-build:
10064
# Skip for PRs from forks since mkdocs-material-insiders is not available in forks

.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]
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Upload Post-PyPI Artifacts
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
version:
7+
type: string
8+
required: true
9+
is-latest-version:
10+
type: boolean
11+
required: true
12+
staging:
13+
type: boolean
14+
required: true
15+
16+
jobs:
17+
upload-post-pypi-artifacts:
18+
runs-on: ubuntu-latest
19+
env:
20+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
21+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
22+
steps:
23+
- uses: astral-sh/setup-uv@v5
24+
with:
25+
python-version: 3.11
26+
- name: Install AWS
27+
run: uv tool install awscli
28+
- name: Download JSON schemas
29+
uses: actions/download-artifact@v4
30+
with:
31+
name: json-schemas
32+
path: json-schemas
33+
- name: Upload JSON schemas to S3
34+
working-directory: json-schemas
35+
run: |
36+
BUCKET=dstack-runner-downloads
37+
if [ "${{ inputs.staging }}" = "true" ]; then
38+
BUCKET=dstack-runner-downloads-stgn
39+
fi
40+
aws s3 cp configuration.json "s3://$BUCKET/${{ inputs.version }}/schemas/configuration.json" --acl public-read
41+
aws s3 cp profiles.json "s3://$BUCKET/${{ inputs.version }}/schemas/profiles.json" --acl public-read
42+
if [ "${{ inputs.is-latest-version }}" = "true" ]; then
43+
aws s3 cp configuration.json "s3://$BUCKET/latest/schemas/configuration.json" --acl public-read
44+
aws s3 cp profiles.json "s3://$BUCKET/latest/schemas/profiles.json" --acl public-read
45+
fi
46+
- name: Set latest version in S3
47+
run: |
48+
CHANNEL=cli
49+
if [ "${{ inputs.staging }}" = "true" ]; then
50+
CHANNEL=stgn-cli
51+
fi
52+
echo ${{ inputs.version }} | aws s3 cp - s3://get-dstack/$CHANNEL/latest-version --acl public-read
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Upload Pre-PyPI Artifacts
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
version:
7+
type: string
8+
required: true
9+
staging:
10+
type: boolean
11+
required: true
12+
13+
jobs:
14+
upload-pre-pypi-artifacts:
15+
runs-on: ubuntu-latest
16+
env:
17+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
18+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
19+
steps:
20+
- uses: astral-sh/setup-uv@v5
21+
with:
22+
python-version: 3.11
23+
- name: Install AWS
24+
run: uv tool install awscli
25+
- name: Download dstack-gateway
26+
uses: actions/download-artifact@v4
27+
with:
28+
name: dstack-gateway
29+
path: gateway
30+
- name: Upload dstack-gateway to S3
31+
working-directory: gateway
32+
run: |
33+
CHANNEL=release
34+
if [ "${{ inputs.staging }}" = "true" ]; then
35+
CHANNEL=stgn
36+
fi
37+
WHEEL=dstack_gateway-${{ inputs.version }}-py3-none-any.whl
38+
aws s3 cp $WHEEL "s3://dstack-gateway-downloads/$CHANNEL/$WHEEL"
39+
echo "${{ inputs.version }}" | aws s3 cp - "s3://dstack-gateway-downloads/$CHANNEL/latest-version"
40+
- name: Download dstack-runner
41+
uses: actions/download-artifact@v4
42+
with:
43+
pattern: dstack-runner-*
44+
merge-multiple: true
45+
path: runner
46+
- name: Upload dstack-runner to S3
47+
working-directory: runner
48+
run: |
49+
BUCKET=dstack-runner-downloads
50+
if [ "${{ inputs.staging }}" = "true" ]; then
51+
BUCKET=dstack-runner-downloads-stgn
52+
fi
53+
aws s3 cp . "s3://$BUCKET/${{ inputs.version }}/binaries/" --recursive --exclude "*" --include "dstack-*" --acl public-read
54+
aws s3 cp . "s3://$BUCKET/latest/binaries/" --recursive --exclude "*" --include "dstack-*" --acl public-read

0 commit comments

Comments
 (0)