github.com/hazelops/ize@v1.1.12-0.20230915191306-97d7c0e48f11/.github/workflows/run.e2e-tests.yml (about) 1 name: "Tests: E2E" 2 defaults: 3 run: 4 shell: bash 5 6 env: 7 AWS_PROFILE: default 8 AWS_REGION: us-east-1 9 10 on: 11 workflow_dispatch: 12 pull_request: 13 14 jobs: 15 build: 16 name: Build 17 strategy: 18 matrix: 19 os: 20 - ubuntu-latest 21 # TODO: re-enable other platforms after Ubuntu is working fine 22 - macos-latest 23 # - windows-latest 24 runs-on: ${{ matrix.os }} 25 steps: 26 - name: Install Go 27 uses: actions/setup-go@v2 28 with: 29 go-version: 1.18.x 30 31 - name: Checkout Code 32 uses: actions/checkout@v2 33 34 - name: Build 35 run: | 36 go mod download 37 make bin 38 39 - name: Upload Artifact 40 uses: actions/upload-artifact@v3 41 with: 42 name: ize-${{ matrix.os }}-${{ github.sha }} 43 path: ${{ github.workspace }}/ize 44 45 test-ecs-apps: 46 name: ECS Apps Monorepo 47 needs: build 48 strategy: 49 max-parallel: 1 50 matrix: 51 os: 52 - ubuntu-latest 53 # - windows-latest 54 # - macos-latest 55 runs-on: ${{ matrix.os }} 56 env: 57 IZE_EXAMPLES_PATH: ${{ github.workspace }}/examples/ecs-apps-monorepo 58 steps: 59 - name: Configure Environment Variables 60 run: | 61 echo "${{ github.workspace }}/bin/" >> $GITHUB_PATH 62 echo "ENV=${{ github.job }}-$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV 63 64 - name: Configure AWS Credentials 65 uses: aws-actions/configure-aws-credentials@v1 66 with: 67 aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PROD }} 68 aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }} 69 aws-region: ${{ env.AWS_REGION }} 70 71 - name: Install Go 72 uses: actions/setup-go@v2 73 with: 74 go-version: 1.18.x 75 76 - name: Checkout Code 77 uses: actions/checkout@v2 78 79 - name: Prepare Test Environment 80 run: mv "${{ env.IZE_EXAMPLES_PATH }}/.ize/env/testnut" "${{ env.IZE_EXAMPLES_PATH }}/.ize/env/${{ env.ENV }}" 81 82 - uses: actions/download-artifact@v3 83 with: 84 name: ize-${{ matrix.os }}-${{ github.sha }} 85 path: bin 86 87 - name: Make Executable 88 run: | 89 chmod +rx "${{ github.workspace }}/bin/ize" 90 ize --version 91 92 - name: Create AWS Profile 93 run: ize gen aws-profile 94 95 - name: Generate Test SSH Key 96 run: ssh-keygen -q -f ~/.ssh/id_rsa 97 98 - name: Run Tests 99 run: | 100 go test -v --timeout 0 --tags="e2e ecs_apps" ./tests/e2e 101 102 - name: Cleanup Infra 103 if: ${{ always() }} 104 run: | 105 cd "${{ env.IZE_EXAMPLES_PATH }}" 106 ize down --auto-approve 107 108 test-tunnel: 109 name: Bastion Tunnel Monorepo 110 needs: build 111 strategy: 112 max-parallel: 1 113 matrix: 114 os: 115 - ubuntu-latest 116 # TODO: re-enable other platforms after Ubuntu is working fine 117 # - windows-latest 118 - macos-latest 119 runs-on: ${{ matrix.os }} 120 env: 121 IZE_EXAMPLES_PATH: ${{ github.workspace }}/examples/bastion-tunnel-monorepo 122 steps: 123 - name: Configure Environment Variables 124 run: | 125 echo "${{ github.workspace }}/bin/" >> $GITHUB_PATH 126 echo "ENV=${{ github.job }}-$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV 127 128 - name: Configure AWS Credentials 129 uses: aws-actions/configure-aws-credentials@v1 130 with: 131 aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PROD }} 132 aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }} 133 aws-region: ${{ env.AWS_REGION }} 134 135 - name: Install Go 136 uses: actions/setup-go@v2 137 with: 138 go-version: 1.18.x 139 140 - name: Checkout Code 141 uses: actions/checkout@v2 142 143 - name: Prepare Test Environment 144 run: mv "${{ env.IZE_EXAMPLES_PATH }}/.ize/env/testnut" "${{ env.IZE_EXAMPLES_PATH }}/.ize/env/${{ env.ENV }}" 145 146 - uses: actions/download-artifact@v3 147 with: 148 name: ize-${{ matrix.os }}-${{ github.sha }} 149 path: bin 150 151 - name: Make Executable 152 run: | 153 chmod +rx "${{ github.workspace }}/bin/ize" 154 ize --version 155 156 - name: Create AWS Profile 157 run: ize gen aws-profile 158 159 - name: Generate Test SSH Key 160 run: | 161 ssh-keygen -q -f ~/.ssh/id_rsa -t rsa -N '' 162 ssh-keygen -q -f ~/.ssh/id_rsa_tunnel_test -t rsa -N '' 163 chmod 600 ~/.ssh/id_rsa_tunnel_test 164 chmod 600 ~/.ssh/id_rsa_tunnel_test.pub 165 cat ~/.ssh/id_rsa_tunnel_test.pub 166 ls -ld ~/.ssh/* 167 168 - name: Run Tests 169 run: | 170 go test -v --timeout 0 --tags="e2e bastion_tunnel" ./tests/e2e 171 172 - name: Cleanup Infra 173 if: ${{ always() }} 174 run: | 175 cd "${{ env.IZE_EXAMPLES_PATH }}" 176 ize down --auto-approve 177 178 test-terraform: 179 name: Terraform Commands 180 needs: build 181 strategy: 182 max-parallel: 1 183 matrix: 184 os: 185 - ubuntu-latest 186 # TODO: re-enable other platforms after Ubuntu is working fine 187 # - macos-latest 188 # - windows-latest 189 190 runs-on: ${{ matrix.os }} 191 env: 192 IZE_EXAMPLES_PATH: ${{ github.workspace }}/examples/sls-apps-monorepo 193 steps: 194 - name: Configure Environment Variables 195 run: | 196 echo "${{ github.workspace }}/bin/" >> $GITHUB_PATH 197 echo "ENV=${{ github.job }}-$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV 198 199 - name: Configure AWS Credentials 200 uses: aws-actions/configure-aws-credentials@v1 201 with: 202 aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PROD }} 203 aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }} 204 aws-region: ${{ env.AWS_REGION }} 205 206 - name: Install Go 207 uses: actions/setup-go@v2 208 with: 209 go-version: 1.18.x 210 211 - name: Checkout Code 212 uses: actions/checkout@v2 213 214 - name: Prepare Test Environment 215 run: mv "${{ env.IZE_EXAMPLES_PATH }}/.ize/env/testnut" "${{ env.IZE_EXAMPLES_PATH }}/.ize/env/${{ env.ENV }}" 216 217 - uses: actions/download-artifact@v3 218 with: 219 name: ize-${{ matrix.os }}-${{ github.sha }} 220 path: bin 221 222 - name: Make Executable 223 run: | 224 chmod +rx "${{ github.workspace }}/bin/ize" 225 ize --version 226 227 - name: Create AWS Profile 228 run: ize gen aws-profile 229 230 - name: Generate Test SSH Key 231 run: ssh-keygen -q -f ~/.ssh/id_rsa 232 233 - name: Run Tests 234 run: | 235 go test -v --timeout 0 --tags="e2e terraform" ./tests/e2e