integration.yaml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. CB_VM_TYPE_AWS: ${{ secrets.CB_VM_TYPE_AWS }}
  69. # azure
  70. AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
  71. AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
  72. AZURE_SECRET: ${{ secrets.AZURE_SECRET }}
  73. AZURE_TENANT: ${{ secrets.AZURE_TENANT }}
  74. AZURE_RESOURCE_GROUP: ${{ secrets.AZURE_RESOURCE_GROUP }}
  75. AZURE_STORAGE_ACCOUNT: ${{ secrets.AZURE_STORAGE_ACCOUNT }}
  76. CB_IMAGE_AZURE: ${{ secrets.CB_IMAGE_AZURE }}
  77. CB_VM_TYPE_AZURE: ${{ secrets.CB_VM_TYPE_AZURE }}
  78. # gcp
  79. GCP_SERVICE_CREDS_DICT: ${{ secrets.GCP_SERVICE_CREDS_DICT }}
  80. CB_IMAGE_GCP: ${{ secrets.CB_IMAGE_GCP }}
  81. CB_VM_TYPE_GCP: ${{ secrets.CB_VM_TYPE_GCP }}
  82. # openstack
  83. OS_AUTH_URL: ${{ secrets.OS_AUTH_URL }}
  84. OS_PASSWORD: ${{ secrets.OS_PASSWORD }}
  85. OS_PROJECT_NAME: ${{ secrets.OS_PROJECT_NAME }}
  86. OS_PROJECT_DOMAIN_NAME: ${{ secrets.OS_PROJECT_DOMAIN_NAME }}
  87. OS_TENANT_NAME: ${{ secrets.OS_TENANT_NAME }}
  88. OS_USERNAME: ${{ secrets.OS_USERNAME }}
  89. OS_REGION_NAME: ${{ secrets.OS_REGION_NAME }}
  90. OS_USER_DOMAIN_NAME: ${{ secrets.OS_USER_DOMAIN_NAME }}
  91. OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
  92. OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
  93. CB_IMAGE_OS: ${{ secrets.CB_IMAGE_OS }}
  94. CB_VM_TYPE_OS: ${{ secrets.CB_VM_TYPE_OS }}
  95. CB_PLACEMENT_OS: ${{ secrets.CB_PLACEMENT_OS }}
  96. - name: Create Build Status Badge
  97. if: github.ref == 'refs/heads/master'
  98. uses: schneegans/dynamic-badges-action@v1.1.0
  99. with:
  100. auth: ${{ secrets.BUILD_STATUS_GIST_SECRET }}
  101. gistID: ${{ secrets.BUILD_STATUS_GIST_ID }}
  102. filename: cloudbridge_py${{ matrix.python-version }}_${{ matrix.cloud-provider }}.json
  103. label: ${{ matrix.cloud-provider }}
  104. message: ${{ fromJSON('["passing", "failing"]')[steps.tox.outcome != 'success'] }}
  105. color: ${{ fromJSON('["green", "red"]')[steps.tox.outcome != 'success'] }}
  106. - name: Coveralls
  107. if: ${{ steps.tox.outcome == 'success' }}
  108. uses: AndreMiras/coveralls-python-action@develop
  109. with:
  110. github-token: ${{ secrets.GITHUB_TOKEN }}
  111. flag-name: run-${{ matrix.python-version }}-${{ matrix.cloud-provider }}
  112. parallel: true
  113. finish:
  114. needs: integration
  115. runs-on: ubuntu-latest
  116. steps:
  117. - name: Coveralls Finished
  118. uses: AndreMiras/coveralls-python-action@develop
  119. with:
  120. github-token: ${{ secrets.github_token }}
  121. parallel-finished: true