|
| 1 | +name: Test - Fastpaths |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + schedule: |
| 6 | + - cron: "0 7 * * 5" |
| 7 | + |
| 8 | +permissions: |
| 9 | + id-token: write |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + run-tests: |
| 14 | + if: github.repository == 'aws-samples/eks-workshop-v2' |
| 15 | + name: run-tests |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: Check out code |
| 19 | + uses: actions/checkout@v5 |
| 20 | + - name: Install utilities |
| 21 | + run: | |
| 22 | + sudo apt install -y gettext |
| 23 | +
|
| 24 | + mkdir -p ${HOME}/.local/bin |
| 25 | + wget -q https://github.com/jckuester/awsweeper/releases/download/v0.12.0/awsweeper_0.12.0_linux_amd64.tar.gz |
| 26 | + tar zxf awsweeper_0.12.0_linux_amd64.tar.gz |
| 27 | + mv awsweeper_0.12.0_linux_amd64/awsweeper ${HOME}/.local/bin |
| 28 | +
|
| 29 | + chmod +x ${HOME}/.local/bin/* |
| 30 | +
|
| 31 | + echo "${HOME}/.local/bin" >> $GITHUB_PATH |
| 32 | + - name: Set cluster ID |
| 33 | + env: |
| 34 | + RUN_ID: "${{ github.job }}" |
| 35 | + AWS_REGION: "${{ secrets.AWS_REGION }}" |
| 36 | + run: | |
| 37 | + CLUSTER_ID=$(echo $RANDOM | md5sum | head -c 8) |
| 38 | + echo "Using cluster ID ${CLUSTER_ID}" |
| 39 | + echo "CLUSTER_ID=$CLUSTER_ID" >> $GITHUB_ENV |
| 40 | + - name: Get AWS credentials |
| 41 | + uses: aws-actions/configure-aws-credentials@v4.3.1 |
| 42 | + with: |
| 43 | + role-to-assume: ${{ secrets.AWS_ROLE_ARN }} |
| 44 | + role-duration-seconds: 3600 |
| 45 | + aws-region: ${{ secrets.AWS_REGION }} |
| 46 | + role-session-name: GithubActionsSession-${{ env.CLUSTER_ID }} |
| 47 | + - name: Create infrastructure |
| 48 | + id: create-infrastructure |
| 49 | + env: |
| 50 | + AWS_REGION: "${{ secrets.AWS_REGION }}" |
| 51 | + run: | |
| 52 | + make create-infrastructure environment="$CLUSTER_ID" |
| 53 | + - name: Refresh AWS credentials |
| 54 | + if: always() |
| 55 | + uses: aws-actions/configure-aws-credentials@v4.3.1 |
| 56 | + with: |
| 57 | + role-to-assume: ${{ secrets.AWS_ROLE_ARN }} |
| 58 | + role-duration-seconds: 3600 |
| 59 | + aws-region: ${{ secrets.AWS_REGION }} |
| 60 | + role-session-name: GithubActionsSession-${{ env.CLUSTER_ID }} |
| 61 | + - name: Run tests - Getting Started |
| 62 | + env: |
| 63 | + DOCKER_BUILDKIT: 1 |
| 64 | + DEV_MODE: 1 |
| 65 | + AWS_REGION: "${{ secrets.AWS_REGION }}" |
| 66 | + DOCKER_DNS_OVERRIDE: "8.8.8.8" |
| 67 | + run: | |
| 68 | + export AWS_DEFAULT_REGION="$AWS_REGION" |
| 69 | + bash hack/run-tests.sh "$CLUSTER_ID" "fastpaths/getting-started" "-" |
| 70 | + - name: Refresh AWS credentials |
| 71 | + if: always() |
| 72 | + uses: aws-actions/configure-aws-credentials@v4.3.1 |
| 73 | + with: |
| 74 | + role-to-assume: ${{ secrets.AWS_ROLE_ARN }} |
| 75 | + role-duration-seconds: 3600 |
| 76 | + aws-region: ${{ secrets.AWS_REGION }} |
| 77 | + role-session-name: GithubActionsSession-${{ env.CLUSTER_ID }} |
| 78 | + - name: Run tests - Operator Essentials |
| 79 | + env: |
| 80 | + DOCKER_BUILDKIT: 1 |
| 81 | + DEV_MODE: 1 |
| 82 | + AWS_REGION: "${{ secrets.AWS_REGION }}" |
| 83 | + DOCKER_DNS_OVERRIDE: "8.8.8.8" |
| 84 | + run: | |
| 85 | + export AWS_DEFAULT_REGION="$AWS_REGION" |
| 86 | + bash hack/run-tests.sh "$CLUSTER_ID" "fastpaths/operator" "-" |
| 87 | + - name: Refresh AWS credentials |
| 88 | + if: always() |
| 89 | + uses: aws-actions/configure-aws-credentials@v4.3.1 |
| 90 | + with: |
| 91 | + role-to-assume: ${{ secrets.AWS_ROLE_ARN }} |
| 92 | + role-duration-seconds: 3600 |
| 93 | + aws-region: ${{ secrets.AWS_REGION }} |
| 94 | + role-session-name: GithubActionsSession-${{ env.CLUSTER_ID }} |
| 95 | + - name: Run tests - Developer Essentials |
| 96 | + env: |
| 97 | + DOCKER_BUILDKIT: 1 |
| 98 | + DEV_MODE: 1 |
| 99 | + AWS_REGION: "${{ secrets.AWS_REGION }}" |
| 100 | + DOCKER_DNS_OVERRIDE: "8.8.8.8" |
| 101 | + run: | |
| 102 | + export AWS_DEFAULT_REGION="$AWS_REGION" |
| 103 | + bash hack/run-tests.sh "$CLUSTER_ID" "fastpaths/developer" "-" |
| 104 | + - name: Refresh AWS credentials |
| 105 | + if: always() |
| 106 | + uses: aws-actions/configure-aws-credentials@v4.3.1 |
| 107 | + with: |
| 108 | + role-to-assume: ${{ secrets.AWS_ROLE_ARN }} |
| 109 | + role-duration-seconds: 3600 |
| 110 | + aws-region: ${{ secrets.AWS_REGION }} |
| 111 | + role-session-name: GithubActionsSession-${{ env.CLUSTER_ID }} |
| 112 | + - name: Run tests - Cleanup |
| 113 | + if: always() |
| 114 | + env: |
| 115 | + DOCKER_BUILDKIT: 1 |
| 116 | + DEV_MODE: 1 |
| 117 | + AWS_REGION: "${{ secrets.AWS_REGION }}" |
| 118 | + run: | |
| 119 | + export AWS_DEFAULT_REGION="$AWS_REGION" |
| 120 | + make test environment="$CLUSTER_ID" module="cleanup" |
| 121 | + - name: Refresh AWS credentials |
| 122 | + if: always() |
| 123 | + uses: aws-actions/configure-aws-credentials@v4.3.1 |
| 124 | + with: |
| 125 | + role-to-assume: ${{ secrets.AWS_ROLE_ARN }} |
| 126 | + role-duration-seconds: 3600 |
| 127 | + aws-region: ${{ secrets.AWS_REGION }} |
| 128 | + role-session-name: GithubActionsSession-${{ env.CLUSTER_ID }} |
| 129 | + - name: Cleanup environment |
| 130 | + if: always() |
| 131 | + env: |
| 132 | + AWS_REGION: "${{ secrets.AWS_REGION }}" |
| 133 | + run: | |
| 134 | + make destroy-infrastructure environment="$CLUSTER_ID" |
0 commit comments