|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one or more |
| 2 | +# contributor license agreements. See the NOTICE file distributed with |
| 3 | +# this work for additional information regarding copyright ownership. |
| 4 | +# The ASF licenses this file to You under the Apache License, Version 2.0 |
| 5 | +# (the "License"); you may not use this file except in compliance with |
| 6 | +# the License. You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | + |
| 16 | + |
| 17 | +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time |
| 18 | +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven |
| 19 | + |
| 20 | +# This workflow uses actions that are not certified by GitHub. |
| 21 | +# They are provided by a third-party and are governed by |
| 22 | +# separate terms of service, privacy policy, and support |
| 23 | +# documentation. |
| 24 | + |
| 25 | +name: CI |
| 26 | + |
| 27 | +on: |
| 28 | + push: |
| 29 | + pull_request: |
| 30 | + branches: [ "master" ] |
| 31 | + |
| 32 | +env: |
| 33 | + MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 |
| 34 | + |
| 35 | +jobs: |
| 36 | + docker-build: |
| 37 | + runs-on: ubuntu-22.04 |
| 38 | + timeout-minutes: 60 |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v4 |
| 41 | + |
| 42 | + - name: Cache for maven dependencies |
| 43 | + uses: actions/cache@v4 |
| 44 | + with: |
| 45 | + path: | |
| 46 | + ~/.m2/repository/*/*/* |
| 47 | + !~/.m2/repository/org/apache/atlas |
| 48 | + key: maven-repo-${{ hashFiles('**/pom.xml') }} |
| 49 | + restore-keys: | |
| 50 | + maven-repo- |
| 51 | +
|
| 52 | + - name: Set up JDK 8 |
| 53 | + uses: actions/setup-java@v4 |
| 54 | + with: |
| 55 | + java-version: '8' |
| 56 | + distribution: 'temurin' |
| 57 | + |
| 58 | + - name: Cache downloaded archives |
| 59 | + uses: actions/cache@v4 |
| 60 | + with: |
| 61 | + path: dev-support/atlas-docker/downloads |
| 62 | + key: ${{ runner.os }}-atlas-downloads-${{ hashFiles('dev-support/atlas-docker/.env') }} |
| 63 | + restore-keys: | |
| 64 | + ${{ runner.os }}-atlas-downloads- |
| 65 | +
|
| 66 | + - name: Run download-archives.sh |
| 67 | + run: | |
| 68 | + cd dev-support/atlas-docker |
| 69 | + chmod +x download-archives.sh && ./download-archives.sh |
| 70 | +
|
| 71 | + - name: Clean up Docker space |
| 72 | + run: docker system prune --all --force --volumes |
| 73 | + |
| 74 | + - name: Build Atlas - JDK 8 |
| 75 | + run: | |
| 76 | + cd dev-support/atlas-docker |
| 77 | + export DOCKER_BUILDKIT=1 |
| 78 | + export COMPOSE_DOCKER_CLI_BUILD=1 |
| 79 | + SKIPTESTS=false docker compose -f docker-compose.atlas-base.yml -f docker-compose.atlas-build.yml up |
| 80 | +
|
| 81 | + - name: Bring up containers |
| 82 | + run: | |
| 83 | + cd dev-support/atlas-docker |
| 84 | + export DOCKER_BUILDKIT=1 |
| 85 | + export COMPOSE_DOCKER_CLI_BUILD=1 |
| 86 | + docker compose \ |
| 87 | + -f docker-compose.atlas-base.yml \ |
| 88 | + -f docker-compose.atlas.yml \ |
| 89 | + -f docker-compose.atlas-hadoop.yml \ |
| 90 | + -f docker-compose.atlas-hbase.yml \ |
| 91 | + -f docker-compose.atlas-kafka.yml \ |
| 92 | + -f docker-compose.atlas-hive.yml up -d |
| 93 | +
|
| 94 | + - name: Check status of containers and remove them |
| 95 | + run: | |
| 96 | + sleep 60 |
| 97 | + containers=(atlas atlas-hadoop atlas-hbase atlas-kafka atlas-hive); |
| 98 | + flag=true; |
| 99 | + for container in "${containers[@]}"; do |
| 100 | + if [[ $(docker inspect -f '{{.State.Running}}' $container 2>/dev/null) == "true" ]]; then |
| 101 | + echo "Container $container is running!"; |
| 102 | + else |
| 103 | + flag=false; |
| 104 | + echo "Container $container is NOT running!"; |
| 105 | + fi |
| 106 | + done |
| 107 | + |
| 108 | + if [[ $flag == true ]]; then |
| 109 | + echo "All required containers are up and running"; |
| 110 | + docker stop $(docker ps -q) && docker rm $(docker ps -aq); |
| 111 | + else |
| 112 | + docker stop $(docker ps -q) && docker rm $(docker ps -aq); |
| 113 | + exit 1; |
| 114 | + fi |
0 commit comments