blob: 9b08d200d226ec5a74cc7dcb29a62b6170a76c39 [file] [log] [blame]
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: TO Go Client Integration Tests
env:
# alpine:3.13
ALPINE_VERSION: sha256:08d6ca16c60fe7490c03d10dc339d9fd8ea67c6466dea8d558526b1330a85930
on:
push:
paths:
- .github/actions/todb-init/**
- .github/actions/tvdb-init/**
- .github/actions/to-integration-tests/**
- .github/workflows/traffic-ops.yml
- go.mod
- go.sum
- GO_VERSION
- infrastructure/cdn-in-a-box/optional/traffic_vault/**
- traffic_ops/*client/**.go
- traffic_ops/testing/api/**.go
- traffic_ops/traffic_ops_golang/**.go
- vendor/**.go
- vendor/modules.txt
create:
pull_request:
paths:
- .github/actions/todb-init/**
- .github/actions/tvdb-init/**
- .github/actions/to-integration-tests/**
- .github/workflows/traffic-ops.yml
- go.mod
- go.sum
- GO_VERSION
- infrastructure/cdn-in-a-box/optional/traffic_vault/**
- traffic_ops/*client/**.go
- traffic_ops/testing/api/**.go
- traffic_ops/traffic_ops_golang/**.go
- vendor/**.go
- vendor/modules.txt
types: [opened, reopened, ready_for_review, synchronize]
jobs:
APIv3Tests:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
services:
postgres:
image: postgres:13
env:
POSTGRES_USER: traffic_ops
POSTGRES_PASSWORD: twelve
POSTGRES_DB: traffic_ops
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
smtp:
image: maildev/maildev:2.0.0-beta3
ports:
- 25:25
options: >-
--entrypoint=bin/maildev
--user=root
--health-cmd="sh -c \"[[ \$(wget -qO- http://smtp/healthz) == true ]]\""
--
maildev/maildev:2.0.0-beta3
--smtp=25
--hide-extensions=STARTTLS
--web=80
steps:
- name: Checkout
uses: actions/checkout@master
- name: Cache Alpine Docker image
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/docker-images
key: docker-images/alpine@${{ env.ALPINE_VERSION }}.tar.gz
- name: Import cached Alpine Docker image
run: .github/actions/save-alpine-tar/entrypoint.sh load ${{ env.ALPINE_VERSION }}
- name: Initialize Traffic Ops Database
id: todb
uses: ./.github/actions/todb-init
- name: Initialize Traffic Vault Database
id: tvdb
uses: ./.github/actions/tvdb-init
- name: Check Go Version
run: echo "::set-output name=value::$(cat GO_VERSION)"
id: go-version
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ steps.go-version.outputs.value }}
- name: Run API v3 tests
id: v3Tests
if: ${{ steps.todb.outcome == 'success' && always() }}
uses: ./.github/actions/to-integration-tests
with:
version: 3
smtp_address: 172.17.0.1
- name: Upload v3 Vault logs
if: ${{ steps.v3Tests.outcome != 'success' && always() }}
uses: actions/upload-artifact@v2
with:
name: v3 Traffic Vault logs
path: ${{ github.workspace }}/infrastructure/cdn-in-a-box/traffic.vault.logs
- name: Upload v3 Ops logs
if: ${{ steps.v3Tests.outcome != 'success' && always() }}
uses: actions/upload-artifact@v2
with:
name: v3 Traffic Ops logs
path: ${{ github.workspace }}/traffic_ops/traffic_ops_golang/traffic.ops.log
APIv4Tests:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
services:
postgres:
image: postgres:13
env:
POSTGRES_USER: traffic_ops
POSTGRES_PASSWORD: twelve
POSTGRES_DB: traffic_ops
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
smtp:
image: maildev/maildev:2.0.0-beta3
ports:
- 25:25
options: >-
--entrypoint=bin/maildev
--user=root
--health-cmd="sh -c \"[[ \$(wget -qO- http://smtp/healthz) == true ]]\""
--
maildev/maildev:2.0.0-beta3
--smtp=25
--hide-extensions=STARTTLS
--web=80
steps:
- name: Checkout
uses: actions/checkout@master
- name: Cache Alpine Docker image
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/docker-images
key: docker-images/alpine@${{ env.ALPINE_VERSION }}.tar.gz
- name: Import cached Alpine Docker image
run: .github/actions/save-alpine-tar/entrypoint.sh load ${{ env.ALPINE_VERSION }}
- name: Initialize Traffic Ops Database
id: todb
uses: ./.github/actions/todb-init
- name: Initialize Traffic Vault Database
id: tvdb
uses: ./.github/actions/tvdb-init
- name: Check Go Version
run: echo "::set-output name=value::$(cat GO_VERSION)"
id: go-version
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ steps.go-version.outputs.value }}
- name: Run API v4 tests
id: v4Tests
if: ${{ steps.todb.outcome == 'success' && always() }}
uses: ./.github/actions/to-integration-tests
with:
version: 4
smtp_address: 172.17.0.1
- name: Upload v4 Vault logs
if: ${{ steps.v4Tests.outcome != 'success' && always() }}
uses: actions/upload-artifact@v2
with:
name: v4 Traffic Vault logs
path: ${{ github.workspace }}/infrastructure/cdn-in-a-box/traffic.vault.logs
- name: Upload v4 Ops logs
if: ${{ steps.v4Tests.outcome != 'success' && always() }}
uses: actions/upload-artifact@v2
with:
name: v4 Traffic Ops logs
path: ${{ github.workspace }}/traffic_ops/traffic_ops_golang/traffic.ops.log
- name: Save Alpine Docker image
run: .github/actions/save-alpine-tar/entrypoint.sh save ${{ env.ALPINE_VERSION }}