integration.yaml 4.6 KB

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