mirror of
https://github.com/NLnetLabs/krill.git
synced 2026-08-30 19:59:44 +02:00
158 lines
4.8 KiB
YAML
158 lines
4.8 KiB
YAML
name: E2E Test
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- '**'
|
|
- '!.github/workflows/ci.yml'
|
|
- '!Changelog.md'
|
|
- '!doc/**'
|
|
- '!LICENSE'
|
|
- '!README.md'
|
|
- '!tests/**'
|
|
- 'tests/e2e/**'
|
|
- '!test-resources/**'
|
|
|
|
jobs:
|
|
krill_e2e_test:
|
|
env:
|
|
TF_VAR_size: 's-4vcpu-8gb'
|
|
TF_VAR_domain: 'krill.cloud'
|
|
TF_VAR_tags: '["krill", "e2etest"]'
|
|
|
|
name: deploy_and_test
|
|
runs-on: ubuntu-18.04
|
|
steps:
|
|
- name: Checkout Krill
|
|
uses: actions/checkout@v2
|
|
with:
|
|
path: krill
|
|
fetch-depth: 1
|
|
|
|
- name: Determine E2E test framework branch to use
|
|
id: pick_e2e_branch
|
|
shell: bash
|
|
run: |
|
|
BRANCH=${GITHUB_REF#refs/heads/}
|
|
if git ls-remote --exit-code --heads https://github.com/NLnetLabs/rpki-deploy ${BRANCH}; then
|
|
echo "::set-output name=branch::${BRANCH}"
|
|
else
|
|
echo "::set-output name=success::master"
|
|
fi
|
|
|
|
- name: Checkout the E2E test framework
|
|
uses: actions/checkout@v2
|
|
with:
|
|
repository: nlnetlabs/rpki-deploy
|
|
path: rpki-deploy
|
|
fetch-depth: 1
|
|
ref: ${{ steps.pick_e2e_branch.outputs.branch }}
|
|
|
|
- name: Checkout RTRLIB (v0.7.0 tag)
|
|
uses: actions/checkout@v2
|
|
with:
|
|
repository: rtrlib/rtrlib
|
|
ref: v0.7.0
|
|
path: rtrlib
|
|
|
|
- name: Print GITHUB_WORKSPACE contents
|
|
run: ls -la ${GITHUB_WORKSPACE}
|
|
|
|
- name: Install Python 3 venv package
|
|
run: |
|
|
set -x
|
|
sudo apt-get install -y python3-venv
|
|
|
|
- name: Install RTRLIB with NDEBUG
|
|
working-directory: ./rtrlib
|
|
run: |
|
|
set -x
|
|
cmake -D CMAKE_C_FLAGS='-DNDEBUG' -D CMAKE_BUILD_TYPE=Release -D RTRLIB_TRANSPORT_SSH=No .
|
|
make
|
|
sudo make install
|
|
sudo ldconfig
|
|
|
|
- name: Install Terraform
|
|
uses: marocchino/setup-terraform@v1
|
|
with:
|
|
version: "0.12.19"
|
|
|
|
- name: Install Terraform plugins
|
|
run: |
|
|
set -x
|
|
mkdir -p $HOME/.terraform.d/plugins/
|
|
cp ${GITHUB_WORKSPACE}/rpki-deploy/terraform/plugins/terraform-provider-dockermachine $HOME/.terraform.d/plugins/
|
|
|
|
- name: Print application versions
|
|
run: |
|
|
set -x
|
|
docker --version
|
|
docker-compose --version
|
|
python3 --version
|
|
terraform --version
|
|
|
|
- name: Decrypt SSH key
|
|
working-directory: ./rpki-deploy/terraform/krill-e2e-test
|
|
run: |
|
|
mkdir $HOME/secrets/
|
|
echo "$SSH_KEY" > $HOME/secrets/ssh_key
|
|
head -n 2 $HOME/secrets/ssh_key
|
|
chmod 400 $HOME/secrets/ssh_key
|
|
env:
|
|
SSH_KEY: ${{ secrets.E2E_TEST_SSH_KEY }}
|
|
|
|
# Don't lock the state file, otherwise if the user cancels the build via the
|
|
# GitHub Actions UI the terraform destroy cleanup step will fail.
|
|
- name: Deploy
|
|
working-directory: ./rpki-deploy/terraform/krill-e2e-test/run_on_do
|
|
timeout-minutes: 30
|
|
run: |
|
|
set -x
|
|
terraform init
|
|
terraform apply -lock=false -auto-approve -var "ssh_key_path=$HOME/secrets/ssh_key" -var "krill_build_path=${GITHUB_WORKSPACE}/krill"
|
|
env:
|
|
# Don't embed env var references in env var definitions here, instead
|
|
# pass those using -var on the command line.
|
|
TF_VAR_do_token: ${{ secrets.E2E_TEST_DO_TOKEN }}
|
|
TF_VAR_run_tests: false
|
|
|
|
- name: Run tests
|
|
working-directory: ./rpki-deploy/terraform/krill-e2e-test/run_on_do
|
|
run: |
|
|
set -x
|
|
terraform apply -auto-approve \
|
|
-var "ssh_key_path=$HOME/secrets/ssh_key" \
|
|
-var "krill_build_path=${GITHUB_WORKSPACE}/krill" \
|
|
-var "test_suite_path=${GITHUB_WORKSPACE}/krill/tests/e2e"
|
|
env:
|
|
# Don't embed env var references in env var definitions here, instead
|
|
# pass those using -var on the command line.
|
|
TF_VAR_do_token: ${{ secrets.E2E_TEST_DO_TOKEN }}
|
|
TF_VAR_run_tests: true
|
|
|
|
- name: Upload HTML test report
|
|
uses: actions/upload-artifact@v1
|
|
with:
|
|
name: test-report
|
|
path: /tmp/report.html
|
|
|
|
- name: Dump diagnostics on failure
|
|
if: failure()
|
|
working-directory: ./rpki-deploy/terraform/krill-e2e-test/run_on_do
|
|
run: |
|
|
set -x
|
|
terraform output docker_env_vars
|
|
eval $(terraform output docker_env_vars)
|
|
pushd ../lib/docker
|
|
docker system info
|
|
docker system events --since 60m --until 1s
|
|
|
|
- name: Undeploy
|
|
if: always()
|
|
working-directory: ./rpki-deploy/terraform/krill-e2e-test/run_on_do
|
|
run: terraform destroy -auto-approve -var "ssh_key_path=$HOME/secrets/ssh_key" -var "krill_build_path=${GITHUB_WORKSPACE}/krill"
|
|
env:
|
|
# Don't embed env var references in env var definitions here, instead
|
|
# pass those using -var on the command line.
|
|
TF_VAR_do_token: ${{ secrets.E2E_TEST_DO_TOKEN }}
|