|
1 | 1 | env:
|
2 |
| - AWS_EC2_METADATA_DISABLED: true |
| 2 | + AWS_EC2_METADATA_DISABLED: true |
3 | 3 | jobs:
|
4 |
| - get-modules: |
5 |
| - outputs: |
6 |
| - matrix: ${{steps.list_dirs.outputs.matrix}} |
7 |
| - runs-on: ubuntu-20.04 |
8 |
| - steps: |
9 |
| - - uses: actions/checkout@v3 |
10 |
| - - id: list_dirs |
11 |
| - run: echo "::set-output name=matrix::$(ls -d */|sed -e 's/\///'|grep -v 'bless-ca\|scripts'|jq -cnR '[inputs | select(length>0)]')" |
12 |
| - lint: |
13 |
| - name: lint |
14 |
| - runs-on: ARM64 |
15 |
| - steps: |
16 |
| - - name: Generate token |
17 |
| - id: generate_token |
18 |
| - uses: tibdex/github-app-token@v2 |
19 |
| - with: |
20 |
| - app_id: ${{ secrets.CZI_GITHUB_HELPER_APP_ID }} |
21 |
| - private_key: ${{ secrets.CZI_GITHUB_HELPER_PK }} |
22 |
| - - uses: actions/checkout@v4 |
23 |
| - with: |
24 |
| - token: ${{ steps.generate_token.outputs.token }} |
25 |
| - ref: ${{ github.event.pull_request.head.ref }} |
26 |
| - - uses: actions/setup-go@v5 |
27 |
| - with: |
28 |
| - go-version-file: go.mod |
29 |
| - cache: true |
30 |
| - go-version: '>=1.19.0' |
31 |
| - cache-dependency-path: | |
32 |
| - go.sum |
33 |
| - - name: golangci-lint |
34 |
| - uses: golangci/golangci-lint-action@v6 |
35 |
| - with: |
36 |
| - version: v1.60.3 |
37 |
| - github-token: ${{ secrets.GITHUB_TOKEN }} |
38 |
| - |
39 |
| - test: |
40 |
| - name: test ${{ matrix.module }} |
41 |
| - needs: get-modules |
42 |
| - runs-on: ubuntu-latest |
43 |
| - permissions: |
44 |
| - id-token: write |
45 |
| - contents: read |
46 |
| - steps: |
47 |
| - - uses: actions/checkout@v3 |
48 |
| - - id: filter |
49 |
| - uses: dorny/paths-filter@v2 |
50 |
| - with: |
51 |
| - filters: | |
52 |
| - module: |
53 |
| - - '${{ matrix.module }}/**' |
54 |
| - - if: github.event == 'push' || steps.filter.outputs.module == 'true' |
55 |
| - uses: hashicorp/setup-terraform@v1 |
56 |
| - with: |
57 |
| - terraform_version: 0.14.5 |
58 |
| - terraform_wrapper: "false" |
59 |
| - - if: github.event == 'push' || steps.filter.outputs.module == 'true' |
60 |
| - uses: actions/setup-go@v2 |
61 |
| - with: |
62 |
| - go-version: 1.18 |
63 |
| - - if: github.event == 'push' || steps.filter.outputs.module == 'true' |
64 |
| - name: Install bless provider |
65 |
| - run: curl -s https://raw.githubusercontent.com/chanzuckerberg/terraform-provider-bless/main/download.sh | bash -s -- -b $HOME/.terraform.d/plugins/ -d |
66 |
| - - if: github.event == 'push' || steps.filter.outputs.module == 'true' |
67 |
| - name: Check bless provider |
68 |
| - run: ls -al $HOME/.terraform.d/plugins/terraform-provider-bless* |
69 |
| - - if: github.event == 'push' || steps.filter.outputs.module == 'true' |
70 |
| - name: Install Snowflake provider |
71 |
| - run: curl -s https://raw.githubusercontent.com/Snowflake-Labs/terraform-provider-snowflake/v0.53.0/download.sh | bash -s -- -b $HOME/.terraform.d/plugins/ -d v0.53.0 |
72 |
| - - if: github.event == 'push' || steps.filter.outputs.module == 'true' |
73 |
| - name: Check Snowflake provider |
74 |
| - run: ls -al $HOME/.terraform.d/plugins/terraform-provider-snowflake* |
75 |
| - - if: github.event == 'push' || steps.filter.outputs.module == 'true' |
76 |
| - name: Configure AWS Credentials |
77 |
| - uses: aws-actions/configure-aws-credentials@v2 |
78 |
| - with: |
79 |
| - aws-region: us-west-2 |
80 |
| - role-duration-seconds: 1200 |
81 |
| - role-session-name: cztackCICDModuleTests |
82 |
| - role-to-assume: "arn:aws:iam::119435350371:role/ci/cztack-1" |
83 |
| - strategy: |
84 |
| - fail-fast: false |
85 |
| - matrix: |
86 |
| - module: |
87 |
| - - ${{fromJson(needs.get-modules.outputs.matrix)}} |
88 |
| - - snowflake-account-grant-all |
89 |
| - - snowflake-database-grant-all |
90 |
| - - snowflake-external-table-grant-all |
91 |
| - - snowflake-file-format-grant-all |
92 |
| - - snowflake-function-grant-all |
93 |
| - - snowflake-integration-grant-all |
94 |
| - - snowflake-masking-policy-grant-all |
95 |
| - - snowflake-materialized-view-grant-all |
96 |
| - - snowflake-pipe-grant-all |
97 |
| - - snowflake-procedure-grant-all |
98 |
| - - snowflake-resource-monitor-grant-all |
99 |
| - - snowflake-row-access-policy-grant-all |
100 |
| - - snowflake-schema-grant-all |
101 |
| - - snowflake-sequence-grant-all |
102 |
| - - snowflake-stage-grant-all |
103 |
| - - snowflake-stream-grant-all |
104 |
| - - snowflake-table-grant-all |
105 |
| - - snowflake-task-grant-all |
106 |
| - - snowflake-view-grant-all |
107 |
| - - snowflake-warehouse-grant-all |
108 |
| - timeout-minutes: 45 |
| 4 | + get-modules: |
| 5 | + permissions: {} |
| 6 | + outputs: |
| 7 | + matrix: ${{steps.list_dirs.outputs.matrix}} |
| 8 | + runs-on: ubuntu-20.04 |
| 9 | + steps: |
| 10 | + - uses: actions/checkout@v3 |
| 11 | + - id: list_dirs |
| 12 | + run: echo "::set-output name=matrix::$(ls -d */|sed -e 's/\///'|grep -v 'bless-ca\|scripts'|jq -cnR '[inputs | select(length>0)]')" |
| 13 | + lint: |
| 14 | + name: lint |
| 15 | + runs-on: ARM64 |
| 16 | + permissions: |
| 17 | + contents: read |
| 18 | + id-token: write |
| 19 | + steps: |
| 20 | + - id: generate_token |
| 21 | + name: Generate token |
| 22 | + uses: tibdex/github-app-token@v2 |
| 23 | + with: |
| 24 | + app_id: ${{ secrets.CZI_GITHUB_HELPER_APP_ID }} |
| 25 | + private_key: ${{ secrets.CZI_GITHUB_HELPER_PK }} |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + ref: ${{ github.event.pull_request.head.ref }} |
| 29 | + token: ${{ steps.generate_token.outputs.token }} |
| 30 | + - uses: actions/setup-go@v5 |
| 31 | + with: |
| 32 | + cache: true |
| 33 | + cache-dependency-path: | |
| 34 | + go.sum |
| 35 | + go-version: '>=1.19.0' |
| 36 | + go-version-file: go.mod |
| 37 | + - name: golangci-lint |
| 38 | + uses: golangci/golangci-lint-action@v6 |
| 39 | + with: |
| 40 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 41 | + version: v1.64.6 |
| 42 | + test: |
| 43 | + name: test ${{ matrix.module }} |
| 44 | + needs: get-modules |
| 45 | + permissions: |
| 46 | + contents: read |
| 47 | + id-token: write |
| 48 | + runs-on: ubuntu-latest |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@v3 |
| 51 | + - id: filter |
| 52 | + uses: dorny/paths-filter@v2 |
| 53 | + with: |
| 54 | + filters: | |
| 55 | + module: |
| 56 | + - '${{ matrix.module }}/**' |
| 57 | + - if: github.event == 'push' || steps.filter.outputs.module == 'true' |
| 58 | + uses: hashicorp/setup-terraform@v1 |
| 59 | + with: |
| 60 | + terraform_version: 0.14.5 |
| 61 | + terraform_wrapper: "false" |
| 62 | + - if: github.event == 'push' || steps.filter.outputs.module == 'true' |
| 63 | + uses: actions/setup-go@v2 |
| 64 | + with: |
| 65 | + go-version: 1.18 |
| 66 | + - if: github.event == 'push' || steps.filter.outputs.module == 'true' |
| 67 | + name: Install bless provider |
| 68 | + run: curl -s https://raw.githubusercontent.com/chanzuckerberg/terraform-provider-bless/main/download.sh | bash -s -- -b $HOME/.terraform.d/plugins/ -d |
| 69 | + - if: github.event == 'push' || steps.filter.outputs.module == 'true' |
| 70 | + name: Check bless provider |
| 71 | + run: ls -al $HOME/.terraform.d/plugins/terraform-provider-bless* |
| 72 | + - if: github.event == 'push' || steps.filter.outputs.module == 'true' |
| 73 | + name: Install Snowflake provider |
| 74 | + run: curl -s https://raw.githubusercontent.com/Snowflake-Labs/terraform-provider-snowflake/v0.53.0/download.sh | bash -s -- -b $HOME/.terraform.d/plugins/ -d v0.53.0 |
| 75 | + - if: github.event == 'push' || steps.filter.outputs.module == 'true' |
| 76 | + name: Check Snowflake provider |
| 77 | + run: ls -al $HOME/.terraform.d/plugins/terraform-provider-snowflake* |
| 78 | + - if: github.event == 'push' || steps.filter.outputs.module == 'true' |
| 79 | + name: Configure AWS Credentials |
| 80 | + uses: aws-actions/configure-aws-credentials@v2 |
| 81 | + with: |
| 82 | + aws-region: us-west-2 |
| 83 | + role-duration-seconds: 1200 |
| 84 | + role-session-name: cztackCICDModuleTests |
| 85 | + role-to-assume: arn:aws:iam::119435350371:role/ci/cztack-1 |
| 86 | + strategy: |
| 87 | + fail-fast: false |
| 88 | + matrix: |
| 89 | + module: |
| 90 | + - ${{fromJson(needs.get-modules.outputs.matrix)}} |
| 91 | + - snowflake-account-grant-all |
| 92 | + - snowflake-database-grant-all |
| 93 | + - snowflake-external-table-grant-all |
| 94 | + - snowflake-file-format-grant-all |
| 95 | + - snowflake-function-grant-all |
| 96 | + - snowflake-integration-grant-all |
| 97 | + - snowflake-masking-policy-grant-all |
| 98 | + - snowflake-materialized-view-grant-all |
| 99 | + - snowflake-pipe-grant-all |
| 100 | + - snowflake-procedure-grant-all |
| 101 | + - snowflake-resource-monitor-grant-all |
| 102 | + - snowflake-row-access-policy-grant-all |
| 103 | + - snowflake-schema-grant-all |
| 104 | + - snowflake-sequence-grant-all |
| 105 | + - snowflake-stage-grant-all |
| 106 | + - snowflake-stream-grant-all |
| 107 | + - snowflake-table-grant-all |
| 108 | + - snowflake-tag-grant-all |
| 109 | + - snowflake-task-grant-all |
| 110 | + - snowflake-user-grant-all |
| 111 | + - snowflake-view-grant-all |
| 112 | + - snowflake-warehouse-grant-all |
| 113 | + timeout-minutes: 45 |
109 | 114 | name: CI
|
110 | 115 | "on":
|
111 |
| - pull_request: null |
112 |
| - push: |
113 |
| - branches: |
114 |
| - - main |
| 116 | + pull_request: null |
| 117 | + push: |
| 118 | + branches: |
| 119 | + - main |
0 commit comments