From 1012306936000a41ddd4707da421f7ae2a2b92d0 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Sun, 18 Feb 2024 11:36:46 +0800 Subject: [PATCH] attempt to restore docker test Signed-off-by: Adrian Cole --- .github/workflows/docker-tests.yml | 60 +++++++++++++++++++++++++++ .github/workflows/test_readme.yml | 66 ++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 .github/workflows/docker-tests.yml create mode 100644 .github/workflows/test_readme.yml diff --git a/.github/workflows/docker-tests.yml b/.github/workflows/docker-tests.yml new file mode 100644 index 00000000..8fd4e0b0 --- /dev/null +++ b/.github/workflows/docker-tests.yml @@ -0,0 +1,60 @@ +name: Continuous Build Docker +on: + push: + branches: + - master + pull_request: + +jobs: + build-zipkin-gcp: + name: Build Zipkin GCP + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + with: + fetch-depth: 10 + # Remove apt repos that are known to break from time to time. + # See https://github.com/actions/virtual-environments/issues/323 + - name: Remove broken apt repos [Ubuntu] + run: | + for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done + # Setup latest JDK. We do this to ensure users don't need to use the same version as our + # release process. Release uses JDK 11, the last version that can target 1.6 bytecode. + - name: Setup java + uses: actions/setup-java@v1 + with: + java-version: 15 + - name: Cache Maven Modules + uses: actions/cache@v1 + with: + path: ~/.m2/repository + key: m2-repository-${{ hashFiles('**/pom.xml') }} + - name: Install Docker + uses: docker-practice/actions-setup-docker@master + with: + docker_version: 19.03 + # Avoid pulling image from Docker Hub as it would consume pull quota + docker_buildx: false + - name: Cache docker + uses: actions/cache@v1 + with: + path: ~/.docker + key: ${{ runner.os }}-docker-${{ hashFiles('**/Dockerfile') }} + restore-keys: ${{ runner.os }}-docker + - name: Execute Zipkin GCP Build + # Skips tests and license to run faster and allow shallow clones + run: ./mvnw -T1C -q --batch-mode -DskipTests -Dlicense.skip=true clean package + shell: bash + env: + CI: true + - name: Build Docker image openzipkin/zipkin-gcp:test + run: RELEASE_FROM_MAVEN_BUILD=true docker/build_image openzipkin/zipkin-gcp:test + - name: Verify Docker image openzipkin/zipkin-gcp:test + env: + GOOGLE_APPLICATION_CREDENTIALS_BASE64: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_BASE64 }} + run: | + # This just makes sure containers run and the HEALTHCHECK works (for now..) + COMPOSE_FILE=./.github/workflows/docker/docker-compose.test.yml + docker-compose -f "${COMPOSE_FILE}" up -d --quiet-pull + docker/bin/block_on_health sut || (docker logs sut && exit 1) diff --git a/.github/workflows/test_readme.yml b/.github/workflows/test_readme.yml new file mode 100644 index 00000000..72867943 --- /dev/null +++ b/.github/workflows/test_readme.yml @@ -0,0 +1,66 @@ +--- +name: test_readme + +# These test build commands mentioned in various README.md files. +# +# We don't test documentation-only commits. +on: # yamllint disable-line rule:truthy + push: # non-tagged pushes to master + branches: + - master + tags-ignore: + - '*' + paths-ignore: + - '**/*.md' + - './build-bin/*lint' + - ./build-bin/mlc_config.json + pull_request: # pull requests targeted at the master branch. + branches: + - master + paths-ignore: + - '**/*.md' + - './build-bin/*lint' + - ./build-bin/mlc_config.json + +jobs: + docker: + runs-on: ubuntu-22.04 # newest available distribution, aka jellyfish + # skip commits made by the release plugin + if: "!contains(github.event.head_commit.message, 'maven-release-plugin')" + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + # Remove apt repos that are known to break from time to time. + # See https://github.com/actions/virtual-environments/issues/323 + - name: Remove broken apt repos + run: | + for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/` + do sudo rm $apt_file + done + - name: Setup java + uses: actions/setup-java@v4 + with: + distribution: 'zulu' # zulu as it supports a wide version range + java-version: '21' # Most recent LTS + # Don't attempt to cache Docker. Sensitive information can be stolen + # via forks, and login session ends up in ~/.docker. This is ok because + # we publish DOCKER_PARENT_IMAGE to ghcr.io, hence local to the runner. + - name: Cache local Maven repository + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-jdk-21-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-jdk-21-maven- + - name: Build zipkin-module-gcp + run: ./mvnw --also-make -pl :zipkin-module-gcp clean package + env: + MAVEN_CONFIG: '-T1C -q --batch-mode -DskipTests' + - name: docker/README.md - openzipkin/zipkin + run: | + build-bin/docker/docker_build openzipkin/zipkin-gcp:test && + build-bin/docker/docker_test_image openzipkin/zipkin-gcp:test + env: + RELEASE_FROM_MAVEN_BUILD: true + GOOGLE_APPLICATION_CREDENTIALS_BASE64: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_BASE64 }}