forked from NVIDIA/cudaqx
-
Notifications
You must be signed in to change notification settings - Fork 0
162 lines (145 loc) · 5.55 KB
/
build_dev.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: Build dev image
on:
push:
workflow_dispatch:
inputs:
# FIXME
build_type:
type: choice
required: true
description: 'Build Type (ignored if using artifacts from prior run)'
default: 'Release'
options:
- 'Release'
- 'Debug'
#cudaq_wheels:
# type: choice
# required: true
# description: 'CUDA-Q wheel source (released version from PyPI or Custom built using .cudaq_version in repo)'
# default: 'Custom'
# options:
# - 'Custom'
# - 'PyPI'
#artifacts_from_run:
# type: string
# description: Optional argument to take artifacts from a prior run of this workflow; facilitates rerunning a failed workflow without re-building the artifacts.
# required: false
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-cudaqx-dev:
name: Build CUDA-QX Dev Image
if: ${{ false && github.repository == 'NVIDIA/cudaqx' }}
strategy:
matrix:
platform: [amd64, arm64]
fail-fast: false
runs-on: linux-${{ matrix.platform }}-cpu8
steps:
- name: Login to GitHub CR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Get code
uses: actions/checkout@v4
with:
set-safe-directory: true
- name: Get required CUDA-Q version
id: get-cudaq-version
uses: ./.github/actions/get-cudaq-version
- name: Get additional metadata
id: get-cudaq-version-short
run: |
shortref=$(echo "${{ steps.get-cudaq-version.outputs.ref }}" | head -c8)
commit_date=$(curl -s "https://api.github.com/repos/NVIDIA/cuda-quantum/commits/${{ steps.get-cudaq-version.outputs.ref }}" | jq -r '.commit.committer.date' | cut -dT -f1)
echo "shortref=$shortref" >> $GITHUB_OUTPUT
echo "commit_date=$commit_date" >> $GITHUB_OUTPUT
- name: Set up context for buildx
run: |
docker context create builder_context
shell: bash --noprofile --norc -euo pipefail {0}
- name: Set up buildx runner
uses: docker/setup-buildx-action@v3
with:
endpoint: builder_context
driver-opts: network=host
- name: Build dev image
uses: docker/build-push-action@v5
with:
file: ./docker/build_env/cudaqx.dev.Dockerfile
tags: |
ghcr.io/nvidia/cudaqx-dev:${{ steps.get-cudaq-version-short.outputs.commit_date }}-${{ steps.get-cudaq-version-short.outputs.shortref }}-${{ matrix.platform }}
ghcr.io/nvidia/cudaqx-dev:${{ steps.get-cudaq-version-short.outputs.shortref }}-${{ matrix.platform }}
ghcr.io/nvidia/cudaqx-dev:latest-${{ matrix.platform }}
platforms: linux/${{ matrix.platform }}
push: true
build-cudaqx-pydev:
name: Build CUDA-QX Python Dev Image
if: ${{ false && github.repository == 'NVIDIA/cudaqx' }}
strategy:
matrix:
python: ['3.10', '3.11', '3.12']
platform: ['amd64', 'arm64']
fail-fast: false
runs-on: linux-${{ matrix.platform }}-cpu8
steps:
- name: Login to GitHub CR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Get code
uses: actions/checkout@v4
with:
set-safe-directory: true
- name: Get required CUDA-Q version
id: get-cudaq-version
uses: ./.github/actions/get-cudaq-version
- name: Get additional metadata
id: get-cudaq-version-short
run: |
shortref=$(echo "${{ steps.get-cudaq-version.outputs.ref }}" | head -c8)
commit_date=$(curl -s "https://api.github.com/repos/NVIDIA/cuda-quantum/commits/${{ steps.get-cudaq-version.outputs.ref }}" | jq -r '.commit.committer.date' | cut -dT -f1)
echo "shortref=$shortref" >> $GITHUB_OUTPUT
echo "commit_date=$commit_date" >> $GITHUB_OUTPUT
- name: Set up context for buildx
run: |
docker context create builder_context
shell: bash --noprofile --norc -euo pipefail {0}
- name: Set up buildx runner
uses: docker/setup-buildx-action@v3
with:
endpoint: builder_context
driver-opts: network=host
- name: Build pydev image
uses: docker/build-push-action@v5
with:
file: ./docker/build_env/cudaqx.wheel.Dockerfile
build-args: |
base_image=ghcr.io/nvidia/cuda-quantum-devdeps:manylinux-${{ matrix.platform }}-cu12.0-gcc11-main
python_version=${{ matrix.python }}
tags: |
ghcr.io/nvidia/cudaqx-dev:${{ steps.get-cudaq-version-short.outputs.commit_date }}-${{ steps.get-cudaq-version-short.outputs.shortref }}-py${{ matrix.python }}-${{ matrix.platform }}
ghcr.io/nvidia/cudaqx-dev:${{ steps.get-cudaq-version-short.outputs.shortref }}-py${{ matrix.python }}-${{ matrix.platform }}
ghcr.io/nvidia/cudaqx-dev:latest-py${{ matrix.python }}-${{ matrix.platform }}
platforms: linux/${{ matrix.platform }}
push: true
cleanup:
name: Cleanup
# TEMP needs: [build-cudaqx-dev, build-cudaqx-pydev]
runs-on: ubuntu-latest
if: ${{ github.repository == 'NVIDIA/cudaqx' }}
permissions: write-all
steps:
- name: Delete untagged images
uses: actions/delete-package-versions@v5
with:
package-name: ghcr.io/nvidia/cudaqx-dev
package-type: 'container'
min-versions-to-keep: 0
delete-only-untagged-versions: 'true'
token: ${{ github.token }}