From 9205769c389d1bfd8034f73579ce735b10deda3e Mon Sep 17 00:00:00 2001 From: Ludo Date: Mon, 6 Mar 2023 09:44:55 +0100 Subject: [PATCH 1/3] try plugin cache, split examples tests --- .github/workflows/tests.yml | 81 ++++++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 760f866841..91b07b4675 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -31,7 +31,7 @@ env: TF_VERSION: 1.3.9 jobs: - examples: + examples-blueprints: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -54,6 +54,14 @@ jobs: terraform_version: ${{ env.TF_VERSION }} terraform_wrapper: false + - name: Configure provider cache + run: | + echo 'plugin_cache_dir = "$HOME/.terraform.d/plugin-cache"' \ + | tee -a $HOME/.terraformrc + echo 'disable_checkpoint = true' \ + | tee -a $HOME/.terraformrc + mkdir $HOME/.terraform.d/plugin-cache + # avoid conflicts with user-installed providers on local machines - name: Pin provider versions run: | @@ -66,7 +74,52 @@ jobs: run: | mkdir -p ${{ env.TF_PLUGIN_CACHE_DIR }} pip install -r tests/requirements.txt - pytest -vv tests/examples + pytest -vv -k blueprints/ tests/examples + + examples-modules: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Config auth + run: | + echo '{"type": "service_account", "project_id": "test-only"}' \ + | tee -a $GOOGLE_APPLICATION_CREDENTIALS + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + cache: 'pip' + cache-dependency-path: 'tests/requirements.txt' + + - name: Set up Terraform + uses: hashicorp/setup-terraform@v2 + with: + terraform_version: ${{ env.TF_VERSION }} + terraform_wrapper: false + + - name: Configure provider cache + run: | + echo 'plugin_cache_dir = "$HOME/.terraform.d/plugin-cache"' \ + | tee -a $HOME/.terraformrc + echo 'disable_checkpoint = true' \ + | tee -a $HOME/.terraformrc + mkdir $HOME/.terraform.d/plugin-cache + + # avoid conflicts with user-installed providers on local machines + - name: Pin provider versions + run: | + for f in $(find . -name versions.tf); do + sed -i 's/>=\(.*# tftest\)/=\1/g' $f; + done + + - name: Run tests on documentation examples + id: pytest + run: | + mkdir -p ${{ env.TF_PLUGIN_CACHE_DIR }} + pip install -r tests/requirements.txt + pytest -vv -k modules/ tests/examples blueprints: runs-on: ubuntu-latest @@ -91,6 +144,14 @@ jobs: terraform_version: ${{ env.TF_VERSION }} terraform_wrapper: false + - name: Configure provider cache + run: | + echo 'plugin_cache_dir = "$HOME/.terraform.d/plugin-cache"' \ + | tee -a $HOME/.terraformrc + echo 'disable_checkpoint = true' \ + | tee -a $HOME/.terraformrc + mkdir $HOME/.terraform.d/plugin-cache + # avoid conflicts with user-installed providers on local machines - name: Pin provider versions run: | @@ -128,6 +189,14 @@ jobs: terraform_version: ${{ env.TF_VERSION }} terraform_wrapper: false + - name: Configure provider cache + run: | + echo 'plugin_cache_dir = "$HOME/.terraform.d/plugin-cache"' \ + | tee -a $HOME/.terraformrc + echo 'disable_checkpoint = true' \ + | tee -a $HOME/.terraformrc + mkdir $HOME/.terraform.d/plugin-cache + # avoid conflicts with user-installed providers on local machines - name: Pin provider versions run: | @@ -165,6 +234,14 @@ jobs: terraform_version: ${{ env.TF_VERSION }} terraform_wrapper: false + - name: Configure provider cache + run: | + echo 'plugin_cache_dir = "$HOME/.terraform.d/plugin-cache"' \ + | tee -a $HOME/.terraformrc + echo 'disable_checkpoint = true' \ + | tee -a $HOME/.terraformrc + mkdir $HOME/.terraform.d/plugin-cache + # avoid conflicts with user-installed providers on local machines - name: Pin provider versions run: | From 2d959398937bfe4b24e4b15a3e32711a6701f0c2 Mon Sep 17 00:00:00 2001 From: Ludo Date: Mon, 6 Mar 2023 09:47:09 +0100 Subject: [PATCH 2/3] fix mkdir --- .github/workflows/tests.yml | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 91b07b4675..621be33d97 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -60,7 +60,7 @@ jobs: | tee -a $HOME/.terraformrc echo 'disable_checkpoint = true' \ | tee -a $HOME/.terraformrc - mkdir $HOME/.terraform.d/plugin-cache + mkdir -p $HOME/.terraform.d/plugin-cache # avoid conflicts with user-installed providers on local machines - name: Pin provider versions @@ -99,14 +99,6 @@ jobs: terraform_version: ${{ env.TF_VERSION }} terraform_wrapper: false - - name: Configure provider cache - run: | - echo 'plugin_cache_dir = "$HOME/.terraform.d/plugin-cache"' \ - | tee -a $HOME/.terraformrc - echo 'disable_checkpoint = true' \ - | tee -a $HOME/.terraformrc - mkdir $HOME/.terraform.d/plugin-cache - # avoid conflicts with user-installed providers on local machines - name: Pin provider versions run: | @@ -144,14 +136,6 @@ jobs: terraform_version: ${{ env.TF_VERSION }} terraform_wrapper: false - - name: Configure provider cache - run: | - echo 'plugin_cache_dir = "$HOME/.terraform.d/plugin-cache"' \ - | tee -a $HOME/.terraformrc - echo 'disable_checkpoint = true' \ - | tee -a $HOME/.terraformrc - mkdir $HOME/.terraform.d/plugin-cache - # avoid conflicts with user-installed providers on local machines - name: Pin provider versions run: | @@ -189,14 +173,6 @@ jobs: terraform_version: ${{ env.TF_VERSION }} terraform_wrapper: false - - name: Configure provider cache - run: | - echo 'plugin_cache_dir = "$HOME/.terraform.d/plugin-cache"' \ - | tee -a $HOME/.terraformrc - echo 'disable_checkpoint = true' \ - | tee -a $HOME/.terraformrc - mkdir $HOME/.terraform.d/plugin-cache - # avoid conflicts with user-installed providers on local machines - name: Pin provider versions run: | @@ -234,14 +210,6 @@ jobs: terraform_version: ${{ env.TF_VERSION }} terraform_wrapper: false - - name: Configure provider cache - run: | - echo 'plugin_cache_dir = "$HOME/.terraform.d/plugin-cache"' \ - | tee -a $HOME/.terraformrc - echo 'disable_checkpoint = true' \ - | tee -a $HOME/.terraformrc - mkdir $HOME/.terraform.d/plugin-cache - # avoid conflicts with user-installed providers on local machines - name: Pin provider versions run: | From d603117254ff8c2caeeb4f95d1fc6586840f7c63 Mon Sep 17 00:00:00 2001 From: Ludo Date: Mon, 6 Mar 2023 09:51:37 +0100 Subject: [PATCH 3/3] use cache --- .github/workflows/tests.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 621be33d97..22f3364593 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -99,6 +99,14 @@ jobs: terraform_version: ${{ env.TF_VERSION }} terraform_wrapper: false + - name: Configure provider cache + run: | + echo 'plugin_cache_dir = "$HOME/.terraform.d/plugin-cache"' \ + | tee -a $HOME/.terraformrc + echo 'disable_checkpoint = true' \ + | tee -a $HOME/.terraformrc + mkdir -p $HOME/.terraform.d/plugin-cache + # avoid conflicts with user-installed providers on local machines - name: Pin provider versions run: | @@ -136,6 +144,14 @@ jobs: terraform_version: ${{ env.TF_VERSION }} terraform_wrapper: false + - name: Configure provider cache + run: | + echo 'plugin_cache_dir = "$HOME/.terraform.d/plugin-cache"' \ + | tee -a $HOME/.terraformrc + echo 'disable_checkpoint = true' \ + | tee -a $HOME/.terraformrc + mkdir -p $HOME/.terraform.d/plugin-cache + # avoid conflicts with user-installed providers on local machines - name: Pin provider versions run: | @@ -173,6 +189,14 @@ jobs: terraform_version: ${{ env.TF_VERSION }} terraform_wrapper: false + - name: Configure provider cache + run: | + echo 'plugin_cache_dir = "$HOME/.terraform.d/plugin-cache"' \ + | tee -a $HOME/.terraformrc + echo 'disable_checkpoint = true' \ + | tee -a $HOME/.terraformrc + mkdir -p $HOME/.terraform.d/plugin-cache + # avoid conflicts with user-installed providers on local machines - name: Pin provider versions run: | @@ -210,6 +234,14 @@ jobs: terraform_version: ${{ env.TF_VERSION }} terraform_wrapper: false + - name: Configure provider cache + run: | + echo 'plugin_cache_dir = "$HOME/.terraform.d/plugin-cache"' \ + | tee -a $HOME/.terraformrc + echo 'disable_checkpoint = true' \ + | tee -a $HOME/.terraformrc + mkdir -p $HOME/.terraform.d/plugin-cache + # avoid conflicts with user-installed providers on local machines - name: Pin provider versions run: |