-
Notifications
You must be signed in to change notification settings - Fork 2
192 lines (165 loc) · 6.47 KB
/
release_draft_bundle.yml
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# **what?**
# This workflow generates a zip archive with all the python dependencies
# needed to run core + all adapters for linux, mac OS platforms (future ToDo: add Windows)
# It will release to GitHub as a draft release.
# **why?**
# Installing from pip can result in unpredictable installs/runtime environments.
# Each zip serves as a bundle of dependencies known to work. If any subsequent
# bundle breaks then a user can simply roll back to a prior release.
# **when?**
# This is currently triggered manually.
# **how**
# Call workflow dispatch. For input-version please use the semantic version
# representing the release of the dependency you want to incorporate into a new
# bundle. So if there has just been a release of dbt-core of 1.3.3 then pass that
# as the input version (without a `v` prefix).
# If the test install fails we delete the draft release and exit with a non-zero exit code.
name: Release a Draft Bundle
run-name: Drafting a release bundle for ${{ inputs.version_number }}
permissions:
packages: read
contents: write
pull-requests: read
on:
workflow_dispatch:
inputs:
version_number:
description: The release version number (i.e. 1.0.0b1).
type: string
required: true
workflow_call:
inputs:
version_number:
description: The release version number (i.e. 1.0.0b1).
type: string
required: true
outputs:
tag:
description: "The tag of the release that was created."
value: ${{ jobs.create-bundle.outputs.created_tag }}
jobs:
build-python-matrix:
name: Audit Version and Build Python Release Matrix
runs-on: ubuntu-latest
outputs:
python_versions: ${{ steps.build-list.outputs.versions }}
steps:
- name: "Checkout Repo"
uses: actions/checkout@v4
- name: "Audit Version And Parse Into Parts"
id: semver
uses: dbt-labs/actions/[email protected]
with:
version: ${{ inputs.version_number }}
- name: "Set Python Versions"
id: build-list
run: ./.github/scripts/supported_python_versions.sh \
${{ steps.semver.outputs.major}} \
${{ steps.semver.outputs.minor }}
- name: Print Supported Python Versions
run: |
echo "${{ steps.build-list.outputs.versions }}"
create-bundle:
needs: [build-python-matrix]
runs-on: ubuntu-latest
env:
GH_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ github.token }}
outputs:
created_tag: ${{ steps.create-release.outputs.created_tag }}
created_asset_url: ${{ steps.create-release.outputs.created_asset_url }}
req_file_url: ${{ steps.create-release.outputs.req_file_url }}
steps:
- name: "Checkout Repo"
uses: actions/checkout@v4
- name: "Set up Python 3.8"
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: "Install Linux Dependencies"
id: install-linux-deps
run: |
sudo apt-get update
sudo apt-get install libsasl2-dev libxml2-dev libxslt-dev git gcc g++ unixodbc-dev
python -m pip install --user --upgrade pip
pip install -r requirements.txt
- name: "Create Release"
id: create-release
run: |
python -m pip install -e . && \
python -u -m release_creation.main \
--input-version=${{ inputs.version_number }} \
--operation=create
- name: "Test install from Github Release"
id: test-install
uses: ./.github/actions/test_install
continue-on-error: true
with:
tag: "${{ steps.create-release.outputs.created_tag }}"
python_version: "3.8"
os_platform: "linux"
draft: true
- name: "Delete Draft if Test Install fails"
if: steps.test-install.outcome == 'failure'
run: |
gh release delete "${{ steps.create-release.outputs.created_tag }}" -y
exit 1
- name: "Post Notification"
run: |
title="Test Install Successful"
message="Installation and version command run successful for os_platform=linux, Python="3.8", version=${{ steps.create-release.outputs.created_tag }}"
echo "::notice $title::$message"
build-for-os-and-python-versions:
needs: [create-bundle, build-python-matrix]
strategy:
# run even if some fail so we get a full picture. At this point linux/3.8 is already released anyways so there's no reason to stop
fail-fast: false
matrix:
python-version: ${{ fromJSON(needs.build-python-matrix.outputs.python_versions) }}
os: ["macos-12", "ubuntu-latest"]
exclude:
- python-version: 3.8
os: ubuntu-latest
name: ${{ matrix.os }} - ${{ matrix.python-version }}
env:
GH_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: ${{ matrix.os }}
steps:
- name: "Checkout Repo"
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python-version }}"
- name: "Install Linux Dependencies"
if: matrix.os == 'ubuntu-latest'
run: |
echo "os_platform=linux" >> $GITHUB_ENV
./.github/scripts/worker_install_linux_deps.sh
- name: "Install Mac Dependencies"
if: matrix.os == 'macos-12'
run: |
echo "os_platform=mac" >> $GITHUB_ENV
./.github/scripts/worker_install_mac_deps.sh
- name: "Install Python Dependencies"
run: |
python -m pip install --user --upgrade pip
pip install -r requirements.txt
- name: "Generate Bundle"
run: |
python -m pip install -e . && \
python -u -m release_creation.main \
--input-version=${{ needs.create-bundle.outputs.created_tag }} \
--operation=update
- name: "Test install from Github Release"
uses: ./.github/actions/test_install
with:
tag: "${{ needs.create-bundle.outputs.created_tag }}"
python_version: "${{ matrix.python-version }}"
os_platform: "${{ env.os_platform }}"
draft: true
- name: "Post Notification"
run: |
title="Test Install Successful"
message="Installation and version command run successful for os_platform=${{ matrix.os }}, Python=${{ matrix.python-version }}, version=${{ needs.create-bundle.outputs.created_tag }}"
echo "::notice $title::$message"