Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Commit

Permalink
chore: enforce running integ tests prior to merges into mainline (#317
Browse files Browse the repository at this point in the history
)
  • Loading branch information
rsmayda authored Feb 18, 2021
1 parent 7c8827a commit 0a6505c
Show file tree
Hide file tree
Showing 60 changed files with 160 additions and 130 deletions.
15 changes: 9 additions & 6 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@ Issue #, if available:

Description of changes:

Checklist:
Checklist:

<!-- You can erase any parts of this template not applicable to your Pull Request. -->

* [ ] Have you successfully deployed to an AWS account with your changes?
* [ ] Have you linted your code locally prior to submission?
* [ ] Have you written new tests for your core changes, as applicable?
* [ ] Have you successfully ran unit tests and manual tests with your changes locally?
* [ ] If you had to run manual tests, have you considered automating those tests by adding them to [end-to-end tests](../main/end-to-end-tests/README.md)?
- [ ] Have you successfully deployed to an AWS account with your changes?
- [ ] Have you written new tests for your core changes, as applicable?
- [ ] Have you successfully tested with your changes locally?
- [ ] If you had to run manual tests, have you considered automating those tests by adding them to [end-to-end tests](../main/end-to-end-tests/README.md)?

<!-- For major releases please provide internal ticket id -->

AS review ticket id:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
name: Deploy
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#

name: Deploy & Integration Test
on:
push:
branches:
- master
- develop
jobs:
pre-deployment-check:
name: Pre deployment check
runs-on: ubuntu-18.04
timeout-minutes: 10
steps:
- name: "Block Concurrent Deployments"
uses: softprops/turnstyle@v1
with:
poll-interval-seconds: 10
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deploy:
name: Deploy to Dev
runs-on: ubuntu-18.04
needs: pre-deployment-check
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -58,3 +75,16 @@ jobs:
CYPRESS_BASE_URL: ${{ secrets.CYPRESS_BASE_URL}}
CYPRESS_researcherEmail: ${{ secrets.CYPRESS_RESEARCHER_EMAIL}}
CYPRESS_researcherPassword: ${{ secrets.CYPRESS_RESEARCHER_PASSWORD}}
merge-develop-to-mainline:
name: Merge develop to mainline
runs-on: ubuntu-18.04
needs: cypress-test
steps:
- uses: actions/checkout@v2
- name: Merge to mainline branch
uses: devmasx/merge-branch@v1.1.0
with:
type: now
target_branch: "mainline"
env:
GITHUB_TOKEN: ${{secrets.MERGE_TOKEN}}
15 changes: 10 additions & 5 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#

name: labeler

on: [pull_request]
Expand All @@ -10,11 +15,11 @@ jobs:
- uses: codelytv/pr-size-labeler@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
xs_max_size: '10'
s_max_size: '100'
m_max_size: '500'
l_max_size: '1000'
fail_if_xl: 'false'
xs_max_size: "10"
s_max_size: "100"
m_max_size: "500"
l_max_size: "1000"
fail_if_xl: "false"
message_if_xl: >
'This PR exceeds the recommended size of 1000 lines.
Please make sure you are NOT addressing multiple issues with one PR.
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/mainline-protection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#

name: Mainline Protection
on:
pull_request:
branches:
- mainline
# The purpose of this workflow is to create a failing Status check on pull request against mainline. This will prevent
# PR from being merged into mainline.
jobs:
mainline-protection:
name: Only create PR against develop branch, not mainline branch
runs-on: ubuntu-18.04
steps:
- run: failing-command # An invalid bash command to trigger failure of this workflow
34 changes: 0 additions & 34 deletions .github/workflows/test.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
name: Static Code Analysis
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#

name: Unit Tests & Code Analysis
on:
push:
branches:
- master
pull_request:
branches:
- master
- develop
jobs:
static-code-analysis:
name: Static Code Analysis
static-code-analysis-and-unit-test:
name: Unit Tests & Code Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -29,6 +31,9 @@ jobs:
run: |
npm install -g pnpm
pnpm recursive install --unsafe-perm --stream
- name: Run unit tests
- name: Run static code analysis & linting tests
run: |
./scripts/run-static-code-analysis.sh --stream
- name: Run unit tests
run: |
./scripts/run-unit-tests.sh --stream
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
.build
docs/build

