Skip to content

Commit

Permalink
All versions in CI yamls are not hard-coded any more (#10959)
Browse files Browse the repository at this point in the history
GitHub Actions allow to use `fromJson` method to read arrays
or even more complex json objects into the CI workflow yaml files.

This, connected with set::output commands, allows to read the
list of allowed versions as well as default ones from the
environment variables configured in
./scripts/ci/libraries/initialization.sh

This means that we can have one plece in which versions are
configured. We also need to do it in "breeze-complete" as this is
a standalone script that should not source anything we added
BATS tests to verify if the versions in breeze-complete
correspond with those defined in the initialization.sh

Also we do not limit tests any more in regular PRs now - we run
all combinations of available versions. Our tests run quite a
bit faster now so we should be able to run more complete
matrixes. We can still exclude individual values of the matrixes
if this is too much.

MySQL 8 is disabled from breeze for now. I plan a separate follow
up PR where we will run MySQL 8 tests (they were not run so far)

(cherry picked from commit 3db4d3b)
  • Loading branch information
potiuk authored and kaxil committed Nov 12, 2020
1 parent 629d064 commit 37124af
Show file tree
Hide file tree
Showing 6 changed files with 334 additions and 85 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/build-images-workflow-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ env:
DB_RESET: "true"
VERBOSE: "true"
UPGRADE_TO_LATEST_CONSTRAINTS: false
PYTHON_MAJOR_MINOR_VERSION: 3.6
USE_GITHUB_REGISTRY: "true"
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_USERNAME: ${{ github.actor }}
Expand Down Expand Up @@ -160,10 +159,16 @@ jobs:
needs: [cancel-workflow-runs]
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
outputs:
pythonVersions: ${{ steps.versions.outputs.python-versions }}
allPythonVersions: ${{ steps.versions.outputs.all-python-versions }}
defaultPythonVersion: ${{ steps.versions.outputs.default-python-version }}
if: >
needs.cancel-workflow-runs.outputs.buildImages == 'true' &&
(github.repository == 'apache/airflow' || github.event.workflow_run.event != 'schedule')
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v2
- name: >
Event: ${{ needs.cancel-workflow-runs.outputs.sourceEvent }}
Repo: ${{ needs.cancel-workflow-runs.outputs.sourceHeadRepo }}
Expand All @@ -174,15 +179,28 @@ jobs:
Source Sha: ${{ needs.cancel-workflow-runs.outputs.sourceHeadSha }}
run: |
printenv
- name: Set versions
id: versions
run: |
. ./scripts/ci/libraries/_script_init.sh
initialization::ga_output python-versions \
"$(initialization::parameters_to_json "${CURRENT_PYTHON_MAJOR_MINOR_VERSIONS[@]}")"
initialization::ga_output default-python-version "${CURRENT_PYTHON_MAJOR_MINOR_VERSIONS[0]}"
initialization::ga_output all-python-versions \
"$(initialization::parameters_to_json "${ALL_PYTHON_MAJOR_MINOR_VERSIONS[@]}")"
build-images:
timeout-minutes: 80
name: "Build ${{matrix.image-type}} images ${{matrix.python-version}}"
runs-on: ubuntu-latest
needs: [cancel-workflow-runs]
needs: [build-info, cancel-workflow-runs]
strategy:
matrix:
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
# We need to attempt to build all possible versions here because workflow_run
# event is run from master for both master and v1-10-tests
python-version: ${{ fromJson(needs.build-info.outputs.allPythonVersions) }}
image-type: [CI, PROD]
fail-fast: true
if: >
Expand Down Expand Up @@ -239,7 +257,7 @@ jobs:
- name: "Setup python"
uses: actions/setup-python@v2
with:
python-version: 3.6
python-version: ${{ needs.build-info.outputs.defaultPythonVersion }}
if: steps.defaults.outputs.proceed == 'true'
- name: "Override 'scripts/ci' with the ${{ github.ref }} version so that the PR cannot override it."
# We should not override those scripts which become part of the image as they will not be
Expand Down
Loading

0 comments on commit 37124af

Please sign in to comment.