|
| 1 | +name: scheduled-workflow |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +jobs: |
| 7 | + build-us-west-2: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + steps: |
| 10 | + - name: Check out development branch |
| 11 | + |
| 12 | + with: |
| 13 | + ref: development |
| 14 | + |
| 15 | + - name: Initialize AWS credentials |
| 16 | + uses: aws-actions/configure-aws-credentials@v1 |
| 17 | + with: |
| 18 | + aws-access-key-id: ${{ secrets.BUILD_AWS_ACCESS_KEY_ID }} |
| 19 | + aws-secret-access-key: ${{ secrets.BUILD_AWS_SECRET_ACCESS_KEY }} |
| 20 | + aws-region: us-west-2 |
| 21 | + |
| 22 | + - name: Generate short sha |
| 23 | + run: | |
| 24 | + echo "SHORT_SHA=`git rev-parse --short HEAD`" >> $GITHUB_ENV |
| 25 | + - name: Run build script |
| 26 | + run: | |
| 27 | + cd deployment |
| 28 | + SFM_STACK_NAME=sfm-dev |
| 29 | + REGION=us-west-2 |
| 30 | + VERSION=$SHORT_SHA |
| 31 | + DIST_OUTPUT_BUCKET=sfm-dev |
| 32 | + TEMPLATE_OUTPUT_BUCKET=sfm-dev-us-west-2 |
| 33 | + ./build-s3-dist.sh --template-bucket $TEMPLATE_OUTPUT_BUCKET --code-bucket $DIST_OUTPUT_BUCKET --version $VERSION --region $REGION |
| 34 | + aws cloudformation deploy --stack-name $SFM_STACK_NAME --region $REGION --template-file global-s3-assets/simple-file-manager-for-amazon-efs.template --s3-bucket $DIST_OUTPUT_BUCKET-$REGION --s3-prefix efs_file_manager/$VERSION --parameter-overrides AdminEmail=${{ secrets.TEST_ADMIN_EMAIL }} --capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND --force-upload |
| 35 | + - name: Build Failed |
| 36 | + if: ${{ failure() }} |
| 37 | + uses: nashmaniac/[email protected] |
| 38 | + with: |
| 39 | + title: Nightly build failed |
| 40 | + token: ${{secrets.GITHUB_TOKEN}} |
| 41 | + assignees: brandold |
| 42 | + labels: bug |
| 43 | + body: Nightly build failed for commit ${{github.sha}} |
| 44 | + |
| 45 | + |
| 46 | + test-us-west-2: |
| 47 | + needs: build-us-west-2 |
| 48 | + runs-on: ubuntu-latest |
| 49 | + env: |
| 50 | + SFM_REGION: 'us-west-2' |
| 51 | + SFM_STACK_NAME: sfm-dev |
| 52 | + steps: |
| 53 | + - name: Check out development branch |
| 54 | + |
| 55 | + with: |
| 56 | + ref: development |
| 57 | + - name: Initialize build AWS credentials |
| 58 | + uses: aws-actions/configure-aws-credentials@v1 |
| 59 | + with: |
| 60 | + aws-access-key-id: ${{ secrets.BUILD_AWS_ACCESS_KEY_ID }} |
| 61 | + aws-secret-access-key: ${{ secrets.BUILD_AWS_SECRET_ACCESS_KEY }} |
| 62 | + aws-region: us-west-2 |
| 63 | + - name: Generate short sha |
| 64 | + run: | |
| 65 | + echo "SHORT_SHA=`git rev-parse --short HEAD`" >> $GITHUB_ENV |
| 66 | + - name: Run cfn_nag |
| 67 | + uses: stelligent/cfn_nag@master |
| 68 | + continue-on-error: true |
| 69 | + with: |
| 70 | + input_path: deployment |
| 71 | + - name: Setup Chromedriver |
| 72 | + uses: nanasess/setup-chromedriver@master |
| 73 | + - name: Get user pool id |
| 74 | + run: | |
| 75 | + echo "USER_POOL_ID=`aws cloudformation describe-stacks --query 'Stacks[?starts_with(StackName, \`sfm-dev-EFSFileAuthentication\`)].Outputs[1].OutputValue' --output text`" >> $GITHUB_ENV |
| 76 | + - name: Reset SFM user password |
| 77 | + run: | |
| 78 | + aws cognito-idp admin-set-user-password --user-pool-id $USER_POOL_ID --username ${{ secrets.TEST_ADMIN_EMAIL }} --password ${{ secrets.TEST_ADMIN_PASSWORD }} --permanent |
| 79 | + - name: Get SFM endpoint |
| 80 | + run: | |
| 81 | + echo "SFM_ENDPOINT=`aws cloudformation describe-stacks --query 'Stacks[?starts_with(StackName, \`sfm-dev-EFSFileWebApplication\`)].Outputs[0].OutputValue' --output text`" >> $GITHUB_ENV |
| 82 | + - name: Set admin creds |
| 83 | + run: | |
| 84 | + echo SFM_USERNAME=${{ secrets.TEST_ADMIN_EMAIL }} >> $GITHUB_ENV |
| 85 | + echo SFM_PASSWORD=${{ secrets.TEST_ADMIN_PASSWORD }} >> $GITHUB_ENV |
| 86 | + - name: Set media path and file name |
| 87 | + run: | |
| 88 | + echo TEST_MEDIA_PATH=$GITHUB_WORKSPACE/test/e2e/ >> $GITHUB_ENV |
| 89 | + echo TEST_FILE_NAME=run_e2e.sh >> $GITHUB_ENV |
| 90 | + - name: Set filesystem id |
| 91 | + run: | |
| 92 | + echo FILESYSTEM_ID=${{ secrets.TEST_FILESYSEM_ID }} >> $GITHUB_ENV |
| 93 | + - name: Run E2E tests |
| 94 | + run: | |
| 95 | + cd $GITHUB_WORKSPACE |
| 96 | + cd test/e2e |
| 97 | + ./run_e2e.sh |
| 98 | + - name: Test Failed |
| 99 | + if: ${{ failure() }} |
| 100 | + uses: nashmaniac/[email protected] |
| 101 | + with: |
| 102 | + title: Nightly test for failed |
| 103 | + token: ${{secrets.GITHUB_TOKEN}} |
| 104 | + assignees: brandold |
| 105 | + labels: bug |
| 106 | + body: Nightly test failed for commit ${{github.sha}} |
| 107 | + - name: Delete stack |
| 108 | + run: | |
| 109 | + aws cloudformation delete-stack --stack-name $SFM_STACK_NAME |
0 commit comments