1 Star 0 Fork 0

caoshiwei / airflow

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ci.yml 77.70 KB
一键复制 编辑 原始数据 按行查看 历史
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
---
name: Tests
on: # yamllint disable-line rule:truthy
schedule:
- cron: '28 0 * * *'
push:
branches: ['main', 'v[0-9]+-[0-9]+-test']
pull_request:
branches: ['main', 'v[0-9]+-[0-9]+-test', 'v[0-9]+-[0-9]+-stable']
permissions:
# All other permissions are set to none
contents: read
packages: read
env:
MOUNT_SELECTED_LOCAL_SOURCES: "false"
ANSWER: "yes"
CHECK_IMAGE_FOR_REBUILD: "true"
SKIP_CHECK_REMOTE_IMAGE: "true"
DB_RESET: "true"
VERBOSE: "true"
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_USERNAME: ${{ github.actor }}
# You can override CONSTRAINTS_GITHUB_REPOSITORY by setting secret in your repo but by default the
# Airflow one is going to be used
CONSTRAINTS_GITHUB_REPOSITORY: >-
${{ secrets.CONSTRAINTS_GITHUB_REPOSITORY != '' &&
secrets.CONSTRAINTS_GITHUB_REPOSITORY || 'apache/airflow' }}
# In builds from forks, this token is read-only. For scheduler/direct push it is WRITE one
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ENABLE_TEST_COVERAGE: "${{ github.event_name == 'push' }}"
IMAGE_TAG_FOR_THE_BUILD: "${{ github.event.pull_request.head.sha || github.sha }}"
USE_SUDO: "true"
INCLUDE_SUCCESS_OUTPUTS: "true"
concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build-info:
name: "Build info"
# The runs-on cannot refer to env. or secrets. context, so we have no
# option but to specify a hard-coded list here. This is "safe", as the list
# is checked again by the runner using it's own list, so a PR author cannot
# change this and get access to our self-hosted runners
#
# When changing this list, ensure that it is kept in sync with the
# /runners/apache/airflow/configOverlay
# parameter in AWS SSM ParameterStore (which is what the runner uses)
# and restart the self-hosted runners.
#
# This list of committers can be generated with:
# https://github.com/apache/airflow-ci-infra/blob/main/scripts/list_committers
runs-on: >-
${{ (
(
github.event_name == 'push' ||
github.event_name == 'schedule' ||
contains(fromJSON('[
"BasPH",
"Fokko",
"KevinYang21",
"XD-DENG",
"aijamalnk",
"alexvanboxel",
"aoen",
"artwr",
"ashb",
"bbovenzi",
"bolkedebruin",
"criccomini",
"dimberman",
"dstandish",
"eladkal",
"ephraimbuddy",
"feluelle",
"feng-tao",
"houqp",
"jedcunningham",
"jgao54",
"jghoman",
"jhtimmins",
"jmcarp",
"josh-fell",
"kaxil",
"leahecole",
"malthe",
"mik-laj",
"milton0825",
"mistercrunch",
"msumit",
"pingzh",
"potiuk",
"r39132",
"ryanahamilton",
"ryw",
"saguziel",
"sekikn",
"turbaszek",
"uranusjr",
"vikramkoka",
"xinbinhuang",
"yuqian90",
"zhongjiajie"
]'), github.event.pull_request.user.login)
) && github.repository == 'apache/airflow'
) && 'self-hosted' || 'ubuntu-20.04' }}
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
outputs:
cache-directive: ${{ steps.selective-checks.outputs.cache-directive }}
upgrade-to-newer-dependencies: ${{ steps.selective-checks.outputs.upgrade-to-newer-dependencies }}
python-versions: ${{ steps.selective-checks.outputs.python-versions }}
python-versions-list-as-string: ${{ steps.selective-checks.outputs.python-versions-list-as-string }}
all-python-versions-list-as-string: >-
${{ steps.selective-checks.outputs.all-python-versions-list-as-string }}
default-python-version: ${{ steps.selective-checks.outputs.default-python-version }}
min-max-python-versions-as-string: >-
${{ steps.selective-checks.outputs.min-max-python-versions-as-string }}
kubernetes-versions-list-as-string: >-
${{ steps.selective-checks.outputs.kubernetes-versions-list-as-string }}
default-kubernetes-version: ${{ steps.selective-checks.outputs.default-kubernetes-version }}
min-max-kubernetes-versions-as-string: >-
${{ steps.selective-checks.outputs.min-max-kubernetes-versions-as-string }}
postgres-versions: ${{ steps.selective-checks.outputs.postgres-versions }}
default-postgres-version: ${{ steps.selective-checks.outputs.default-postgres-version }}
mysql-versions: ${{ steps.selective-checks.outputs.mysql-versions }}
mssql-versions: ${{ steps.selective-checks.outputs.mssql-versions }}
default-mysql-version: ${{ steps.selective-checks.outputs.default-mysql-version }}
default-helm-version: ${{ steps.selective-checks.outputs.default-helm-version }}
default-kind-version: ${{ steps.selective-checks.outputs.default-kind-version }}
test-types: ${{ steps.selective-checks.outputs.test-types }}
postgres-exclude: ${{ steps.selective-checks.outputs.postgres-exclude }}
mysql-exclude: ${{ steps.selective-checks.outputs.mysql-exclude }}
mssql-exclude: ${{ steps.selective-checks.outputs.mssql-exclude }}
sqlite-exclude: ${{ steps.selective-checks.outputs.sqlite-exclude }}
run-tests: ${{ steps.selective-checks.outputs.run-tests }}
run-ui-tests: ${{ steps.selective-checks.outputs.run-ui-tests }}
run-www-tests: ${{ steps.selective-checks.outputs.run-www-tests }}
run-kubernetes-tests: ${{ steps.selective-checks.outputs.run-kubernetes-tests }}
basic-checks-only: ${{ steps.selective-checks.outputs.basic-checks-only }}
image-build: ${{ steps.selective-checks.outputs.image-build }}
docs-build: ${{ steps.selective-checks.outputs.docs-build }}
needs-helm-tests: ${{ steps.selective-checks.outputs.needs-helm-tests }}
needs-api-tests: ${{ steps.selective-checks.outputs.needs-api-tests }}
needs-api-codegen: ${{ steps.selective-checks.outputs.needs-api-codegen }}
default-branch: ${{ steps.selective-checks.outputs.default-branch }}
default-constraints-branch: ${{ steps.selective-checks.outputs.default-constraints-branch }}
docs-filter: ${{ steps.selective-checks.outputs.docs-filter }}
skip-pre-commits: ${{ steps.selective-checks.outputs.skip-pre-commits }}
source-head-repo: ${{ steps.source-run-info.outputs.source-head-repo }}
pull-request-labels: ${{ steps.source-run-info.outputs.pullRequestLabels }}
runs-on: ${{ steps.set-runs-on.outputs.runs-on }}
run-coverage: ${{ steps.set-run-coverage.outputs.run-coverage }}
in-workflow-build: ${{ steps.set-in-workflow-build.outputs.in-workflow-build }}
build-job-description: ${{ steps.set-in-workflow-build.outputs.build-job-description }}
merge-run: ${{ steps.set-merge-run.outputs.merge-run }}
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
persist-credentials: false
submodules: recursive
- name: "Get information about the PR"
uses: ./.github/actions/get-workflow-origin
id: source-run-info
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch incoming commit ${{ github.sha }} with its parent
uses: actions/checkout@v3
with:
ref: ${{ github.sha }}
fetch-depth: 2
persist-credentials: false
- name: "Setup python"
uses: actions/setup-python@v4
with:
# We do not have output from selective checks yet, so we need to hardcode python
python-version: 3.7
cache: 'pip'
cache-dependency-path: ./dev/breeze/setup*
- name: "Retrieve defaults from branch_defaults.py"
id: defaults
# We could retrieve it differently here - by just importing the variables and
# printing them from python code, however we want to have the same code as used in
# the build-images.yml (there we cannot import python code coming from the PR - we need to
# treat the python code as text and extract the variables from there.
run: |
python - <<EOF >>$GITHUB_ENV
from pathlib import Path
import re
import sys
DEFAULTS_CONTENT = Path('dev/breeze/src/airflow_breeze/branch_defaults.py').read_text()
BRANCH_PATTERN = r'^AIRFLOW_BRANCH = "(.*)"$'
CONSTRAINTS_BRANCH_PATTERN = r'^DEFAULT_AIRFLOW_CONSTRAINTS_BRANCH = "(.*)"$'
branch = re.search(BRANCH_PATTERN, DEFAULTS_CONTENT, re.MULTILINE).group(1)
constraints_branch = re.search(CONSTRAINTS_BRANCH_PATTERN, DEFAULTS_CONTENT, re.MULTILINE).group(1)
output = f"""
DEFAULT_BRANCH={branch}
DEFAULT_CONSTRAINTS_BRANCH={constraints_branch}
""".strip()
print(output)
# Stdout is redirected to GITHUB_ENV but we also print it to stderr to see it in ci log
print(output, file=sys.stderr)
EOF
- run: ./scripts/ci/install_breeze.sh
- name: Selective checks
id: selective-checks
env:
PR_LABELS: "${{ steps.source-run-info.outputs.pullRequestLabels }}"
COMMIT_REF: "${{ github.sha }}"
run: breeze ci selective-check
# Avoid having to specify the runs-on logic every time. We use the custom
# env var AIRFLOW_SELF_HOSTED_RUNNER set only on our runners, but never
# on the public runners
- name: Set runs-on
id: set-runs-on
env:
PR_LABELS: "${{ steps.source-run-info.outputs.pullRequestLabels }}"
run: |
if [[ ${PR_LABELS=} == *"use public runners"* ]]; then
echo "Forcing running on Public Runners via `use public runners` label"
echo "::set-output name=runs-on::\"ubuntu-20.04\""
elif [[ ${AIRFLOW_SELF_HOSTED_RUNNER} == "" ]]; then
echo "Regular PR running with Public Runner"
echo "::set-output name=runs-on::\"ubuntu-20.04\""
else
echo "Maintainer or main run running with self-hosted runner"
echo "::set-output name=runs-on::\"self-hosted\""
fi
# Avoid having to specify the coverage logic every time.
- name: Set run coverage
id: set-run-coverage
run: echo "::set-output name=run-coverage::true"
if: >
github.ref == 'refs/heads/main' && github.repository == 'apache/airflow' &&
github.event_name == 'push' &&
steps.selective-checks.outputs.default-branch == 'main'
- name: Determine where to run image builds
id: set-in-workflow-build
# Run in-workflow build image when:
# * direct push is run
# * schedule build is run
# * pull request is run not from fork
run: |
set -x
if [[ ${GITHUB_EVENT_NAME} == "push" || ${GITHUB_EVENT_NAME} == "push" || \
${{steps.source-run-info.outputs.sourceHeadRepo}} == "apache/airflow" ]]; then
echo "Images will be built in current workflow"
echo "::set-output name=in-workflow-build::true"
echo "::set-output name=build-job-description::Build"
else
echo "Images will be built in pull_request_target workflow"
echo "::set-output name=in-workflow-build::false"
echo "::set-output name=build-job-description::Skip Build (pull_request_target)"
fi
- name: Determine if this is merge run
id: set-merge-run
run: echo "::set-output name=merge-run::true"
# Only in Apache Airflow repo, when there is a merge run to main or any of v2*test branches
if: |
github.repository == 'apache/airflow' && github.event_name == 'push' &&
(
github.ref_name == 'main' ||
startsWith(github.ref_name, 'v2') && endsWith(github.ref_name, 'test')
)
- name: env
run: printenv
env:
PR_LABELS: ${{ steps.source-run-info.outputs.pullRequestLabels }}
GITHUB_CONTEXT: ${{ toJson(github) }}
build-ci-images:
permissions:
packages: write
timeout-minutes: 80
name: >-
${{needs.build-info.outputs.build-job-description}} CI images
${{ needs.build-info.outputs.all-python-versions-list-as-string }}
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs: [build-info]
env:
DEFAULT_BRANCH: ${{ needs.build-info.outputs.default-branch }}
DEFAULT_CONSTRAINTS_BRANCH: ${{ needs.build-info.outputs.default-constraints-branch }}
RUNS_ON: ${{ fromJson(needs.build-info.outputs.runs-on)[0] }}
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
if: needs.build-info.outputs.in-workflow-build == 'true'
- uses: actions/checkout@v3
with:
ref: ${{ needs.build-info.outputs.targetCommitSha }}
persist-credentials: false
submodules: recursive
if: needs.build-info.outputs.in-workflow-build == 'true'
- name: "Setup python"
uses: actions/setup-python@v4
with:
python-version: ${{ needs.build-info.outputs.default-python-version }}
if: needs.build-info.outputs.in-workflow-build == 'true'
- run: ./scripts/ci/install_breeze.sh
if: needs.build-info.outputs.in-workflow-build == 'true'
- name: "Free space"
run: breeze ci free-space
if: needs.build-info.outputs.in-workflow-build == 'true'
- name: Cache pre-commit envs
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: "pre-commit-${{steps.host-python-version.outputs.host-python-version}}-\
${{ hashFiles('.pre-commit-config.yaml') }}"
restore-keys: pre-commit-${{steps.host-python-version.outputs.host-python-version}}
if: needs.build-info.outputs.in-workflow-build == 'true'
- name: "Regenerate dependencies in case they was modified manually so that we can build an image"
run: >
breeze static-checks --type update-providers-dependencies --all-files
--show-diff-on-failure --color always || true
if: >
needs.build-info.outputs.in-workflow-build == 'true' &&
needs.build-info.outputs.default-branch == 'main'
- name: Compile www assets
run: breeze compile-www-assets
if: needs.build-info.outputs.in-workflow-build == 'true'
- name: >
Build & Push CI images ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
${{ needs.build-info.outputs.all-python-versions-list-as-string }}
run: breeze ci-image build --push --tag-as-latest --run-in-parallel
env:
UPGRADE_TO_NEWER_DEPENDENCIES: ${{ needs.build-info.outputs.upgrade-to-newer-dependencies }}
DOCKER_CACHE: ${{ needs.build-info.outputs.cache-directive }}
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
PYTHON_VERSIONS: ${{ needs.build-info.outputs.all-python-versions-list-as-string }}
if: needs.build-info.outputs.in-workflow-build == 'true'
- name: "Candidates for pip resolver backtrack triggers"
if: failure() || cancelled()
run: >
breeze ci find-newer-dependencies --max-age 1
--python "${{ needs.build-info.outputs.default-python-version }}"
- name: "Fix ownership"
run: breeze ci fix-ownership
if: always() && needs.build-info.outputs.in-workflow-build == 'true'
build-prod-images:
permissions:
packages: write
timeout-minutes: 80
name: >
${{needs.build-info.outputs.build-job-description}} PROD images
${{ needs.build-info.outputs.all-python-versions-list-as-string }}
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs: [build-info, build-ci-images]
env:
DEFAULT_BRANCH: ${{ needs.build-info.outputs.default-branch }}
DEFAULT_CONSTRAINTS_BRANCH: ${{ needs.build-info.outputs.default-constraints-branch }}
RUNS_ON: ${{ fromJson(needs.build-info.outputs.runs-on)[0] }}
BACKEND: sqlite
DOCKER_CACHE: ${{ needs.build-info.outputs.cache-directive }}
VERSION_SUFFIX_FOR_PYPI: "dev0"
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
if: needs.build-info.outputs.in-workflow-build == 'true'
- uses: actions/checkout@v3
with:
ref: ${{ needs.build-info.outputs.targetCommitSha }}
persist-credentials: false
submodules: recursive
if: needs.build-info.outputs.in-workflow-build == 'true'
- name: "Setup python"
uses: actions/setup-python@v4
with:
python-version: ${{ needs.build-info.outputs.default-python-version }}
if: needs.build-info.outputs.in-workflow-build == 'true'
- run: ./scripts/ci/install_breeze.sh
if: needs.build-info.outputs.in-workflow-build == 'true'
- name: "Free space"
run: breeze ci free-space
if: needs.build-info.outputs.in-workflow-build == 'true'
- name: Cache pre-commit envs
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: "pre-commit-${{steps.host-python-version.outputs.host-python-version}}-\
${{ hashFiles('.pre-commit-config.yaml') }}"
restore-keys: pre-commit-${{steps.host-python-version.outputs.host-python-version}}
if: >
needs.build-info.outputs.in-workflow-build == 'true' &&
needs.build-info.outputs.default-branch == 'main'
- name: "Regenerate dependencies in case they was modified manually so that we can build an image"
run: >
breeze static-checks --type update-providers-dependencies --all-files
--show-diff-on-failure --color always || true
if: >
needs.build-info.outputs.in-workflow-build == 'true' &&
needs.build-info.outputs.default-branch == 'main'
- name: >
Pull CI image for PROD build:
${{ needs.build-info.outputs.default-python-version }}:${{ env.IMAGE_TAG_FOR_THE_BUILD }}"
run: breeze ci-image pull --tag-as-latest
env:
# Always use default Python version of CI image for preparing packages
PYTHON_MAJOR_MINOR_VERSION: ${{ needs.build-info.outputs.default-python-version }}
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
if: needs.build-info.outputs.in-workflow-build == 'true'
- name: "Cleanup dist and context file"
run: rm -fv ./dist/* ./docker-context-files/*
if: needs.build-info.outputs.in-workflow-build == 'true'
- name: "Prepare providers packages"
run: >
breeze release-management prepare-provider-packages
--package-list-file ./scripts/ci/installed_providers.txt
--package-format wheel --version-suffix-for-pypi dev0
if: >
needs.build-info.outputs.in-workflow-build == 'true' &&
needs.build-info.outputs.default-branch == 'main'
- name: "Prepare airflow package"
run: >
breeze release-management prepare-airflow-package
--package-format wheel --version-suffix-for-pypi dev0
if: needs.build-info.outputs.in-workflow-build == 'true'
- name: "Move dist packages to docker-context files"
run: mv -v ./dist/*.whl ./docker-context-files
if: needs.build-info.outputs.in-workflow-build == 'true'
- name: >
Build & Push PROD images ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
${{ needs.build-info.outputs.all-python-versions-list-as-string }}
run: >
breeze prod-image build
--tag-as-latest
--run-in-parallel
--push
--install-packages-from-context
env:
UPGRADE_TO_NEWER_DEPENDENCIES: ${{ needs.build-info.outputs.upgrade-to-newer-dependencies }}
DOCKER_CACHE: ${{ needs.build-info.outputs.cache-directive }}
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
PYTHON_VERSIONS: ${{ needs.build-info.outputs.all-python-versions-list-as-string }}
if: needs.build-info.outputs.in-workflow-build == 'true'
- name: "Fix ownership"
run: breeze ci fix-ownership
if: always() && needs.build-info.outputs.in-workflow-build == 'true'
run-new-breeze-tests:
timeout-minutes: 10
name: Breeze unit tests
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs: [build-info]
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: actions/setup-python@v4
with:
python-version: ${{ needs.build-info.outputs.default-python-version }}
cache: 'pip'
cache-dependency-path: ./dev/breeze/setup*
- run: python -m pip install --editable ./dev/breeze/
- run: python -m pytest ./dev/breeze/ -n auto --color=yes
- run: breeze setup version
tests-ui:
timeout-minutes: 10
name: React UI tests
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs: [build-info]
if: needs.build-info.outputs.run-ui-tests == 'true'
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
persist-credentials: false
- name: "Setup node"
uses: actions/setup-node@v3
with:
node-version: 14
- name: "Cache eslint"
uses: actions/cache@v2
with:
path: 'airflow/ui/node_modules'
key: ${{ runner.os }}-ui-node-modules-${{ hashFiles('airflow/ui/**/yarn.lock') }}
- run: yarn --cwd airflow/ui/ install --frozen-lockfile --non-interactive
- run: yarn --cwd airflow/ui/ run test
env:
FORCE_COLOR: 2
tests-www:
timeout-minutes: 10
name: React WWW tests
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs: [build-info]
if: needs.build-info.outputs.run-www-tests == 'true'
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
persist-credentials: false
- name: "Setup node"
uses: actions/setup-node@v3
with:
node-version: 14
- name: "Cache eslint"
uses: actions/cache@v3
with:
path: 'airflow/www/node_modules'
key: ${{ runner.os }}-ui-node-modules-${{ hashFiles('airflow/ui/**/yarn.lock') }}
- run: yarn --cwd airflow/www/ install --frozen-lockfile --non-interactive
- run: yarn --cwd airflow/www/ run test
env:
FORCE_COLOR: 2
test-openapi-client-generation:
timeout-minutes: 10
name: "Test OpenAPI client generation"
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs: [build-info]
if: needs.build-info.outputs.needs-api-codegen == 'true'
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
fetch-depth: 2
persist-credentials: false
- name: "Generate client codegen diff"
run: ./scripts/ci/openapi/client_codegen_diff.sh
test-examples-of-prod-image-building:
timeout-minutes: 60
name: "Test examples of production image building"
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs: [build-info]
if: needs.build-info.outputs.image-build == 'true'
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v2
with:
fetch-depth: 2
persist-credentials: false
- name: "Setup python"
uses: actions/setup-python@v4
with:
python-version: ${{ needs.build-info.outputs.default-python-version }}
cache: 'pip'
cache-dependency-path: ./dev/requirements.txt
- name: "Test examples of PROD image building"
run: >
python -m pip install -r ./docker_tests/requirements.txt &&
python -m pytest docker_tests/test_examples_of_prod_image_building.py -n auto --color=yes
wait-for-ci-images:
timeout-minutes: 120
name: "Wait for CI images"
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs: [build-info, build-ci-images]
if: needs.build-info.outputs.image-build == 'true'
env:
RUNS_ON: ${{ fromJson(needs.build-info.outputs.runs-on) }}
BACKEND: sqlite
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
persist-credentials: false
- name: "Setup python"
uses: actions/setup-python@v4
with:
python-version: ${{ needs.build-info.outputs.default-python-version }}
cache: 'pip'
cache-dependency-path: ./dev/breeze/setup*
- run: ./scripts/ci/install_breeze.sh
- name: "Free space"
run: breeze ci free-space
- name: Wait for CI images ${{ env.PYTHON_VERSIONS }}:${{ env.IMAGE_TAG_FOR_THE_BUILD }}
id: wait-for-images
run: breeze ci-image pull --run-in-parallel --verify --wait-for-image --tag-as-latest
env:
PYTHON_VERSIONS: ${{ needs.build-info.outputs.python-versions-list-as-string }}
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
- name: "Fix ownership"
run: breeze ci fix-ownership
if: always()
static-checks:
timeout-minutes: 30
name: "Static checks"
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs: [build-info, wait-for-ci-images]
env:
RUNS_ON: ${{ fromJson(needs.build-info.outputs.runs-on) }}
PYTHON_MAJOR_MINOR_VERSION: ${{ needs.build-info.outputs.default-python-version }}
if: needs.build-info.outputs.basic-checks-only == 'false'
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
persist-credentials: false
- name: "Setup python"
uses: actions/setup-python@v4
with:
python-version: ${{ needs.build-info.outputs.default-python-version }}
cache: 'pip'
cache-dependency-path: ./dev/breeze/setup*
- name: Cache pre-commit envs
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: "pre-commit-${{steps.host-python-version.outputs.host-python-version}}-\
${{ hashFiles('.pre-commit-config.yaml') }}"
restore-keys: pre-commit-${{steps.host-python-version.outputs.host-python-version}}
- run: ./scripts/ci/install_breeze.sh
- name: "Free space"
run: breeze ci free-space
- name: >
Pull CI image ${{ env.PYTHON_MAJOR_MINOR_VERSION }}:${{ env.IMAGE_TAG_FOR_THE_BUILD }}
run: breeze ci-image pull --tag-as-latest
env:
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
- name: "Get Python version"
run: "echo \"::set-output name=host-python-version::$(python -c
'import platform; print(platform.python_version())')\""
id: host-python-version
- name: "Static checks"
run: breeze static-checks --all-files --show-diff-on-failure --color always
env:
VERBOSE: "false"
SKIP: ${{ needs.build-info.outputs.skip-pre-commits }}
COLUMNS: "250"
SKIP_GROUP_OUTPUT: "true"
- name: "Fix ownership"
run: breeze ci fix-ownership
if: always()
# Those checks are run if no image needs to be built for checks. This is for simple changes that
# Do not touch any of the python code or any of the important files that might require building
# The CI Docker image and they can be run entirely using the pre-commit virtual environments on host
static-checks-basic-checks-only:
timeout-minutes: 30
name: "Static checks: basic checks only"
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs: [build-info]
env:
RUNS_ON: ${{ fromJson(needs.build-info.outputs.runs-on) }}
if: needs.build-info.outputs.basic-checks-only == 'true'
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: Cache pre-commit envs
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: "pre-commit-basic-${{steps.host-python-version.outputs.host-python-version}}-\
${{ hashFiles('.pre-commit-config.yaml') }}"
restore-keys: pre-commit-basic-${{steps.host-python-version.outputs.host-python-version}}
- name: Fetch incoming commit ${{ github.sha }} with its parent
uses: actions/checkout@v3
with:
ref: ${{ github.sha }}
fetch-depth: 2
persist-credentials: false
- name: "Setup python"
uses: actions/setup-python@v4
with:
python-version: ${{ needs.build-info.outputs.default-python-version }}
cache: 'pip'
cache-dependency-path: ./dev/breeze/setup*
- run: ./scripts/ci/install_breeze.sh
- name: "Free space"
run: breeze ci free-space
- name: "Get Python version"
run: "echo \"::set-output name=host-python-version::$(python -c
'import platform; print(platform.python_version())')\""
id: host-python-version
- name: "Static checks: basic checks only"
run: >
breeze static-checks --all-files --show-diff-on-failure --color always
--commit-ref "${{ github.sha }}"
env:
VERBOSE: "false"
SKIP_IMAGE_PRE_COMMITS: "true"
SKIP: ${{ needs.build-info.outputs.skip-pre-commits }}
COLUMNS: "250"
- name: "Fix ownership"
run: breeze ci fix-ownership
if: always()
docs:
timeout-minutes: 45
name: "Build docs"
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs: [build-info, wait-for-ci-images]
if: needs.build-info.outputs.docs-build == 'true'
env:
RUNS_ON: ${{ fromJson(needs.build-info.outputs.runs-on) }}
PYTHON_MAJOR_MINOR_VERSION: ${{ needs.build-info.outputs.default-python-version }}
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
persist-credentials: false
submodules: recursive
- uses: actions/setup-python@v4
with:
python-version: ${{needs.build-info.outputs.default-python-version}}
cache: 'pip'
cache-dependency-path: ./dev/breeze/setup*
- run: ./scripts/ci/install_breeze.sh
- name: "Free space"
run: breeze ci free-space
- name: Pull CI image ${{ env.PYTHON_MAJOR_MINOR_VERSION }}:${{ env.IMAGE_TAG_FOR_THE_BUILD }}
run: breeze ci-image pull --tag-as-latest
env:
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
- uses: actions/cache@v3
id: cache-doc-inventories
with:
path: ./docs/_inventory_cache/
key: docs-inventory-${{ hashFiles('setup.py','setup.cfg','pyproject.toml;') }}
restore-keys: |
docs-inventory-${{ hashFiles('setup.py','setup.cfg','pyproject.toml;') }}
docs-inventory-
- name: "Build docs"
run: breeze build-docs ${{ needs.build-info.outputs.docs-filter }}
- name: Configure AWS credentials
uses: ./.github/actions/configure-aws-credentials
if: >
github.ref == 'refs/heads/main' && github.repository == 'apache/airflow' &&
github.event_name == 'push'
with:
aws-access-key-id: ${{ secrets.DOCS_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.DOCS_AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
- name: "Upload documentation to AWS S3"
if: >
github.ref == 'refs/heads/main' && github.repository == 'apache/airflow' &&
github.event_name == 'push'
run: aws s3 sync --delete ./files/documentation s3://apache-airflow-docs
- name: "Fix ownership"
run: breeze ci fix-ownership
if: always()
prepare-test-provider-packages-wheel:
timeout-minutes: 80
name: "Build and test provider packages wheel"
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs: [build-info, wait-for-ci-images]
env:
RUNS_ON: ${{ fromJson(needs.build-info.outputs.runs-on) }}
PYTHON_MAJOR_MINOR_VERSION: ${{ needs.build-info.outputs.default-python-version }}
if: needs.build-info.outputs.image-build == 'true' && needs.build-info.outputs.default-branch == 'main'
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
persist-credentials: false
if: needs.build-info.outputs.default-branch == 'main'
- name: "Setup python"
uses: actions/setup-python@v4
with:
python-version: ${{ needs.build-info.outputs.default-python-version }}
cache: 'pip'
cache-dependency-path: ./dev/breeze/setup*
- run: ./scripts/ci/install_breeze.sh
- name: "Free space"
run: breeze ci free-space
- name: >
Pull CI image ${{ env.PYTHON_MAJOR_MINOR_VERSION }}:${{ env.IMAGE_TAG_FOR_THE_BUILD }}
run: breeze ci-image pull --tag-as-latest
env:
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
- name: "Cleanup dist files"
run: rm -fv ./dist/*
- name: "Prepare provider documentation"
run: breeze release-management prepare-provider-documentation --answer yes
- name: "Prepare provider packages: wheel"
run: >
breeze release-management prepare-provider-packages
--package-format wheel --version-suffix-for-pypi dev0
- name: "Prepare airflow package: wheel"
run: >
breeze release-management prepare-airflow-package
--package-format wheel --version-suffix-for-pypi dev0
- name: "Install and test provider packages and airflow via wheel files"
run: >
breeze release-management verify-provider-packages
--use-airflow-version wheel --use-packages-from-dist --package-format wheel
env:
SKIP_CONSTRAINTS: "${{ needs.build-info.outputs.upgrade-to-newer-dependencies }}"
- name: "Remove airflow package and replace providers with 2.2-compliant versions"
run: |
rm -vf dist/apache_airflow-*.whl \
dist/apache_airflow_providers_cncf_kubernetes*.whl \
dist/apache_airflow_providers_celery*.whl
pip download --no-deps --dest dist \
apache-airflow-providers-cncf-kubernetes==3.0.0 \
apache-airflow-providers-celery==2.1.3
- name: "Install and test provider packages and airflow on Airflow 2.2 files"
run: >
breeze release-management verify-provider-packages --use-airflow-version 2.2.0
--use-packages-from-dist --package-format wheel --airflow-constraints-reference constraints-2.2.0
env:
# The extras below are all extras that should be installed with Airflow 2.2.0
AIRFLOW_EXTRAS: "airbyte,alibaba,amazon,apache.atlas,apache.beam,apache.cassandra,apache.drill,\
apache.druid,apache.hdfs,apache.hive,apache.kylin,apache.livy,apache.pig,apache.pinot,\
apache.spark,apache.sqoop,apache.webhdfs,asana,async,\
celery,cgroups,cloudant,cncf.kubernetes,dask,databricks,datadog,\
deprecated_api,dingding,discord,docker,\
elasticsearch,exasol,facebook,ftp,github_enterprise,google,google_auth,\
grpc,hashicorp,http,imap,influxdb,jdbc,jenkins,jira,kerberos,ldap,\
leveldb,microsoft.azure,microsoft.mssql,microsoft.psrp,microsoft.winrm,mongo,mysql,\
neo4j,odbc,openfaas,opsgenie,oracle,pagerduty,pandas,papermill,password,plexus,\
postgres,presto,qubole,rabbitmq,redis,salesforce,samba,segment,sendgrid,sentry,\
sftp,singularity,slack,snowflake,sqlite,ssh,statsd,tableau,telegram,trino,vertica,\
virtualenv,yandex,zendesk"
- name: "Fix ownership"
run: breeze ci fix-ownership
if: always()
prepare-test-provider-packages-sdist:
timeout-minutes: 80
name: "Build and test provider packages sdist"
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs: [build-info, wait-for-ci-images]
env:
RUNS_ON: ${{ fromJson(needs.build-info.outputs.runs-on) }}
PYTHON_MAJOR_MINOR_VERSION: ${{ needs.build-info.outputs.default-python-version }}
if: needs.build-info.outputs.image-build == 'true' && needs.build-info.outputs.default-branch == 'main'
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
persist-credentials: false
if: needs.build-info.outputs.default-branch == 'main'
- name: "Setup python"
uses: actions/setup-python@v4
with:
python-version: ${{ needs.build-info.outputs.default-python-version }}
cache: 'pip'
cache-dependency-path: ./dev/breeze/setup*
- run: ./scripts/ci/install_breeze.sh
- name: "Free space"
run: breeze ci free-space
- name: >
Pull CI image ${{ env.PYTHON_MAJOR_MINOR_VERSION }}:${{ env.IMAGE_TAG_FOR_THE_BUILD }}
run: breeze ci-image pull --tag-as-latest
env:
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
- name: "Cleanup dist files"
run: rm -fv ./dist/*
- name: "Prepare provider packages: sdist"
run: >
breeze release-management prepare-provider-packages
--package-format sdist --version-suffix-for-pypi dev0
- name: "Prepare airflow package: sdist"
run: >
breeze release-management prepare-airflow-package
--package-format sdist --version-suffix-for-pypi dev0
- name: "Upload provider distribution artifacts"
uses: actions/upload-artifact@v2
with:
name: airflow-provider-packages
path: "./dist/apache-airflow-providers-*.tar.gz"
retention-days: 1
- name: "Install and test provider packages and airflow via sdist files"
run: >
breeze release-management verify-provider-packages
--use-airflow-version sdist --use-packages-from-dist --package-format sdist
env:
SKIP_CONSTRAINTS: "${{ needs.build-info.outputs.upgrade-to-newer-dependencies }}"
- name: "Fix ownership"
run: breeze ci fix-ownership
if: always()
tests-helm:
timeout-minutes: 80
name: "Python unit tests for Helm chart"
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs: [build-info, wait-for-ci-images]
env:
RUNS_ON: ${{ fromJson(needs.build-info.outputs.runs-on) }}
MOUNT_SELECTED_LOCAL_SOURCES: "true"
TEST_TYPES: "Helm"
BACKEND: ""
DB_RESET: "false"
PYTHON_MAJOR_MINOR_VERSION: ${{needs.build-info.outputs.default-python-version}}
if: >
needs.build-info.outputs.needs-helm-tests == 'true' &&
(github.repository == 'apache/airflow' || github.event_name != 'schedule') &&
needs.build-info.outputs.default-branch == 'main'
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
persist-credentials: false
- name: "Setup python"
uses: actions/setup-python@v4
with:
python-version: ${{ needs.build-info.outputs.default-python-version }}
cache: 'pip'
cache-dependency-path: ./dev/breeze/setup*
- run: ./scripts/ci/install_breeze.sh
- name: "Free space"
run: breeze ci free-space
- name: >
Pull CI image ${{ env.PYTHON_MAJOR_MINOR_VERSION }}:${{ env.IMAGE_TAG_FOR_THE_BUILD }}
run: breeze ci-image pull --tag-as-latest
env:
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
- name: "Tests: Helm"
run: breeze testing helm-tests
env:
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
- name: "Upload airflow logs"
uses: actions/upload-artifact@v3
if: failure()
with:
name: airflow-logs-helm
path: "./files/airflow_logs*"
retention-days: 7
- name: "Upload container logs"
uses: actions/upload-artifact@v3
if: failure()
with:
name: container-logs-helm
path: "./files/container_logs*"
retention-days: 7
- name: "Fix ownership"
run: breeze ci fix-ownership
if: always()
tests-postgres:
timeout-minutes: 130
name: >
Postgres${{matrix.postgres-version}},Py${{matrix.python-version}}:
${{needs.build-info.outputs.test-types}}
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs: [build-info, wait-for-ci-images]
strategy:
matrix:
python-version: ${{ fromJson(needs.build-info.outputs.python-versions) }}
postgres-version: ${{ fromJson(needs.build-info.outputs.postgres-versions) }}
exclude: ${{ fromJson(needs.build-info.outputs.postgres-exclude) }}
fail-fast: false
env:
RUNS_ON: ${{ fromJson(needs.build-info.outputs.runs-on) }}
BACKEND: postgres
POSTGRES_VERSION: ${{ matrix.postgres-version }}
TEST_TYPES: "${{needs.build-info.outputs.test-types}}"
PYTHON_MAJOR_MINOR_VERSION: ${{ matrix.python-version }}
if: needs.build-info.outputs.run-tests == 'true'
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
persist-credentials: false
- name: "Setup python"
uses: actions/setup-python@v4
with:
python-version: ${{ needs.build-info.outputs.default-python-version }}
cache: 'pip'
cache-dependency-path: ./dev/breeze/setup*
- run: ./scripts/ci/install_breeze.sh
- name: "Free space"
run: breeze ci free-space
- name: Pull CI image ${{ env.PYTHON_MAJOR_MINOR_VERSION }}:${{ env.IMAGE_TAG_FOR_THE_BUILD }}
run: breeze ci-image pull --tag-as-latest
env:
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
- name: "Test downgrade"
run: ./scripts/ci/testing/run_downgrade_test.sh
- name: "Test Offline SQL generation"
run: ./scripts/ci/testing/run_offline_sql_test.sh
- name: "Tests: ${{needs.build-info.outputs.test-types}}"
run: ./scripts/ci/testing/ci_run_airflow_testing.sh
env:
PR_LABELS: "${{ needs.build-info.outputs.pull-request-labels }}"
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
- name: "Upload airflow logs"
uses: actions/upload-artifact@v3
if: failure()
with:
name: airflow-logs-${{matrix.python-version}}-${{matrix.postgres-version}}
path: "./files/airflow_logs*"
retention-days: 7
- name: "Upload container logs"
uses: actions/upload-artifact@v3
if: failure()
with:
name: container-logs-postgres-${{matrix.python-version}}-${{matrix.postgres-version}}
path: "./files/container_logs*"
retention-days: 7
- name: "Upload artifact for coverage"
uses: actions/upload-artifact@v3
if: needs.build-info.outputs.run-coverage == 'true'
with:
name: coverage-postgres-${{matrix.python-version}}-${{matrix.postgres-version}}
path: "./files/coverage*.xml"
retention-days: 7
- name: "Fix ownership"
run: breeze ci fix-ownership
if: always()
tests-mysql:
timeout-minutes: 130
name: >
MySQL${{matrix.mysql-version}}, Py${{matrix.python-version}}: ${{needs.build-info.outputs.test-types}}
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs: [build-info, wait-for-ci-images]
strategy:
matrix:
python-version: ${{ fromJson(needs.build-info.outputs.python-versions) }}
mysql-version: ${{ fromJson(needs.build-info.outputs.mysql-versions) }}
exclude: ${{ fromJson(needs.build-info.outputs.mysql-exclude) }}
fail-fast: false
env:
RUNS_ON: ${{ fromJson(needs.build-info.outputs.runs-on) }}
BACKEND: mysql
MYSQL_VERSION: ${{ matrix.mysql-version }}
TEST_TYPES: "${{needs.build-info.outputs.test-types}}"
PYTHON_MAJOR_MINOR_VERSION: ${{ matrix.python-version }}
if: needs.build-info.outputs.run-tests == 'true'
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
persist-credentials: false
- name: "Setup python"
uses: actions/setup-python@v4
with:
python-version: ${{ needs.build-info.outputs.default-python-version }}
cache: 'pip'
cache-dependency-path: ./dev/breeze/setup*
- run: ./scripts/ci/install_breeze.sh
- name: "Free space"
run: breeze ci free-space
- name: Pull CI image ${{ env.PYTHON_MAJOR_MINOR_VERSION }}:${{ env.IMAGE_TAG_FOR_THE_BUILD }}
run: breeze ci-image pull --tag-as-latest
env:
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
- name: "Test downgrade"
run: ./scripts/ci/testing/run_downgrade_test.sh
- name: "Tests: ${{needs.build-info.outputs.test-types}}"
run: ./scripts/ci/testing/ci_run_airflow_testing.sh
env:
PR_LABELS: "${{ needs.build-info.outputs.pull-request-labels }}"
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
- name: "Upload airflow logs"
uses: actions/upload-artifact@v3
if: failure()
with:
name: airflow-logs-${{matrix.python-version}}-${{matrix.mysql-version}}
path: "./files/airflow_logs*"
retention-days: 7
- name: "Upload container logs"
uses: actions/upload-artifact@v3
if: failure()
with:
name: container-logs-mysql-${{matrix.python-version}}-${{matrix.mysql-version}}
path: "./files/container_logs*"
retention-days: 7
- name: "Upload artifact for coverage"
uses: actions/upload-artifact@v3
if: needs.build-info.outputs.run-coverage == 'true'
with:
name: coverage-mysql-${{matrix.python-version}}-${{matrix.mysql-version}}
path: "./files/coverage*.xml"
retention-days: 7
- name: "Fix ownership"
run: breeze ci fix-ownership
if: always()
tests-mssql:
timeout-minutes: 130
name: >
MSSQL${{matrix.mssql-version}}, Py${{matrix.python-version}}: ${{needs.build-info.outputs.test-types}}
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs: [build-info, wait-for-ci-images]
strategy:
matrix:
python-version: ${{ fromJson(needs.build-info.outputs.python-versions) }}
mssql-version: ${{ fromJson(needs.build-info.outputs.mssql-versions) }}
exclude: ${{ fromJson(needs.build-info.outputs.mssql-exclude) }}
fail-fast: false
env:
RUNS_ON: ${{ fromJson(needs.build-info.outputs.runs-on) }}
BACKEND: mssql
MSSQL_VERSION: ${{ matrix.mssql-version }}
TEST_TYPES: "${{needs.build-info.outputs.test-types}}"
PYTHON_MAJOR_MINOR_VERSION: ${{ matrix.python-version }}
if: needs.build-info.outputs.run-tests == 'true'
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
persist-credentials: false
- name: "Setup python"
uses: actions/setup-python@v4
with:
python-version: ${{ needs.build-info.outputs.default-python-version }}
cache: 'pip'
cache-dependency-path: ./dev/breeze/setup*
- run: ./scripts/ci/install_breeze.sh
- name: "Free space"
run: breeze ci free-space
- name: Pull CI image ${{ env.PYTHON_MAJOR_MINOR_VERSION }}:${{ env.IMAGE_TAG_FOR_THE_BUILD }}
run: breeze ci-image pull --tag-as-latest
env:
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
- name: "Test downgrade"
run: ./scripts/ci/testing/run_downgrade_test.sh
- name: "Tests: ${{needs.build-info.outputs.test-types}}"
run: ./scripts/ci/testing/ci_run_airflow_testing.sh
env:
PR_LABELS: "${{ needs.build-info.outputs.pull-request-labels }}"
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
- name: "Upload airflow logs"
uses: actions/upload-artifact@v3
if: failure()
with:
name: airflow-logs-${{matrix.python-version}}-${{matrix.mssql-version}}
path: "./files/airflow_logs*"
retention-days: 7
- name: "Upload container logs"
uses: actions/upload-artifact@v3
if: failure()
with:
name: container-logs-mssql-${{matrix.python-version}}-${{matrix.mssql-version}}
path: "./files/container_logs*"
retention-days: 7
- name: "Upload artifact for coverage"
uses: actions/upload-artifact@v3
if: needs.build-info.outputs.run-coverage == 'true'
with:
name: coverage-mssql-${{matrix.python-version}}-${{matrix.mssql-version}}
path: "./files/coverage*.xml"
retention-days: 7
- name: "Fix ownership"
run: breeze ci fix-ownership
if: always()
tests-sqlite:
timeout-minutes: 130
name: >
Sqlite Py${{matrix.python-version}}: ${{needs.build-info.outputs.test-types}}
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs: [build-info, wait-for-ci-images]
strategy:
matrix:
python-version: ${{ fromJson(needs.build-info.outputs.python-versions) }}
exclude: ${{ fromJson(needs.build-info.outputs.sqlite-exclude) }}
fail-fast: false
env:
RUNS_ON: ${{ fromJson(needs.build-info.outputs.runs-on) }}
BACKEND: sqlite
TEST_TYPES: "${{needs.build-info.outputs.test-types}}"
PYTHON_MAJOR_MINOR_VERSION: ${{ matrix.python-version }}
if: needs.build-info.outputs.run-tests == 'true'
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
persist-credentials: false
- name: "Setup python"
uses: actions/setup-python@v4
with:
python-version: ${{ needs.build-info.outputs.default-python-version }}
cache: 'pip'
cache-dependency-path: ./dev/breeze/setup*
- run: ./scripts/ci/install_breeze.sh
- name: "Free space"
run: breeze ci free-space
- name: Pull CI image ${{ env.PYTHON_MAJOR_MINOR_VERSION }}:${{ env.IMAGE_TAG_FOR_THE_BUILD }}
run: breeze ci-image pull --tag-as-latest
env:
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
- name: "Test downgrade"
run: ./scripts/ci/testing/run_downgrade_test.sh
- name: "Tests: ${{needs.build-info.outputs.test-types}}"
run: ./scripts/ci/testing/ci_run_airflow_testing.sh
env:
PR_LABELS: "${{ needs.build-info.outputs.pull-request-labels }}"
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
- name: "Upload airflow logs"
uses: actions/upload-artifact@v3
if: failure()
with:
name: airflow-logs-${{matrix.python-version}}
path: './files/airflow_logs*'
retention-days: 7
- name: "Upload container logs"
uses: actions/upload-artifact@v3
if: failure()
with:
name: container-logs-sqlite-${{matrix.python-version}}
path: "./files/container_logs*"
retention-days: 7
- name: "Upload artifact for coverage"
uses: actions/upload-artifact@v3
if: needs.build-info.outputs.run-coverage == 'true'
with:
name: coverage-sqlite-${{matrix.python-version}}
path: ./files/coverage*.xml
retention-days: 7
- name: "Fix ownership"
run: breeze ci fix-ownership
if: always()
tests-quarantined:
timeout-minutes: 60
name: "Quarantined tests"
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
continue-on-error: true
needs: [build-info, wait-for-ci-images]
env:
RUNS_ON: ${{ fromJson(needs.build-info.outputs.runs-on) }}
MYSQL_VERSION: ${{needs.build-info.outputs.default-mysql-version}}
POSTGRES_VERSION: ${{needs.build-info.outputs.default-postgres-version}}
TEST_TYPES: "Quarantined"
PYTHON_MAJOR_MINOR_VERSION: ${{ needs.build-info.outputs.default-python-version }}
if: needs.build-info.outputs.run-tests == 'true'
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
persist-credentials: false
- name: "Setup python"
uses: actions/setup-python@v4
with:
python-version: ${{ needs.build-info.outputs.default-python-version }}
cache: 'pip'
cache-dependency-path: ./dev/breeze/setup*
- name: "Set issue id for main"
if: github.ref == 'refs/heads/main'
run: |
echo "ISSUE_ID=10118" >> $GITHUB_ENV
- name: "Set issue id for v1-10-stable"
if: github.ref == 'refs/heads/v1-10-stable'
run: |
echo "ISSUE_ID=10127" >> $GITHUB_ENV
- name: "Set issue id for v1-10-test"
if: github.ref == 'refs/heads/v1-10-test'
run: |
echo "ISSUE_ID=10128" >> $GITHUB_ENV
- run: ./scripts/ci/install_breeze.sh
- name: "Free space"
run: breeze ci free-space
- name: Pull CI image ${{ env.PYTHON_MAJOR_MINOR_VERSION }}:${{ env.IMAGE_TAG_FOR_THE_BUILD }}
run: breeze ci-image pull --tag-as-latest
env:
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
- name: "Tests: Quarantined"
run: ./scripts/ci/testing/ci_run_quarantined_tests.sh
env:
PR_LABELS: "${{ needs.build-info.outputs.pull-request-labels }}"
- name: "Upload Quarantine test results"
uses: actions/upload-artifact@v3
if: always()
with:
name: quarantined-tests
path: "files/test_result-*.xml"
retention-days: 7
- name: "Upload airflow logs"
uses: actions/upload-artifact@v3
if: failure()
with:
name: airflow-logs-quarantined-${{ matrix.backend }}
path: "./files/airflow_logs*"
retention-days: 7
- name: "Upload container logs"
uses: actions/upload-artifact@v3
if: failure()
with:
name: container-logs-quarantined-${{ matrix.backend }}
path: "./files/container_logs*"
retention-days: 7
- name: "Upload artifact for coverage"
uses: actions/upload-artifact@v3
if: needs.build-info.outputs.run-coverage == 'true'
with:
name: coverage-quarantined-${{ matrix.backend }}
path: "./files/coverage*.xml"
retention-days: 7
- name: "Fix ownership"
run: breeze ci fix-ownership
if: always()
upload-coverage:
timeout-minutes: 15
name: "Upload coverage"
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
continue-on-error: true
needs:
- build-info
- tests-postgres
- tests-sqlite
- tests-mysql
- tests-mssql
- tests-quarantined
env:
RUNS_ON: ${{ fromJson(needs.build-info.outputs.runs-on) }}
# Only upload coverage on merges to main
if: needs.build-info.outputs.run-coverage == 'true'
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
persist-credentials: false
submodules: recursive
- name: "Download all artifacts from the current build"
uses: actions/download-artifact@v3
with:
path: ./coverage-files
- name: "Removes unnecessary artifacts"
run: ls ./coverage-files | grep -v coverage | xargs rm -rfv
- name: "Upload all coverage reports to codecov"
uses: ./.github/actions/codecov-action
with:
directory: "./coverage-files"
wait-for-prod-images:
timeout-minutes: 120
name: "Wait for PROD images"
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs: [build-info, wait-for-ci-images, build-prod-images]
if: needs.build-info.outputs.image-build == 'true'
env:
RUNS_ON: ${{ fromJson(needs.build-info.outputs.runs-on) }}
BACKEND: sqlite
PYTHON_MAJOR_MINOR_VERSION: ${{ needs.build-info.outputs.default-python-version }}
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
persist-credentials: false
- name: "Setup python"
uses: actions/setup-python@v4
with:
python-version: ${{ needs.build-info.outputs.default-python-version }}
cache: 'pip'
cache-dependency-path: ./dev/breeze/setup*
- run: ./scripts/ci/install_breeze.sh
- name: "Free space"
run: breeze ci free-space
- name: "Cache virtualenv environment"
uses: actions/cache@v3
with:
path: '.build/.docker_venv'
key: ${{ runner.os }}-docker-venv-${{ hashFiles('scripts/ci/images/ci_run_docker_tests.py') }}
- name: Wait for PROD images ${{ env.PYTHON_VERSIONS }}:${{ env.IMAGE_TAG_FOR_THE_BUILD }}
# We wait for the images to be available either from "build-images.yml' run as pull_request_target
# or from build-prod-images above.
# We are utilising single job to wait for all images because this job merely waits
# For the images to be available and test them.
run: breeze prod-image pull --verify --wait-for-image --run-in-parallel
env:
PYTHON_VERSIONS: ${{ needs.build-info.outputs.python-versions-list-as-string }}
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
- name: "Fix ownership"
run: breeze ci fix-ownership
if: always()
test-docker-compose-quick-start:
timeout-minutes: 60
name: "Test docker-compose quick start"
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs: [build-info, wait-for-prod-images]
if: needs.build-info.outputs.image-build == 'true'
env:
PYTHON_MAJOR_MINOR_VERSION: ${{ needs.build-info.outputs.default-python-version }}
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
fetch-depth: 2
persist-credentials: false
- name: "Setup python"
uses: actions/setup-python@v4
with:
python-version: ${{ needs.build-info.outputs.default-python-version }}
cache: 'pip'
cache-dependency-path: ./dev/breeze/setup*
- run: ./scripts/ci/install_breeze.sh
- name: "Free space"
run: breeze ci free-space
- name: Pull PROD image ${{ env.PYTHON_MAJOR_MINOR_VERSION }}:${{ env.IMAGE_TAG_FOR_THE_BUILD }}
run: breeze prod-image pull --tag-as-latest
env:
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
- name: "Test docker-compose quick start"
run: breeze testing docker-compose-tests
- name: "Fix ownership"
run: breeze ci fix-ownership
if: always()
tests-kubernetes:
timeout-minutes: 240
name: Helm Chart; ${{matrix.executor}} - ${{needs.build-info.outputs.kubernetes-versions-list-as-string}}
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs: [build-info, wait-for-prod-images]
strategy:
matrix:
executor: [KubernetesExecutor, CeleryExecutor, LocalExecutor]
fail-fast: false
env:
RUNS_ON: ${{ fromJson(needs.build-info.outputs.runs-on) }}
BACKEND: postgres
RUN_TESTS: "true"
RUNTIME: "kubernetes"
KUBERNETES_MODE: "image"
EXECUTOR: ${{matrix.executor}}
KIND_VERSION: "${{ needs.build-info.outputs.default-kind-version }}"
HELM_VERSION: "${{ needs.build-info.outputs.default-helm-version }}"
CURRENT_PYTHON_MAJOR_MINOR_VERSIONS_AS_STRING: >
${{needs.build-info.outputs.python-versions-list-as-string}}
CURRENT_KUBERNETES_VERSIONS_AS_STRING: >
${{needs.build-info.outputs.kubernetes-versions-list-as-string}}
if: >
( needs.build-info.outputs.run-kubernetes-tests == 'true' ||
needs.build-info.outputs.needs-helm-tests == 'true' ) &&
needs.build-info.outputs.default-branch == 'main'
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
persist-credentials: false
- name: "Setup python"
uses: actions/setup-python@v4
with:
python-version: ${{ needs.build-info.outputs.default-python-version }}
cache: 'pip'
cache-dependency-path: ./dev/breeze/setup*
- run: ./scripts/ci/install_breeze.sh
- name: "Free space"
run: breeze ci free-space
- name: Pull PROD images ${{ env.PYTHON_VERSIONS }}:${{ env.IMAGE_TAG_FOR_THE_BUILD }}
run: breeze prod-image pull --run-in-parallel --tag-as-latest
env:
PYTHON_VERSIONS: ${{ needs.build-info.outputs.python-versions-list-as-string }}
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
- name: "Cache bin folder with tools for kubernetes testing"
uses: actions/cache@v3
with:
path: ".build/kubernetes-bin"
key: "kubernetes-binaries
-${{ needs.build-info.outputs.default-kind-version }}\
-${{ needs.build-info.outputs.default-helm-version }}"
restore-keys: "kubernetes-binaries"
- name: "Kubernetes Tests"
run: ./scripts/ci/kubernetes/ci_setup_clusters_and_run_kubernetes_tests_in_parallel.sh
env:
PR_LABELS: "${{ needs.build-info.outputs.pull-request-labels }}"
- name: "Upload KinD logs"
uses: actions/upload-artifact@v3
if: failure() || cancelled()
with:
name: kind-logs-${{matrix.executor}}
path: /tmp/kind_logs_*
retention-days: 7
- name: "Fix ownership"
run: breeze ci fix-ownership
if: always()
tests-helm-executor-upgrade:
timeout-minutes: 150
name: Helm Chart Executor Upgrade - ${{needs.build-info.outputs.min-max-kubernetes-versions-as-string}}
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs: [build-info, wait-for-prod-images]
env:
RUNS_ON: ${{ fromJson(needs.build-info.outputs.runs-on) }}
BACKEND: postgres
RUN_TESTS: "true"
RUNTIME: "kubernetes"
KUBERNETES_MODE: "image"
EXECUTOR: "KubernetesExecutor"
KIND_VERSION: "${{ needs.build-info.outputs.default-kind-version }}"
HELM_VERSION: "${{ needs.build-info.outputs.default-helm-version }}"
CURRENT_PYTHON_MAJOR_MINOR_VERSIONS_AS_STRING: >-
${{needs.build-info.outputs.min-max-python-versions-as-string}}
CURRENT_KUBERNETES_VERSIONS_AS_STRING: >-
${{needs.build-info.outputs.min-max-kubernetes-versions-as-string}}
if: >
needs.build-info.outputs.run-kubernetes-tests == 'true' &&
needs.build-info.outputs.default-branch == 'main'
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
persist-credentials: false
- name: "Setup python"
uses: actions/setup-python@v4
with:
python-version: ${{ needs.build-info.outputs.default-python-version }}
cache: 'pip'
cache-dependency-path: ./dev/breeze/setup*
- run: ./scripts/ci/install_breeze.sh
- name: "Free space"
run: breeze ci free-space
- name: Pull PROD images ${{ env.PYTHON_VERSIONS }}:${{ env.IMAGE_TAG_FOR_THE_BUILD }}
run: breeze prod-image pull --run-in-parallel --tag-as-latest
env:
PYTHON_VERSIONS: ${{ needs.build-info.outputs.python-versions-list-as-string }}
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
- name: "Cache virtualenv for kubernetes testing"
uses: actions/cache@v3
with:
path: ".build/.kubernetes_venv"
key: "kubernetes-${{ needs.build-info.outputs.default-python-version }}\
-${{needs.build-info.outputs.min-max-kubernetes-versions-as-string}}
-${{needs.build-info.outputs.min-max-python-versions-as-string}}
-${{ hashFiles('setup.py','setup.cfg') }}"
restore-keys: "kubernetes-${{ needs.build-info.outputs.default-python-version }}-\
-${{needs.build-info.outputs.min-max-kubernetes-versions-as-string}} \
-${{needs.build-info.outputs.min-max-python-versions-as-string}}"
- name: "Cache bin folder with tools for kubernetes testing"
uses: actions/cache@v3
with:
path: ".build/kubernetes-bin"
key: "kubernetes-binaries
-${{ needs.build-info.outputs.default-kind-version }}\
-${{ needs.build-info.outputs.default-helm-version }}"
restore-keys: "kubernetes-binaries"
- name: "Kubernetes Helm Chart Executor Upgrade Tests"
run: ./scripts/ci/kubernetes/ci_upgrade_cluster_with_different_executors_in_parallel.sh
env:
PR_LABELS: "${{ needs.build-info.outputs.pull-request-labels }}"
- name: "Upload KinD logs"
uses: actions/upload-artifact@v3
if: failure() || cancelled()
with:
name: kind-logs-KubernetesExecutor
path: /tmp/kind_logs_*
retention-days: 7
- name: "Fix ownership"
run: breeze ci fix-ownership
if: always()
constraints:
permissions:
contents: write
timeout-minutes: 40
name: "Constraints"
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs:
- build-info
- docs
- wait-for-ci-images
- wait-for-prod-images
- static-checks
- tests-sqlite
- tests-mysql
- tests-mssql
- tests-postgres
env:
RUNS_ON: ${{ fromJson(needs.build-info.outputs.runs-on) }}
if: needs.build-info.outputs.upgrade-to-newer-dependencies != 'false'
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
persist-credentials: false
submodules: recursive
- name: "Setup python"
uses: actions/setup-python@v4
with:
python-version: ${{ needs.build-info.outputs.default-python-version }}
cache: 'pip'
cache-dependency-path: ./dev/breeze/setup*
- run: ./scripts/ci/install_breeze.sh
- name: "Free space"
run: breeze ci free-space
- name: Pull CI images ${{ env.PYTHON_VERSIONS }}:${{ env.IMAGE_TAG_FOR_THE_BUILD }}
run: breeze ci-image pull --run-in-parallel --tag-as-latest
env:
PYTHON_VERSIONS: ${{ needs.build-info.outputs.python-versions-list-as-string }}
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
- name: "Generate constraints"
run: |
breeze release-management generate-constraints --run-in-parallel \
--airflow-constraints-mode constraints-source-providers
breeze release-management generate-constraints \
--run-in-parallel --airflow-constraints-mode constraints-no-providers
breeze release-management generate-constraints \
--run-in-parallel --airflow-constraints-mode constraints
env:
PYTHON_VERSIONS: ${{ needs.build-info.outputs.python-versions-list-as-string }}
- name: "Set constraints branch name"
id: constraints-branch
run: ./scripts/ci/constraints/ci_branch_constraints.sh
if: needs.build-info.outputs.merge-run == 'true'
- name: Checkout ${{ steps.constraints-branch.outputs.branch }}
uses: actions/checkout@v3
if: needs.build-info.outputs.merge-run == 'true'
with:
path: "repo"
ref: ${{ steps.constraints-branch.outputs.branch }}
persist-credentials: false
- name: "Commit changed constraint files for ${{needs.build-info.outputs.python-versions}}"
run: ./scripts/ci/constraints/ci_commit_constraints.sh
if: needs.build-info.outputs.merge-run == 'true'
- name: "Push changes"
uses: ./.github/actions/github-push-action
if: needs.build-info.outputs.merge-run == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ steps.constraints-branch.outputs.branch }}
directory: "repo"
- name: "Fix ownership"
run: breeze ci fix-ownership
if: always()
# Push BuildX cache to GitHub Registry in Apache repository, if all tests are successful and build
# is executed as result of direct push to "main" or one of the "vX-Y-test" branches
# It rebuilds all images using just-pushed constraints using buildx and pushes them to registry
# It will automatically check if a new python image was released and will pull the latest one if needed
push-buildx-cache-to-github-registry:
permissions:
packages: write
timeout-minutes: 50
name: "Push Image Cache"
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs:
- build-info
- constraints
- docs
if: needs.build-info.outputs.merge-run == 'true'
strategy:
fail-fast: false
matrix:
platform: ["linux/amd64", "linux/arm64"]
env:
RUNS_ON: ${{ fromJson(needs.build-info.outputs.runs-on) }}
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
persist-credentials: false
- name: "Setup python"
uses: actions/setup-python@v4
with:
python-version: ${{ needs.build-info.outputs.default-python-version }}
cache: 'pip'
cache-dependency-path: ./dev/breeze/setup*
- run: ./scripts/ci/install_breeze.sh
- name: "Free space"
run: breeze ci free-space
- name: >
Pull CI image for PROD build
${{ env.PYTHON_MAJOR_MINOR_VERSION }}:${{ env.IMAGE_TAG_FOR_THE_BUILD }}"
run: breeze ci-image pull --tag-as-latest
env:
# Always use default Python version of CI image for preparing packages
PYTHON_MAJOR_MINOR_VERSION: ${{ needs.build-info.outputs.default-python-version }}
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
- name: "Cleanup dist and context file"
run: rm -fv ./dist/* ./docker-context-files/*
- name: "Prepare airflow package for PROD build"
run: breeze release-management prepare-airflow-package --package-format wheel
env:
VERSION_SUFFIX_FOR_PYPI: "dev0"
- name: "Prepare providers packages for PROD build"
run: >
breeze release-management prepare-provider-packages
--package-list-file ./scripts/ci/installed_providers.txt
--package-format wheel
env:
VERSION_SUFFIX_FOR_PYPI: "dev0"
if: needs.build-info.outputs.default-branch == 'main'
- name: "Start ARM instance"
run: ./scripts/ci/images/ci_start_arm_instance_and_connect_to_docker.sh
if: matrix.platform == 'linux/arm64'
- name: "Push CI cache ${{ matrix.platform }}"
run: >
breeze ci-image build
--builder airflow_cache
--prepare-buildx-cache
--run-in-parallel
--force-build
--platform ${{ matrix.platform }}
- name: "Push CI latest image ${{ matrix.platform }}"
run: >
breeze ci-image build
--tag-as-latest --push --run-in-parallel --platform ${{ matrix.platform }}
if: matrix.platform == 'linux/amd64'
- name: "Move dist packages to docker-context files"
run: mv -v ./dist/*.whl ./docker-context-files
- name: "Push PROD cache ${{ matrix.python-version }} ${{ matrix.platform }}"
run: >
breeze prod-image build
--builder airflow_cache
--install-packages-from-context
--prepare-buildx-cache
--platform ${{ matrix.platform }}
if: needs.build-info.outputs.default-branch == 'main'
- name: "Push PROD latest image ${{ matrix.platform }}"
run: >
breeze prod-image build --tag-as-latest --install-packages-from-context
--push --run-in-parallel --platform ${{ matrix.platform }}
if: matrix.platform == 'linux/amd64'
- name: "Stop ARM instance"
run: ./scripts/ci/images/ci_stop_arm_instance.sh
if: always() && matrix.platform == 'linux/arm64'
- name: "Fix ownership"
run: breeze ci fix-ownership
if: always()
build-ci-arm-images:
timeout-minutes: 50
name: >
Build CI ARM images
${{ needs.build-info.outputs.all-python-versions-list-as-string }}
runs-on: ${{ fromJson(needs.build-info.outputs.runs-on) }}
needs:
- build-info
- wait-for-ci-images
- wait-for-prod-images
- static-checks
- tests-sqlite
- tests-mysql
- tests-mssql
- tests-postgres
env:
DEFAULT_BRANCH: ${{ needs.build-info.outputs.default-branch }}
DEFAULT_CONSTRAINTS_BRANCH: ${{ needs.build-info.outputs.default-constraints-branch }}
RUNS_ON: ${{ fromJson(needs.build-info.outputs.runs-on)[0] }}
if: >
needs.build-info.outputs.upgrade-to-newer-dependencies != 'false' &&
needs.build-info.outputs.in-workflow-build == 'true' &&
needs.build-info.outputs.merge-run != 'true'
steps:
- name: Cleanup repo
run: docker run -v "${GITHUB_WORKSPACE}:/workspace" -u 0:0 bash -c "rm -rf /workspace/*"
- uses: actions/checkout@v2
with:
ref: ${{ needs.build-info.outputs.targetCommitSha }}
persist-credentials: false
submodules: recursive
- name: "Setup python"
uses: actions/setup-python@v2
with:
python-version: ${{ needs.build-info.outputs.default-python-version }}
- run: ./scripts/ci/install_breeze.sh
- name: "Free space"
run: breeze ci free-space
- name: "Start ARM instance"
run: ./scripts/ci/images/ci_start_arm_instance_and_connect_to_docker.sh
- name: >
Build CI ARM images ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
${{ needs.build-info.outputs.all-python-versions-list-as-string }}
run: >
breeze ci-image build
--run-in-parallel
--builder airflow_cache
--platform "linux/arm64"
env:
UPGRADE_TO_NEWER_DEPENDENCIES: ${{ needs.build-info.outputs.upgrade-to-newer-dependencies }}
DOCKER_CACHE: ${{ needs.build-info.outputs.cache-directive }}
IMAGE_TAG: ${{ env.IMAGE_TAG_FOR_THE_BUILD }}
PYTHON_VERSIONS: ${{ needs.build-info.outputs.all-python-versions-list-as-string }}
- name: "Stop ARM instance"
run: ./scripts/ci/images/ci_stop_arm_instance.sh
if: always()
- name: "Fix ownership"
run: breeze ci fix-ownership
if: always()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/mingganci/apache-airflow.git
git@gitee.com:mingganci/apache-airflow.git
mingganci
apache-airflow
airflow
main

搜索帮助

344bd9b3 5694891 D2dac590 5694891