Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit de81742

Browse files
author
Tobiasz Kędzierski
authored
[BEAM-10599] Add documentation about CI on GitHub Action (#12405)
[BEAM-10599] Add documentation about CI on GitHub Action (#12405)
1 parent 5e71256 commit de81742

4 files changed

Lines changed: 118 additions & 5 deletions

File tree

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,10 @@ Non-portable | [![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_Ja
3030
Portable | --- | [![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_Portable_Python_Cron/lastCompletedBuild/badge/icon)](https://ci-beam.apache.org/job/beam_PreCommit_Portable_Python_Cron/lastCompletedBuild/) | --- | ---
3131

3232
See [.test-infra/jenkins/README](https://github.com/apache/beam/blob/master/.test-infra/jenkins/README.md) for trigger phrase, status and link of all Jenkins jobs.
33+
34+
35+
GitHub Actions Tests Status (on master branch)
36+
------------------------------------------------------------------------------------------------
37+
![Build python source distribution and wheels](https://github.com/apache/beam/workflows/Build%20python%20source%20distribution%20and%20wheels/badge.svg)
38+
39+
See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI.

.github/workflows/build_wheels.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# under the License.
1717
#
1818

19-
name: Build python wheels
19+
name: Build python source distribution and wheels
2020

2121
on:
2222
schedule:
@@ -38,6 +38,7 @@ jobs:
3838

3939
build_source:
4040
runs-on: ubuntu-latest
41+
name: Build python source distribution
4142
steps:
4243
- name: Checkout code
4344
uses: actions/checkout@v2
@@ -90,7 +91,7 @@ jobs:
9091
run: gsutil rm -r ${{ env.GCP_PATH }} || true
9192

9293
upload_source_to_gcs:
93-
name: Upload source to GCS bucket
94+
name: Upload python source distribution to GCS bucket
9495
needs: prepare_gcs
9596
runs-on: ubuntu-latest
9697
if: github.repository_owner == 'apache'
@@ -109,7 +110,7 @@ jobs:
109110
run: gsutil cp -r -a public-read source/* ${{ env.GCP_PATH }}
110111

111112
build_wheels:
112-
name: Build wheels on ${{ matrix.os_python.os }}
113+
name: Build python wheels on ${{ matrix.os_python.os }}
113114
needs: build_source
114115
runs-on: ${{ matrix.os_python.os }}
115116
strategy:
@@ -120,7 +121,7 @@ jobs:
120121
{"os": "windows-latest", "python": "cp35-* cp36-* cp37-* cp38-*"},
121122
]
122123
steps:
123-
- name: Download source from artifacts
124+
- name: Download python source distribution from artifacts
124125
uses: actions/download-artifact@v2
125126
with:
126127
name: source
@@ -155,7 +156,7 @@ jobs:
155156
path: apache-beam-source/wheelhouse/
156157

157158
upload_wheels_to_gcs:
158-
name: Upload wheels to GCS bucket
159+
name: Upload python wheels to GCS bucket
159160
needs: build_wheels
160161
runs-on: ubuntu-latest
161162
if: github.repository_owner == 'apache' && github.event_name != 'pull_request'

CI.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<!--
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
-->
19+
20+
# Apache Beam
21+
22+
## CI Environment
23+
24+
Continuous Integration is important component of making Apache Beam robust and stable.
25+
26+
Our execution environment for CI is mainly the Jenkins which is available at
27+
[https://ci-beam.apache.org/](https://ci-beam.apache.org/). See
28+
[.test-infra/jenkins/README](.test-infra/jenkins/README.md)
29+
for trigger phrase, status and link of all Jenkins jobs. See Apache Beam Developer Guide for
30+
[Jenkins Tips](https://cwiki.apache.org/confluence/display/BEAM/Jenkins+Tips).
31+
32+
An additional execution environment for CI is [GitHub Actions](https://github.com/features/actions). GitHub Actions
33+
(GA) are very well integrated with GitHub code and Workflow and it has evolved fast in 2019/2020 to become
34+
a fully-fledged CI environment, easy to use and develop for, so we decided to use it for building python source
35+
distribution and wheels.
36+
37+
## GitHub Actions
38+
39+
### GitHub actions run types
40+
41+
The following GA CI Job runs are currently run for Apache Beam, and each of the runs have different
42+
purpose and context.
43+
44+
#### Pull request run
45+
46+
Those runs are results of PR from the forks made by contributors. Most builds for Apache Beam fall
47+
into this category. They are executed in the context of the "Fork", not main
48+
Beam Code Repository which means that they have only "read" permission to all the GitHub resources
49+
(container registry, code repository). This is necessary as the code in those PRs (including CI job
50+
definition) might be modified by people who are not committers for the Apache Beam Code Repository.
51+
52+
The main purpose of those jobs is to check if PR builds cleanly, if the test run properly and if
53+
the PR is ready to review and merge.
54+
55+
#### Direct Push/Merge Run
56+
57+
Those runs are results of direct pushes done by the committers or as result of merge of a Pull Request
58+
by the committers. Those runs execute in the context of the Apache Beam Code Repository and have also
59+
write permission for GitHub resources (container registry, code repository).
60+
The main purpose for the run is to check if the code after merge still holds all the assertions - like
61+
whether it still builds, all tests are green.
62+
63+
This is needed because some of the conflicting changes from multiple PRs might cause build and test failures
64+
after merge even if they do not fail in isolation.
65+
66+
#### Scheduled runs
67+
68+
Those runs are results of (nightly) triggered job - only for `master` branch. The
69+
main purpose of the job is to check if there was no impact of external dependency changes on the Apache
70+
Beam code (for example transitive dependencies released that fail the build). Another reason for the nightly
71+
build is that the builds tags most recent master with `nightly-master`.
72+
73+
All runs consist of the same jobs, but the jobs behave slightly differently or they are skipped in different
74+
run categories. Here is a summary of the run categories with regards of the jobs they are running.
75+
Those jobs often have matrix run strategy which runs several different variations of the jobs
76+
(with different platform type / Python version to run for example)
77+
78+
| Job | Description | Pull Request Run | Direct Push/Merge Run | Scheduled Run | Requires GCP Credentials |
79+
|-------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------|-----------------------|---------------|--------------------------|
80+
| Build python source distribution | Builds python source distribution and uploads it to artifacts. Artifacts from release branch are used in release process ([`build_release_candidate.sh`](release/src/main/scripts/build_release_candidate.sh)) | Yes | Yes | Yes | - |
81+
| Prepare GCS | Clears target path on GCS if already exists. | - | Yes | Yes | Yes |
82+
| Upload python source distribution to GCS bucket | Uploads python source distribution to GCS bucket for path unique for specific workflow run. | - | Yes | Yes | Yes |
83+
| Build python wheels on linux/macos/windows | Builds python wheels on linux/macos/windows platform with usage of `cibuildwheel` and uploads it to artifacts. Artifacts from release branch are used in release process ( [ `build_release_candidate.sh` ](release/src/main/scripts/build_release_candidate.sh) ) | Yes | Yes | Yes | - |
84+
| Upload python wheels to GCS bucket | Uploads python wheels to GCS bucket for path unique for specific workflow run. Additionally uploads workflow run data. | - | Yes | Yes | Yes |
85+
| List files on Google Cloud Storage Bucket | Lists files on GCS for verification purpose. | - | Yes | Yes | Yes |
86+
| Tag repo nightly | Tag repo with `nightly-master` tag if build python source distribution and python wheels finished successfully. | - | - | Yes | - |
87+
88+
### Google Cloud Platform Credentials
89+
90+
Some of the jobs require variables stored as a [GitHub Secrets](https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets)
91+
to perform operations on Google Cloud Platform. Currently these jobs are limited to Apache repository only.
92+
These variables are:
93+
* `GCP_SA_EMAIL` - Service account email address. This is usually of the format `<name>@<project-id>.iam.gserviceaccount.com`.
94+
* `GCP_SA_KEY` - Service account key. This key should be created and encoded as a Base64 string (eg. `cat my-key.json | base64` on macOS).
95+
96+
Service Account shall have following permissions:
97+
* Storage Object Admin (roles/storage.objectAdmin)
98+
99+
### GitHub Action Tips
100+
101+
* If you introduce changes to the workflow it is possible that your changes will not be present in the check run triggered in Pull Request.
102+
In this case please attach link to the modified workflow run executed on your fork.
103+
* Possible timeouts with macOS runner - existing issue: [(X) This check failed - sometimes happens on macOS runner #841](https://github.com/actions/virtual-environments/issues/841)
104+
* [GitHub Actions Documentation](https://docs.github.com/en/actions)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
[![Coverage Status](https://coveralls.io/repos/github/apache/beam/badge.svg?branch=master)](https://coveralls.io/github/apache/beam?branch=master)
3030
[![Compat Check PyPI](https://python-compatibility-tools.appspot.com/one_badge_image?package=apache-beam%5Bgcp%5D)](https://python-compatibility-tools.appspot.com/one_badge_target?package=apache-beam%5Bgcp%5D)
3131
[![Compat Check at master](https://python-compatibility-tools.appspot.com/one_badge_image?package=git%2Bgit%3A//github.com/apache/beam.git%23subdirectory%3Dsdks/python)](https://python-compatibility-tools.appspot.com/one_badge_target?package=git%2Bgit%3A//github.com/apache/beam.git%23subdirectory%3Dsdks/python)
32+
![Build python source distribution and wheels](https://github.com/apache/beam/workflows/Build%20python%20source%20distribution%20and%20wheels/badge.svg)
3233

3334
### Post-commit tests status (on master branch)
3435

0 commit comments

Comments
 (0)