Update comment for routes, fix renamed error var logging in runner #6017
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
name: Run Tests | |
on: | |
push: | |
paths-ignore: | |
- 'docs/**' | |
- 'helm/**' | |
- '*.md' | |
- Makefile | |
pull_request: | |
paths-ignore: | |
- 'docs/**' | |
- 'helm/**' | |
- '*.md' | |
- Makefile | |
branches: | |
- main | |
jobs: | |
pre_job: | |
runs-on: ubuntu-latest | |
outputs: | |
should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
steps: | |
- id: skip_check | |
uses: fkirc/skip-duplicate-actions@master | |
with: | |
concurrent_skipping: 'same_content' | |
paths_ignore: '["**/README.md", "**/docs/**", "CHANGELOG.md"]' | |
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' | |
setup_build: | |
needs: pre_job | |
runs-on: ubuntu-20.04 | |
if: needs.pre_job.outputs.should_skip != 'true' | |
outputs: | |
python-version: ${{ steps.artifact-versions.outputs.python-version }} | |
kubectl-version: ${{ steps.artifact-versions.outputs.kubectl-version }} | |
aws-iam-auth-version: ${{ steps.artifact-versions.outputs.aws-iam-auth-version }} | |
steps: | |
- uses: actions/checkout@master | |
- name: Output versions into env vars for various artifacts | |
id: artifact-versions | |
run: | | |
echo "::set-output name=python-version::$(cat .python-version)" | |
echo "::set-output name=kubectl-version::$(cat .kubectl-version)" | |
echo "::set-output name=aws-iam-auth-version::$(cat .aws-iam-auth-version)" | |
- uses: actions/setup-python@v2.1.3 | |
id: setup-python | |
with: | |
python-version: ${{ steps.artifact-versions.outputs.python-version }} | |
architecture: x64 | |
- name: Set up Poetry cache | |
uses: actions/cache@v2 | |
id: cached-poetry | |
with: | |
path: ~/.local | |
key: poetry-${{ runner.os }}-1.7.0a-python-${{ steps.setup-python.outputs.python-version }} | |
- name: Install and configure Poetry | |
uses: snok/install-poetry@v1 | |
if: steps.cached-poetry.outputs.cache-hit != 'true' | |
with: | |
version: 1.7.0 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Initialize Poetry | |
# NOTE: We have to apply the config options to cover cases where the install-poetry action is skipped but we have new deps | |
run: | | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
poetry config virtualenvs.create true | |
poetry config virtualenvs.in-project true | |
- name: Set up dependencies cache | |
uses: actions/cache@v2 | |
id: cached-poetry-dependencies | |
with: | |
path: .venv | |
key: ".venv-${{ runner.os }}-\ | |
python-${{ steps.setup-python.outputs.python-version }}-\ | |
${{ hashFiles('**/poetry.lock') }}" | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction --no-root | |
# NOTE: Install our root project into the venv cache without busting it | |
- name: Set up root + dependencies cache | |
uses: actions/cache@v2 | |
id: cached-project | |
with: | |
path: .venv | |
key: ".venv-${{ runner.os }}-\ | |
python-${{ steps.setup-python.outputs.python-version }}-\ | |
${{ hashFiles('**/poetry.lock', 'servo/**/*.py') }}" | |
- name: Install root project | |
# NOTE: Skipping root project install accelerates cases where only tests have changed | |
if: steps.cached-project.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction | |
unit: | |
needs: | |
- pre_job | |
- setup_build | |
if: needs.pre_job.outputs.should_skip != 'true' | |
name: Run Unit Tests | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@master | |
- uses: actions/setup-python@v2.1.3 | |
id: setup-python | |
with: | |
python-version: ${{ needs.setup_build.outputs.python-version }} | |
architecture: x64 | |
- name: Set up root + dependencies cache | |
uses: actions/cache@v2 | |
id: cached-project | |
with: | |
path: .venv | |
key: ".venv-${{ runner.os }}-\ | |
python-${{ steps.setup-python.outputs.python-version }}-\ | |
${{ hashFiles('**/poetry.lock', 'servo/**/*.py') }}" | |
- name: Export coverage file | |
run: | | |
echo "COVERAGE_FILE=${{ github.workspace }}/.coverage-unit-temp" >> $GITHUB_ENV | |
- name: Run tests | |
run: | | |
source .venv/bin/activate | |
TERM=dumb pytest -T unit -n 6 \ | |
--cov=servo --cov-config=setup.cfg --doctest-modules \ | |
--cov-report=term-missing:skip-covered \ | |
--cov-report=xml:artifacts/unit-test-coverage.xml --cov-report=html:artifacts/unit-test-coverage-html \ | |
--junitxml=artifacts/unit-test-report.xml --html=artifacts/unit-test-report.html \ | |
--self-contained-html | |
- name: Upload coverage file | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-unit-temp | |
path: ${{ github.workspace }}/.coverage-unit-temp | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: unit-test-reports | |
path: artifacts/ | |
- name: Test CLI entrypoints | |
run: | | |
source .venv/bin/activate | |
servo version | |
# migrated to Teamcity | |
# integration: | |
# name: Run Integration Tests | |
# runs-on: ubuntu-20.04 | |
# needs: | |
# - pre_job | |
# - setup_build | |
# if: | | |
# needs.pre_job.outputs.should_skip != 'true' && | |
# github.actor != 'dependabot[bot]' && | |
# (github.ref == 'refs/heads/main' || | |
# startsWith(github.ref, 'refs/heads/release/') || | |
# startsWith(github.ref, 'refs/heads/bugfix/') || | |
# startsWith(github.ref, 'refs/tags/') || | |
# github.event_name == 'pull_request' || | |
# contains(github.event.head_commit.message, '#test:integration')) | |
# steps: | |
# - uses: actions/checkout@master | |
# - uses: actions/setup-python@v2.1.3 | |
# id: setup-python | |
# with: | |
# python-version: ${{ needs.setup_build.outputs.python-version }} | |
# architecture: x64 | |
# - name: Install Vegeta | |
# run: | | |
# wget https://github.com/tsenart/vegeta/releases/download/v12.8.4/vegeta_12.8.4_linux_amd64.tar.gz | |
# tar xfz vegeta_12.8.4_linux_amd64.tar.gz | |
# sudo mv vegeta /usr/local/bin/vegeta | |
# - name: Install Kubectl | |
# run: | | |
# KUBECTL_RELEASE="https://dl.k8s.io/release/v${{ needs.setup_build.outputs.kubectl-version }}/bin/linux/amd64/kubectl" | |
# mkdir -p ${{ github.workspace }}/bin | |
# curl -o ${{ github.workspace }}/bin/kubectl -fLO $KUBECTL_RELEASE | |
# echo "${{ github.workspace }}/bin" >> $GITHUB_PATH | |
# chmod +x ${{ github.workspace }}/bin/kubectl | |
# - name: Set up root + dependencies cache | |
# uses: actions/cache@v2 | |
# id: cached-project | |
# with: | |
# path: .venv | |
# key: ".venv-${{ runner.os }}-\ | |
# python-${{ steps.setup-python.outputs.python-version }}-\ | |
# ${{ hashFiles('**/poetry.lock', 'servo/**/*.py') }}" | |
# - name: Configure AWS credentials | |
# uses: aws-actions/configure-aws-credentials@v1 | |
# with: | |
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
# aws-region: us-west-2 | |
# - name: Create tests/kubeconfig | |
# run: | | |
# mkdir ~/.kube | |
# echo "$KUBE_CONFIG_DATA" | base64 --decode > $HOME/.kube/config | |
# kubectl config view --minify --flatten > tests/kubeconfig | |
# shell: bash | |
# env: | |
# KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} | |
# - name: Install aws-iam-authenticator | |
# run: | | |
# AWS_AUTH_RELEASE="https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v${{ needs.setup_build.outputs.aws-iam-auth-version }}/aws-iam-authenticator_${{ needs.setup_build.outputs.aws-iam-auth-version }}_linux_amd64" | |
# curl -o ${{ github.workspace }}/bin/aws-iam-authenticator -fLO $AWS_AUTH_RELEASE | |
# chmod 0755 ${{ github.workspace }}/bin/aws-iam-authenticator | |
# - name: Export coverage file | |
# run: | | |
# echo "COVERAGE_FILE=${{ github.workspace }}/.coverage-integration-temp" >> $GITHUB_ENV | |
# - name: Run integration tests | |
# run: | | |
# source .venv/bin/activate | |
# pytest -n 8 \ | |
# -T integration --verbose --durations=0 --durations-min=5 \ | |
# --cov=servo --cov-config=setup.cfg --doctest-modules \ | |
# --cov-report=term-missing:skip-covered --cov-report=xml:artifacts/integration-test-coverage.xml \ | |
# --cov-report=html:artifacts/integration-test-coverage-html --junitxml=artifacts/integration-test-report.xml \ | |
# --html=artifacts/integration-test-report.html --self-contained-html | |
# - name: Upload coverage file | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: coverage-integration-temp | |
# path: ${{ github.workspace }}/.coverage-integration-temp | |
# - uses: actions/upload-artifact@v2 | |
# with: | |
# name: integration-test-reports | |
# path: artifacts/ | |
# - uses: actions/upload-artifact@v2 | |
# with: | |
# name: integration-test-logs | |
# path: logs/ | |
# combined_coverage: | |
# name: Combine coverage reports | |
# runs-on: ubuntu-20.04 | |
# needs: | |
# - pre_job | |
# - setup_build | |
# - unit | |
# - integration | |
# if: | | |
# needs.pre_job.outputs.should_skip != 'true' && | |
# github.actor != 'dependabot[bot]' && | |
# (github.ref == 'refs/heads/main' || | |
# startsWith(github.ref, 'refs/heads/release/') || | |
# startsWith(github.ref, 'refs/heads/bugfix/') || | |
# startsWith(github.ref, 'refs/tags/') || | |
# github.event_name == 'pull_request' || | |
# contains(github.event.head_commit.message, '#test:integration')) | |
# steps: | |
# - uses: actions/checkout@master | |
# - uses: actions/setup-python@v2.1.3 | |
# id: setup-python | |
# with: | |
# python-version: ${{ needs.setup_build.outputs.python-version }} | |
# architecture: x64 | |
# - name: Set up root + dependencies cache | |
# uses: actions/cache@v2 | |
# id: cached-project | |
# with: | |
# path: .venv | |
# key: ".venv-${{ runner.os }}-\ | |
# python-${{ steps.setup-python.outputs.python-version }}-\ | |
# ${{ hashFiles('**/poetry.lock', 'servo/**/*.py') }}" | |
# - name: Download unit coverage | |
# uses: actions/download-artifact@v3 | |
# with: | |
# name: coverage-unit-temp | |
# - name: Download integration coverage | |
# uses: actions/download-artifact@v3 | |
# with: | |
# name: coverage-integration-temp | |
# - name: Combine coverage reports | |
# run: | | |
# source .venv/bin/activate | |
# coverage combine --append .coverage-unit-temp .coverage-integration-temp | |
# coverage html -d artifacts/combined_coverage --skip-covered | |
# - uses: actions/upload-artifact@v2 | |
# with: | |
# name: combined-coverage-report | |
# path: artifacts/ | |
# - uses: geekyeggo/delete-artifact@v1 | |
# with: | |
# name: | | |
# coverage-unit-temp | |
# coverage-integration-temp | |
system: | |
name: Run System Tests | |
runs-on: ubuntu-20.04 | |
needs: | |
- pre_job | |
- setup_build | |
if: | | |
needs.pre_job.outputs.should_skip != 'true' && | |
github.actor != 'dependabot[bot]' && | |
(github.ref == 'refs/heads/main' || | |
startsWith(github.ref, 'refs/heads/release/') || | |
startsWith(github.ref, 'refs/heads/bugfix/') || | |
startsWith(github.ref, 'refs/tags/') || | |
github.event_name == 'pull_request' || | |
contains(github.event.head_commit.message, '#test:system')) | |
steps: | |
- uses: actions/checkout@master | |
- uses: actions/setup-python@v2.1.3 | |
id: setup-python | |
with: | |
python-version: ${{ needs.setup_build.outputs.python-version }} | |
architecture: x64 | |
- name: Set up Poetry cache | |
uses: actions/cache@v2 | |
id: cached-poetry | |
with: | |
path: ~/.local | |
key: poetry-${{ runner.os }}-1.7.0a-python-${{ steps.setup-python.outputs.python-version }} | |
- name: Ensure Poetry is on GITHUB_PATH | |
run: | | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- name: Set up root + dependencies cache | |
uses: actions/cache@v2 | |
id: cached-project | |
with: | |
path: .venv | |
key: ".venv-${{ runner.os }}-\ | |
python-${{ steps.setup-python.outputs.python-version }}-\ | |
${{ hashFiles('**/poetry.lock', 'servo/**/*.py') }}" | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-west-2 | |
- name: Create tests/kubeconfig | |
run: | | |
mkdir ~/.kube | |
echo "$KUBE_CONFIG_DATA" | base64 --decode > $HOME/.kube/config | |
kubectl config view --minify --flatten > tests/kubeconfig | |
shell: bash | |
env: | |
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} | |
- name: Fix permissions | |
run: | | |
if [ -d /home/runner/.kube ]; then | |
sudo chown -R runner:docker /home/runner/.kube | |
else | |
mkdir /home/runner/.kube | |
fi | |
sudo chown runner:docker tests/kubeconfig | |
- name: Rename EKS cluster to eks | |
run: | | |
kubectl config rename-context \ | |
--kubeconfig=tests/kubeconfig \ | |
kubetest eks | |
- name: Create kind cluster | |
uses: helm/kind-action@v1.2.0 | |
with: | |
cluster_name: kind | |
- name: Display kind kubeconfig | |
run: kind get clusters && kind get kubeconfig --name kind | |
- name: Merge kind kubeconfig | |
run: kind export kubeconfig --name kind --kubeconfig tests/kubeconfig | |
- name: Install AWS IAM Authenticator | |
uses: prepor/action-aws-iam-authenticator@master | |
- name: Run system tests | |
run: | | |
source .venv/bin/activate | |
pytest -n 6 \ | |
-T system --verbose --durations=0 --durations-min=5 \ | |
--junitxml=artifacts/system-test-report.xml \ | |
--html=artifacts/system-test-report.html --self-contained-html | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: system-test-reports | |
path: artifacts/ | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: system-test-logs | |
path: logs/ |