# https://github.com/github/gitignore/blob/master/Global/VisualStudioCode.gitignore
# VisualStudioCode.gitignore
.vscode/*
!.vscode/*.example.json
!.vscode/settings.json
Expand All @@ -31,3 +31,6 @@ docs/build
*/*/*/config/settings/*.yml
!*/*/*/config/settings/.defaults.yml
!*/*/*/config/settings/example*.yml

# rStudio specific
source/ServiceWorkbenchOnAWS/main/solution/machine-images/config/infra/files/rstudio/*
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ reported the issue. Please try to include as much information as you can. Detail

Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:

1. You are working against the latest source on the _master_ branch.
1. You are working against the latest source on the _mainline_ branch.
2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
3. You open an issue to discuss any significant work - we would hate for your time to be wasted.

Expand Down
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Before you can build this project, please install the following prerequisites.
- **PNPM:** Install [pnpm](https://pnpm.js.org/en/) as follows

```bash
$ npm install -g pnpm
npm install -g pnpm
```

- **Go:** You also need to install [Go](https://golang.org/doc/install). `Go` is used for creating a multipart S3 downloader tool that is used in AWS Service Catalog EC2 Windows based research environments.
Expand All @@ -41,7 +41,7 @@ In the rest of this README, \$STAGE is used to designate the stage.
Now, let's perform an initial deployment. Note that when invoked without parameters, this will assume a deployment stage of \$USER, which is the logged-in user name on Mac and Linux systems.

```bash
$ scripts/environment-deploy.sh
scripts/environment-deploy.sh
```

You can override the default stage name of \$USER if you prefer. For example, if you want your stage name to be `qa`, then:
Expand All @@ -52,51 +52,51 @@ You can override the default stage name of \$USER if you prefer. For example, if
Following an initial successful deployment, you can subsequently deploy updates to the infrastructure, backend, and post-deployment components as follows:

```bash
$ cd main/solution/<component>
$ pnpx sls deploy -s $STAGE
$ cd -
cd main/solution/<component>
pnpx sls deploy -s $STAGE
cd -
```

To run (rerun) the post-deployment steps:

```bash
$ cd main/solution/post-deployment
$ pnpx sls invoke -f postDeployment -s $STAGE
$ cd -
cd main/solution/post-deployment
pnpx sls invoke -f postDeployment -s $STAGE
cd -
```

To re-deploy the UI

```bash
$ cd main/solution/ui
$ pnpx sls package-ui --stage $STAGE --local=true
$ pnpx sls package-ui --stage $STAGE
$ pnpx sls deploy-ui --stage $STAGE --invalidate-cache=true
$ cd -
cd main/solution/ui
pnpx sls package-ui --stage $STAGE --local=true
pnpx sls package-ui --stage $STAGE
pnpx sls deploy-ui --stage $STAGE --invalidate-cache=true
cd -
```

To view information about the deployed components (e.g. CloudFront URL, root password), run the
following, where `[stage]` is the name of the environment (defaults to `$STAGE` if not provided):

```bash
$ scripts/get-info.sh [stage]
scripts/get-info.sh [stage]
```

Once you have deployed the app and the UI, you can start developing locally on your computer.
You will be running a local server that uses the same lambda functions code. To start local development, run the following commands to run a local server:

```bash
$ cd main/solution/backend
$ pnpx sls offline -s $STAGE
$ cd -
cd main/solution/backend
pnpx sls offline -s $STAGE
cd -
```

Then, in a separate terminal, run the following commands to start the ui server and open up a browser:

```bash
$ cd main/solution/ui
$ pnpx sls start-ui -s $STAGE
$ cd -
cd main/solution/ui
pnpx sls start-ui -s $STAGE
cd -
```

---
Expand Down Expand Up @@ -166,8 +166,8 @@ They are meant to provide a sample service, a sample controller and a sample UI
To audit the installed NPM packages, run the following commands:

```bash
$ cd <root of git repo>
$ pnpm audit
cd <root of git repo>
pnpm audit
```

Please follow prevailing best practices for auditing your NPM dependencies and fixing them as needed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# Webpack generated directories
.webpack

# https://github.com/github/gitignore/blob/master/Global/VisualStudioCode.gitignore
# VisualStudioCode.gitignore
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
Expand Down
2 changes: 1 addition & 1 deletion addons/addon-base-raas-ui/packages/base-raas-ui/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# Serverless directories
.serverless

# https://github.com/github/gitignore/blob/master/Global/VisualStudioCode.gitignore
# VisualStudioCode.gitignore
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# transpiled code
dist

# https://github.com/github/gitignore/blob/master/Global/VisualStudioCode.gitignore
# VisualStudioCode.gitignore
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Serverless directories
.serverless

# https://github.com/github/gitignore/blob/master/Global/VisualStudioCode.gitignore
# VisualStudioCode.gitignore
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Serverless directories
.serverless

# https://github.com/github/gitignore/blob/master/Global/VisualStudioCode.gitignore
# VisualStudioCode.gitignore
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Serverless directories
.serverless

# https://github.com/github/gitignore/blob/master/Global/VisualStudioCode.gitignore
# VisualStudioCode.gitignore
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Serverless directories
.serverless

# https://github.com/github/gitignore/blob/master/Global/VisualStudioCode.gitignore
# VisualStudioCode.gitignore
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Serverless directories
.serverless

# https://github.com/github/gitignore/blob/master/Global/VisualStudioCode.gitignore
# VisualStudioCode.gitignore
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
**/npm-debug.log
**/pnpm-debug.log

# https://github.com/github/gitignore/blob/master/Global/VisualStudioCode.gitignore
# VisualStudioCode.gitignore
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
Expand Down
Loading

0 comments on commit 0a6505c

Please sign in to comment.