Switch to pytest (#317) #144
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: Integration tests | |
# Run this workflow every time a new commit pushed to your repository | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: {} | |
jobs: | |
# Set the job key. The key is displayed as the job name | |
# when a job name is not provided | |
lint: | |
name: Lint code | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [ '3.10' ] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache pip dir | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: pip-cache-${{ matrix.python-version }}-lint | |
- name: Install required packages | |
run: pip install tox | |
- name: Run tox | |
run: tox -e lint | |
integration: | |
# Name the Job | |
name: Per-cloud integration tests | |
needs: lint | |
# Set the type of machine to run on | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.10'] | |
cloud-provider: ['aws', 'azure', 'gcp', 'mock', 'openstack'] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache pip dir | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: pip-cache-${{ matrix.python-version }}-${{ hashFiles('**/setup.py', '**/requirements.txt') }} | |
- name: Install required packages | |
run: pip install tox | |
- name: Run tox | |
id: tox | |
run: tox -e py${{ matrix.python-version }}-${{ matrix.cloud-provider }} | |
env: | |
PYTHONUNBUFFERED: "True" | |
# aws | |
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }} | |
AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }} | |
CB_VM_TYPE_AWS: ${{ secrets.CB_VM_TYPE_AWS }} | |
# azure | |
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | |
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
AZURE_SECRET: ${{ secrets.AZURE_SECRET }} | |
AZURE_TENANT: ${{ secrets.AZURE_TENANT }} | |
AZURE_RESOURCE_GROUP: ${{ secrets.AZURE_RESOURCE_GROUP }} | |
AZURE_STORAGE_ACCOUNT: ${{ secrets.AZURE_STORAGE_ACCOUNT }} | |
CB_IMAGE_AZURE: ${{ secrets.CB_IMAGE_AZURE }} | |
CB_VM_TYPE_AZURE: ${{ secrets.CB_VM_TYPE_AZURE }} | |
# gcp | |
GCP_SERVICE_CREDS_DICT: ${{ secrets.GCP_SERVICE_CREDS_DICT }} | |
CB_IMAGE_GCP: ${{ secrets.CB_IMAGE_GCP }} | |
CB_VM_TYPE_GCP: ${{ secrets.CB_VM_TYPE_GCP }} | |
# openstack | |
OS_AUTH_URL: ${{ secrets.OS_AUTH_URL }} | |
OS_PASSWORD: ${{ secrets.OS_PASSWORD }} | |
OS_PROJECT_NAME: ${{ secrets.OS_PROJECT_NAME }} | |
OS_PROJECT_DOMAIN_NAME: ${{ secrets.OS_PROJECT_DOMAIN_NAME }} | |
OS_TENANT_NAME: ${{ secrets.OS_TENANT_NAME }} | |
OS_USERNAME: ${{ secrets.OS_USERNAME }} | |
OS_REGION_NAME: ${{ secrets.OS_REGION_NAME }} | |
OS_USER_DOMAIN_NAME: ${{ secrets.OS_USER_DOMAIN_NAME }} | |
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }} | |
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }} | |
CB_IMAGE_OS: ${{ secrets.CB_IMAGE_OS }} | |
CB_VM_TYPE_OS: ${{ secrets.CB_VM_TYPE_OS }} | |
CB_PLACEMENT_OS: ${{ secrets.CB_PLACEMENT_OS }} | |
- name: Create Build Status Badge | |
if: github.ref == 'refs/heads/master' | |
uses: schneegans/dynamic-badges-action@v1.1.0 | |
with: | |
auth: ${{ secrets.BUILD_STATUS_GIST_SECRET }} | |
gistID: ${{ secrets.BUILD_STATUS_GIST_ID }} | |
filename: cloudbridge_py${{ matrix.python-version }}_${{ matrix.cloud-provider }}.json | |
label: ${{ matrix.cloud-provider }} | |
message: ${{ fromJSON('["passing", "failing"]')[steps.tox.outcome != 'success'] }} | |
color: ${{ fromJSON('["green", "red"]')[steps.tox.outcome != 'success'] }} | |
- name: Coveralls | |
if: ${{ steps.tox.outcome == 'success' }} | |
uses: AndreMiras/coveralls-python-action@develop | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
flag-name: run-${{ matrix.python-version }}-${{ matrix.cloud-provider }} | |
parallel: true | |
finish: | |
needs: integration | |
runs-on: ubuntu-latest | |
steps: | |
- name: Coveralls Finished | |
uses: AndreMiras/coveralls-python-action@develop | |
with: | |
github-token: ${{ secrets.github_token }} | |
parallel-finished: true |