Changes for ATC 8.0.1 release #2258
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: Experimental Traffic Portal v2 | |
env: | |
# alpine:3.13 | |
ALPINE_VERSION: sha256:08d6ca16c60fe7490c03d10dc339d9fd8ea67c6466dea8d558526b1330a85930 | |
on: | |
push: | |
paths: | |
- experimental/traffic-portal/** | |
- .github/workflows/tpv2.yml | |
- .github/actions/tpv2-integration-tests | |
- lib/go-tc/** | |
- '!**_test.go' | |
- traffic_ops/app/db/** | |
- traffic_ops/traffic_ops_golang/**.go | |
create: | |
pull_request: | |
paths: | |
- experimental/traffic-portal/** | |
- .github/workflows/tpv2.yml | |
- .github/actions/tpv2-integration-tests | |
- '!**_test.go' | |
- lib/go-tc/** | |
- traffic_ops/app/db/** | |
- traffic_ops/traffic_ops_golang/**.go | |
types: [opened, reopened, ready_for_review, synchronize] | |
jobs: | |
build: | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Cache node modules | |
id: restore-npm-cache | |
uses: actions/cache@v3 | |
with: | |
path: ./experimental/traffic-portal/node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('./experimental/traffic-portal/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Node 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
- name: NPM install | |
if: steps.restore-npm-cache.cache-hit != 'true' | |
run: | | |
cd experimental/traffic-portal/ | |
npm ci | |
- name: Build | |
run: | | |
cd experimental/traffic-portal/ | |
npm run build:ssr | |
lint: | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Cache node modules | |
id: restore-npm-cache | |
uses: actions/cache@v3 | |
with: | |
path: ./experimental/traffic-portal/node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('./experimental/traffic-portal/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Node 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
- name: NPM install | |
if: steps.restore-npm-cache.cache-hit != 'true' | |
run: | | |
cd experimental/traffic-portal/ | |
npm ci | |
- name: Lint | |
run: | | |
cd experimental/traffic-portal/ | |
npm run lint | |
unit-tests: | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Cache node modules | |
id: restore-npm-cache | |
uses: actions/cache@v3 | |
with: | |
path: ./experimental/traffic-portal/node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('./experimental/traffic-portal/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Node 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
- name: Install latest Chrome | |
run: sudo apt-get update && sudo apt-get install google-chrome-stable | |
- name: NPM install | |
if: steps.restore-npm-cache.cache-hit != 'true' | |
run: | | |
cd experimental/traffic-portal/ | |
npm ci | |
- name: Test | |
run: | | |
cd experimental/traffic-portal/ | |
npm run coverage:ci | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ${{ github.workspace }}/experimental/traffic-portal/coverage/traffic-portal/cobertura-coverage.xml | |
flags: traffic_portal_v2,unit_tests | |
end-to-end-tests: | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
env: | |
PGUSER: traffic_ops | |
PGPASSWORD: twelve | |
PGHOST: localhost | |
PGDATABASE: traffic_ops | |
PGPORT: 5432 | |
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@v3 | |
- name: Cache Alpine Docker image | |
uses: actions/cache@v3 | |
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: Cache node modules | |
id: restore-npm-cache | |
uses: actions/cache@v3 | |
with: | |
path: ./experimental/traffic-portal/node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('./experimental/traffic-portal/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node-modules- | |
- 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@v3 | |
with: | |
go-version: ${{ steps.go-version.outputs.value }} | |
- name: Build Traffic Ops | |
run: | | |
cd "${GITHUB_WORKSPACE}/traffic_ops/traffic_ops_golang" | |
go build . | |
# Setup | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install postgresql-client gettext-base | |
- name: Hash TO user password | |
env: | |
PYTHONPATH: traffic_ops/install/bin | |
run: |2 | |
password_hash="$(<<PYTHON_COMMANDS python | |
from _postinstall import hash_pass | |
print(hash_pass('${{ env.PGPASSWORD }}12')) | |
PYTHON_COMMANDS | |
)" && | |
echo "TO_USER_PASSWORD_HASH=${password_hash}" >> '${{ github.env }}' | |
- name: Create admin user | |
run: |2 | |
<<QUERY psql | |
INSERT INTO tm_user (username, role, tenant_id, local_passwd) | |
VALUES ('admin', ( | |
SELECT id | |
FROM "role" | |
WHERE "name" = 'admin' | |
), ( | |
SELECT id | |
FROM tenant | |
WHERE "name" = 'root' | |
), '${{ env.TO_USER_PASSWORD_HASH }}'); | |
QUERY | |
- name: Create SSL Certificates and AES key | |
run: | | |
set -o pipefail | |
openssl rand 32 | base64 | tee "${GITHUB_WORKSPACE}/aes.key" && | |
openssl req -new -x509 -nodes -newkey rsa:4096 -out traffic_ops/traffic_ops_golang/localhost.crt -keyout traffic_ops/traffic_ops_golang/localhost.key -subj "/CN=tptests" | |
- name: NPM install | |
if: steps.restore-npm-cache.cache-hit != 'true' | |
run: | | |
cd experimental/traffic-portal | |
npm ci | |
- name: Build TPv2 | |
run: | | |
cd experimental/traffic-portal | |
npx ng build | |
npx ng run traffic-portal:server | |
- name: Run everything and test | |
uses: ./.github/actions/tpv2-integration-tests | |
- name: Upload Report | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: ${{ github.job }} | |
path: | | |
traffic_ops/traffic_ops_golang/out.log | |
experimental/traffic-portal/logs | |
experimental/traffic-portal/nightwatch/junit | |
experimental/traffic-portal/nightwatch/screens | |
experimental/traffic-portal/tests_output | |
tp.log | |
- name: Save Alpine Docker image | |
run: .github/actions/save-alpine-tar/entrypoint.sh save ${{ env.ALPINE_VERSION }} |