Feature.filter generate output #364
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 CNaaS-NMS unit tests | |
on: | |
push: | |
workflow_dispatch: | |
pull_request: | |
jobs: | |
docker-tests: | |
name: "Run unit tests in docker" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: "Set environment variables" | |
run: | | |
echo "GITREPO_TEMPLATES=git://gitops.sunet.se/cnaas-lab-templates" >> $GITHUB_ENV | |
echo "GITREPO_SETTINGS=git://gitops.sunet.se/cnaas-lab-settings" >> $GITHUB_ENV | |
echo "GITREPO_ETC=https://github.com/indy-independence/cnaas-nms-lab-etc.git" >> $GITHUB_ENV | |
echo "USERNAME_DHCP_BOOT=admin" >> $GITHUB_ENV | |
echo "PASSWORD_DHCP_BOOT=abc123abc123" >> $GITHUB_ENV | |
echo "USERNAME_DISCOVERED=admin" >> $GITHUB_ENV | |
echo "PASSWORD_DISCOVERED=abc123abc123" >> $GITHUB_ENV | |
echo "USERNAME_INIT=admin" >> $GITHUB_ENV | |
echo "PASSWORD_INIT=abc123abc123" >> $GITHUB_ENV | |
echo "USERNAME_MANAGED=admin" >> $GITHUB_ENV | |
echo "PASSWORD_MANAGED=abc123abc123" >> $GITHUB_ENV | |
echo "NO_EQUIPMENTTEST=1" >> $GITHUB_ENV | |
echo "PYTEST_POSTGRES_EXTERNAL=1" >> $GITHUB_ENV | |
echo "PYTEST_REDIS_EXTERNAL=1" >> $GITHUB_ENV | |
echo "JWT_AUTH_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJpYXQiOjE1NzEwNTk2MTgsIm5iZiI6MTU3MTA1OTYxOCwianRpIjoiNTQ2MDk2YTUtZTNmOS00NzFlLWE2NTctZWFlYTZkNzA4NmVhIiwic3ViIjoiYWRtaW4iLCJmcmVzaCI6ZmFsc2UsInR5cGUiOiJhY2Nlc3MifQ.Sfffg9oZg_Kmoq7Oe8IoTcbuagpP6nuUXOQzqJpgDfqDq_GM_4zGzt7XxByD4G0q8g4gZGHQnV14TpDer2hJXw" >> $GITHUB_ENV | |
# - name: Create code coverage dir | |
# run: mkdir -p docker/coverage/ | |
# | |
- uses: jpribyl/[email protected] | |
# Ignore the failure of a step and avoid terminating the job. | |
continue-on-error: true | |
- name: Get branch name (merge) | |
if: github.event_name != 'pull_request' | |
shell: bash | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV | |
- name: Get branch name (pull request) | |
if: github.event_name == 'pull_request' | |
shell: bash | |
run: echo "BRANCH_NAME=pr/$(echo ${GITHUB_REF#refs/pull/} | cut -d '/' -f1)" >> $GITHUB_ENV | |
- name: Get repo URL | |
shell: bash | |
run: echo "CNAAS_REPO=$(echo ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY})" >> $GITHUB_ENV | |
- name: Print branch name | |
run: echo ${{ env.BRANCH_NAME }} at ${{ env.CNAAS_REPO }} | |
- name: Build docker | |
run: docker-compose -f docker/docker-compose_test.yaml build --build-arg GITREPO_BASE=${{ env.CNAAS_REPO }} --build-arg BUILDBRANCH=${{ env.BRANCH_NAME }} | |
- name: Start docker | |
run: docker-compose -f docker/docker-compose_test.yaml up -d | |
- name: Install API certificates | |
run: | | |
docker cp ./docker/jwt-cert/public.pem docker_cnaas_api_1:/opt/cnaas/jwtcert/public.pem | |
docker-compose -f docker/docker-compose_test.yaml exec -u root -T cnaas_api /bin/chown -R www-data:www-data /opt/cnaas/jwtcert/ | |
docker-compose -f docker/docker-compose_test.yaml exec -u root -T cnaas_api /opt/cnaas/createca.sh | |
- name: Check running containers | |
run: docker ps -a | |
- name: Check API running version | |
run: curl -ks --connect-timeout 5 --max-time 10 --retry 5 --retry-delay 0 --retry-max-time 30 https://localhost/api/v1.0/system/version | |
- name: Fix permissions for code coverage | |
run: docker-compose -f docker/docker-compose_test.yaml exec -u root -T cnaas_api chown -R www-data:www-data /opt/cnaas/venv/cnaas-nms/src/ | |
- name: Run unit tests in container | |
run: docker-compose -f docker/docker-compose_test.yaml exec -u www-data -T cnaas_api /opt/cnaas/pytest.sh | |
- name: Check logs | |
if: always() | |
run: docker logs docker_cnaas_api_1 |