Drafting a release bundle for 1.1.1 #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# **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" |