Skip to content

Commit

Permalink
[#4130] Add a GitHub Actions CentOS build
Browse files Browse the repository at this point in the history
Adding a basic build of non-test code (what's needed by the release
package) in a CentOS Docker image on GitHub Actions.

Pull request: #4129
  • Loading branch information
mbautin authored Apr 1, 2020
1 parent 5acfdde commit 2b1c1aa
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 2 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches:
- master
paths-ignore:
- README.md

pull_request:
branches:
- master
paths-ignore:
- README.md
- 'docs/**'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
runs-on: ${{ matrix.os }}

strategy:
matrix:
name:
- "CentOS 7"
include:
- name: "CentOS 7"
os: ubuntu-latest
docker_image: yugabyteci/yb_build_infra_centos7:v2020-03-28T07_29_17

if: >
(github.event_name == 'push' &&
!contains(github.event.head_commit.message, 'skip ci') &&
!contains(github.event.head_commit.message, 'ci skip')) ||
github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v2

- name: Run tests
run: |
echo "OSTYPE (outside Docker): $OSTYPE"
echo "Build name: ${{ matrix.name }}"
echo "Docker image: ${{ matrix.docker_image }}"
if [[ $OSTYPE == linux* ]]; then
build_dir_in_container=/opt/yb-build/yugabyte-db
docker run \
-i \
"-w=$build_dir_in_container" \
--mount type=bind,source="$PWD",target="$build_dir_in_container" \
"${{ matrix.docker_image }}" \
bash -c '
set -euo pipefail -x
echo "OSTYPE (inside Docker): $OSTYPE"
echo "PATH: $PATH"
export PATH=/usr/local/bin:$PATH
( set -x; ls -l /usr/local/bin )
set +e
( set -x; which ninja )
( set -x; which cmake )
set -e
chown -R yugabyteci .
sudo -u yugabyteci bash -c "
set -euo pipefail
export PATH=/usr/local/bin:\$PATH
df -H /
echo ::group::Building the code
./yb_build.sh release packaged --download-thirdparty --ninja
echo ::endgroup::
df -H /
echo ::group::Releasing
./yb_release --force --build_args=--ninja
echo ::endgroup::
df -H /
"
'
elif [[ $OSTYPE == darwin* ]]; then
system_profiler SPSoftwareDataType
sw_vers
./yb_build.sh release
fi
5 changes: 3 additions & 2 deletions python/yb/download_and_extract_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ def download_and_extract(url, dest_dir_parent, local_cache_dir, nfs_cache_dir):
logging.info("Failed creating directory '%s': %s", local_cache_dir, ex)

check_dir_exists_and_is_writable(local_cache_dir, "Local cache")
check_dir_exists_and_is_writable(nfs_cache_dir, "NFS cache")

if not url.endswith(EXPECTED_ARCHIVE_EXTENSION):
raise ValueError("Archive download URL is expected to end with %s, got: %s" % (
Expand Down Expand Up @@ -242,7 +241,9 @@ def cleanup():

nfs_tar_gz_path = os.path.join(nfs_cache_dir, tar_gz_name)
nfs_checksum_file_path = os.path.join(nfs_cache_dir, checksum_file_name)
if not os.path.exists(nfs_tar_gz_path) or not os.path.exists(nfs_checksum_file_path):
if (os.path.isdir(nfs_cache_dir) and
os.access(nfs_cache_dir, os.W_OK) and
(not os.path.exists(nfs_tar_gz_path) or not os.path.exists(nfs_checksum_file_path))):
for file_name in file_names:
run_cmd(['cp',
os.path.join(local_cache_dir, file_name),
Expand Down

0 comments on commit 2b1c1aa

Please sign in to comment.