diff options
Diffstat (limited to 'ansible_collections/google/cloud/.github')
6 files changed, 295 insertions, 0 deletions
diff --git a/ansible_collections/google/cloud/.github/workflows/ansible-integration-tests.yml b/ansible_collections/google/cloud/.github/workflows/ansible-integration-tests.yml new file mode 100644 index 000000000..7fb920f6f --- /dev/null +++ b/ansible_collections/google/cloud/.github/workflows/ansible-integration-tests.yml @@ -0,0 +1,67 @@ +name: "Run integration tests for the cloud.google collection" +on: + pull_request: {} + push: + branches: master +env: + GCP_SERVICE_ACCOUNT: "github-ci@ansible-gcp-ci.iam.gserviceaccount.com" + GCP_PROJECT: "ansible-gcp-ci" + GCP_FOLDER_ID: "542027184392" +jobs: + integration: + # NOTE: GitHub does not allow secrets to be used + # in PRs sent from forks. As such, this configuration is for + # PRs that the maintainers would like to send to test. + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + defaults: + run: + working-directory: ansible_collections/google/cloud + strategy: + matrix: + ansible_version: + - stable-2.13 + steps: + - name: check out code + uses: actions/checkout@v2 + with: + path: ansible_collections/google/cloud + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: '3.9' # this is the minimum version required for Ansible 2.13 + - name: Install dependencies + run: pip install -r requirements.txt + - name: Install ansible-base (${{ matrix.ansible_version }}) + run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check + # bootstrap integration env + - name: Write integration-test configuration files + env: + CI_SERVICE_ACCOUNT_FILE_CONTENTS: ${{ secrets.CI_SERVICE_ACCOUNT_FILE_CONTENTS }} + run: | + echo "$CI_SERVICE_ACCOUNT_FILE_CONTENTS" > /tmp/service-account-key.json + echo "[default] + gcp_project: $GCP_PROJECT + gcp_cred_file: /tmp/service-account-key.json + gcp_cred_kind: serviceaccount + gcp_cred_email: $GCP_SERVICE_ACCOUNT + gcp_folder_id: $GCP_FOLDER_ID + " > ./tests/integration/cloud-config-gcp.ini + # cleanup test environment + - name: Auth to Gcloud + uses: google-github-actions/auth@v1 + env: + CI_SERVICE_ACCOUNT_FILE_CONTENTS: ${{ secrets.CI_SERVICE_ACCOUNT_FILE_CONTENTS }} + with: + service_account: "$GCP_SERVICE_ACCOUNT" + credentials_json: "${{ secrets.CI_SERVICE_ACCOUNT_FILE_CONTENTS }}" + - name: Set up Cloud SDK + uses: google-github-actions/setup-gcloud@v1 + - name: Run cleanup + run: | + ./scripts/bootstrap-project.sh $GCP_PROJECT $GCP_SERVICE_ACCOUNT + ./scripts/cleanup-project.sh $GCP_PROJECT $GCP_FOLDER_ID + # run tests + - name: Run integration tests + # Add the -vvv flag to print out more output + run: ansible-test integration -v --color --python 3.9 --venv-system-site-packages
\ No newline at end of file diff --git a/ansible_collections/google/cloud/.github/workflows/ansible-test.yml b/ansible_collections/google/cloud/.github/workflows/ansible-test.yml new file mode 100644 index 000000000..5ccdd1447 --- /dev/null +++ b/ansible_collections/google/cloud/.github/workflows/ansible-test.yml @@ -0,0 +1,68 @@ +name: "Run tests for the cloud.google collection" +on: [pull_request] +env: + PYTHON_VERSION: "3.9" # minimum version for Ansible 2.14 +jobs: + sanity-and-lint: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ansible_collections/google/cloud + strategy: + matrix: + ansible_version: + - stable-2.14 + steps: + - name: check out code + uses: actions/checkout@v2 + with: + path: ansible_collections/google/cloud + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: ${{ env.PYTHON_VERSION }} + # Automation-hub requires python2.7 sanity tests + - name: setup python2.7 + run: | + sudo apt-add-repository universe + sudo apt update + sudo apt install python2.7 + curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py + sudo /usr/bin/python2.7 get-pip.py + pip2 install virtualenv + - name: Install ansible-base (${{ matrix.ansible_version }}) + run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check + - name: Run ansible-test sanity + # validate-modules cannot be turned on until #498 is resolved. + run: ansible-test sanity -v --color --skip validate-modules + - name: Install ansible-lint + run: pip install ansible-lint==6.13.1 + - name: Run ansible-lint + run: ansible-lint + unit: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ansible_collections/google/cloud + strategy: + matrix: + ansible_version: + - stable-2.14 + - stable-2.11 + steps: + - name: check out code + uses: actions/checkout@v2 + with: + path: ansible_collections/google/cloud + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: "${{ env.PYTHON_VERSION }}" + - name: Install dependencies + run: pip install -r requirements.txt + - name: Install test dependencies + run: pip install -r requirements-test.txt + - name: Install ansible-base (${{ matrix.ansible_version }}) + run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check + - name: Run unit tests + run: ansible-test units -v --color --python "$PYTHON_VERSION"
\ No newline at end of file diff --git a/ansible_collections/google/cloud/.github/workflows/automationhub.yml b/ansible_collections/google/cloud/.github/workflows/automationhub.yml new file mode 100644 index 000000000..29e126283 --- /dev/null +++ b/ansible_collections/google/cloud/.github/workflows/automationhub.yml @@ -0,0 +1,25 @@ +name: Upload release to Automation Hub + +on: + release: + types: [created] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ansible + - name: Build and publish + env: + ANSIBLE_AUTOMATION_HUB_API_KEY: ${{ secrets.ANSIBLE_AUTOMATION_HUB_API_KEY }} + run: | + ansible-galaxy collection build . + ansible-galaxy collection publish *.tar.gz --api-key=$ANSIBLE_AUTOMATION_HUB_API_KEY -s=https://cloud.redhat.com/api/automation-hub/ diff --git a/ansible_collections/google/cloud/.github/workflows/gcloud.yml b/ansible_collections/google/cloud/.github/workflows/gcloud.yml new file mode 100644 index 000000000..8100e1e6f --- /dev/null +++ b/ansible_collections/google/cloud/.github/workflows/gcloud.yml @@ -0,0 +1,58 @@ +name: "google.cloud.gcloud" +on: + push: + paths: + - 'roles/gcloud/**' + - '.github/workflows/gcloud.yml' + - 'molecule/gcloud/**' + pull_request: + paths: + - 'roles/gcloud/**' + - '.github/workflows/gcloud.yml' + - 'molecule/gcloud/**' +jobs: + molecule: + runs-on: ubuntu-18.04 + env: + PY_COLORS: 1 + ANSIBLE_FORCE_COLOR: 1 + strategy: + fail-fast: true + matrix: + molecule_playbook: + - archive_playbook.yml + - package_playbook.yml + collection_role: + - gcloud + steps: + - name: Check out code + uses: actions/checkout@v1 + with: + path: ansible_collections/google/cloud + + - name: Set up Python 3.9 + uses: actions/setup-python@v1 + with: + python-version: 3.9 + + - name: Install dependencies + run: | + sudo apt-get install -y apt-transport-https ca-certificates curl gnupg \ + lsb-release + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg \ + --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg + echo \ + "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + sudo apt-get update + sudo apt-get install -y docker-ce docker-ce-cli containerd.io + python -m pip install --upgrade pip + pip install molecule[docker] yamllint ansible ansible-lint docker + + - name: Run role test + run: >- + molecule --version && + ansible --version && + MOLECULE_PLAYBOOK=${{ matrix.molecule_playbook }} + MOLECULE_NO_LOG="false" + molecule --debug test -s ${{ matrix.collection_role }} diff --git a/ansible_collections/google/cloud/.github/workflows/gcsfuse.yml b/ansible_collections/google/cloud/.github/workflows/gcsfuse.yml new file mode 100644 index 000000000..a58e6a373 --- /dev/null +++ b/ansible_collections/google/cloud/.github/workflows/gcsfuse.yml @@ -0,0 +1,52 @@ +name: "google.cloud.gcsfuse" +on: + push: + paths: + - roles/gcsfuse/** + - .github/workflows/gcsfuse.yml + pull_request: + paths: + - roles/gcsfuse/** + - .github/workflows/gcsfuse.yml +jobs: + gcsfuse: + runs-on: ubuntu-18.04 + env: + PY_COLORS: 1 + ANSIBLE_FORCE_COLOR: 1 + strategy: + fail-fast: false + matrix: + collection_role: + - gcsfuse + steps: + - name: Check out code + uses: actions/checkout@v1 + with: + path: ansible_collections/google/cloud + + - name: Set up Python 3.9 + uses: actions/setup-python@v1 + with: + python-version: 3.9 + + - name: Install dependencies + run: | + sudo apt-get install -y apt-transport-https ca-certificates curl gnupg \ + lsb-release + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg \ + --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg + echo \ + "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + sudo apt-get update + sudo apt-get install -y docker-ce docker-ce-cli containerd.io + python -m pip install --upgrade pip + pip install molecule[docker] yamllint ansible ansible-lint docker + + - name: Run role test + run: >- + molecule --version && + ansible --version && + MOLECULE_NO_LOG="false" + molecule --debug test -s ${{ matrix.collection_role }} diff --git a/ansible_collections/google/cloud/.github/workflows/pythonpublish.yml b/ansible_collections/google/cloud/.github/workflows/pythonpublish.yml new file mode 100644 index 000000000..0318edfc4 --- /dev/null +++ b/ansible_collections/google/cloud/.github/workflows/pythonpublish.yml @@ -0,0 +1,25 @@ +name: Upload release to Galaxy + +on: + release: + types: [created] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ansible + - name: Build and publish + env: + ANSIBLE_GALAXY_API_KEY: ${{ secrets.ANSIBLE_GALAXY_API_KEY }} + run: | + ansible-galaxy collection build . + ansible-galaxy collection publish *.tar.gz --api-key $ANSIBLE_GALAXY_API_KEY |