integration.yaml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. name: Integration tests
  2. # Run this workflow every time a new commit pushed to your repository
  3. on:
  4. push:
  5. branches:
  6. - master
  7. pull_request:
  8. branches:
  9. - master
  10. jobs:
  11. # Set the job key. The key is displayed as the job name
  12. # when a job name is not provided
  13. lint:
  14. name: Lint code
  15. runs-on: ubuntu-latest
  16. strategy:
  17. matrix:
  18. python-version: [ '3.8' ]
  19. steps:
  20. - name: Checkout code
  21. uses: actions/checkout@v2
  22. - name: Setup Python
  23. uses: actions/setup-python@v2
  24. with:
  25. python-version: ${{ matrix.python-version }}
  26. - name: Cache pip dir
  27. uses: actions/cache@v2
  28. with:
  29. path: ~/.cache/pip
  30. key: pip-cache-${{ matrix.python-version }}-lint
  31. - name: Install required packages
  32. run: pip install tox
  33. - name: Run tox
  34. run: tox -e lint
  35. integration:
  36. # Name the Job
  37. name: Per-cloud integration tests
  38. needs: lint
  39. # Set the type of machine to run on
  40. runs-on: ubuntu-latest
  41. strategy:
  42. fail-fast: false
  43. matrix:
  44. python-version: ['3.8']
  45. cloud-provider: ['aws', 'azure', 'gcp', 'mock', 'openstack']
  46. steps:
  47. - name: Checkout code
  48. uses: actions/checkout@v2
  49. - name: Setup Python
  50. uses: actions/setup-python@v2
  51. with:
  52. python-version: ${{ matrix.python-version }}
  53. - name: Cache pip dir
  54. uses: actions/cache@v2
  55. with:
  56. path: ~/.cache/pip
  57. key: pip-cache-${{ matrix.python-version }}-${{ hashFiles('**/setup.py', '**/requirements.txt') }}
  58. - name: Install required packages
  59. run: pip install tox
  60. - name: Run tox
  61. id: tox
  62. run: tox -e py${{ matrix.python-version }}-${{ matrix.cloud-provider }}
  63. env:
  64. PYTHONUNBUFFERED: "True"
  65. # aws
  66. AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }}
  67. AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }}
  68. # azure
  69. AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
  70. AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
  71. AZURE_SECRET: ${{ secrets.AZURE_SECRET }}
  72. AZURE_TENANT: ${{ secrets.AZURE_TENANT }}
  73. AZURE_RESOURCE_GROUP: ${{ secrets.AZURE_RESOURCE_GROUP }}
  74. AZURE_STORAGE_ACCOUNT: ${{ secrets.AZURE_STORAGE_ACCOUNT }}
  75. CB_IMAGE_AZURE: ${{ secrets.CB_IMAGE_AZURE }}
  76. CB_VM_TYPE_AZURE: ${{ secrets.CB_VM_TYPE_AZURE }}
  77. # gcp
  78. GCP_SERVICE_CREDS_DICT: ${{ secrets.GCP_SERVICE_CREDS_DICT }}
  79. CB_IMAGE_GCP: ${{ secrets.CB_IMAGE_GCP }}
  80. # openstack
  81. OS_AUTH_URL: ${{ secrets.OS_AUTH_URL }}
  82. OS_PASSWORD: ${{ secrets.OS_PASSWORD }}
  83. OS_PROJECT_NAME: ${{ secrets.OS_PROJECT_NAME }}
  84. OS_PROJECT_DOMAIN_NAME: ${{ secrets.OS_PROJECT_DOMAIN_NAME }}
  85. OS_TENANT_NAME: ${{ secrets.OS_TENANT_NAME }}
  86. OS_USERNAME: ${{ secrets.OS_USERNAME }}
  87. OS_REGION_NAME: ${{ secrets.OS_REGION_NAME }}
  88. OS_USER_DOMAIN_NAME: ${{ secrets.OS_USER_DOMAIN_NAME }}
  89. OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
  90. OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
  91. CB_IMAGE_OS: ${{ secrets.CB_IMAGE_OS }}
  92. CB_PLACEMENT_OS: ${{ secrets.CB_PLACEMENT_OS }}
  93. - name: Create Build Status Badge
  94. if: ${{ always() }}
  95. uses: schneegans/dynamic-badges-action@v1.1.0
  96. with:
  97. auth: ${{ secrets.BUILD_STATUS_GIST_SECRET }}
  98. gistID: ${{ secrets.BUILD_STATUS_GIST_ID }}
  99. filename: cloudbridge_py${{ matrix.python-version }}_${{ matrix.cloud-provider }}.json
  100. label: ${{ matrix.cloud-provider }}
  101. message: ${{ fromJSON('["passing", "failing"]')[steps.tox.outcome != 'success'] }}
  102. color: ${{ fromJSON('["green", "red"]')[steps.tox.outcome != 'success'] }}
  103. - name: Coveralls
  104. if: ${{ steps.tox.outcome == 'success' }}
  105. uses: AndreMiras/coveralls-python-action@develop
  106. with:
  107. github-token: ${{ secrets.GITHUB_TOKEN }}
  108. flag-name: run-${{ matrix.python-version }}-${{ matrix.cloud-provider }}
  109. parallel: true
  110. finish:
  111. needs: integration
  112. runs-on: ubuntu-latest
  113. steps:
  114. - name: Coveralls Finished
  115. uses: AndreMiras/coveralls-python-action@develop
  116. with:
  117. github-token: ${{ secrets.github_token }}
  118. parallel-finished: true