Skip to content

Commit

Permalink
ci: re-enable nightly workflows (#8543)
Browse files Browse the repository at this point in the history
* Revert "Revert "ci: reenable nightly jobs" (#8530)"

This reverts commit 5fead3e.

* ci: re-enable nightly workflows

* ci: use pipeline params to trigger workflows

* ci: allow schedule to be determined by nightly-jobs branch
  • Loading branch information
johnpc committed Oct 25, 2021
1 parent 91183a9 commit 02894dc
Showing 1 changed file with 198 additions and 0 deletions.
198 changes: 198 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ setup: true
orbs:
continuation: circleci/continuation@0.1.2

parameters:
nightly_console_integration_tests:
type: boolean
default: false
e2e_resource_cleanup:
type: boolean
default: false
setup:
type: boolean
default: true

executors:
linux: &linux-e2e-executor
docker:
Expand All @@ -31,9 +42,196 @@ jobs:
yarn split-e2e-tests
- continuation/continue:
configuration_path: .circleci/generated_config.yml # use newly generated config to continue
build:
parameters:
os:
type: executor
default: linux
executor: << parameters.os >>
steps:
- checkout
- run: yarn run production-build
- save_cache:
key: >-
amplify-cli-yarn-deps-{{ .Branch }}-{{ checksum "yarn.lock" }}-{{
arch }}
paths:
- ~/.cache
- save_cache:
key: amplify-cli-ssh-deps-{{ .Branch }}
paths:
- ~/.ssh
- when:
condition:
equal:
- docker:
- image: >-
public.ecr.aws/a6e6w2n0/amplify-cli-e2e-base-image-repo-public:latest
working_directory: ~/repo
resource_class: large
environment:
AMPLIFY_DIR: /home/circleci/repo/out
AMPLIFY_PATH: /home/circleci/repo/out/amplify-pkg-linux
- << parameters.os >>
steps:
- persist_to_workspace:
root: .
paths: .
publish_to_local_registry:
docker:
- image: public.ecr.aws/a6e6w2n0/amplify-cli-e2e-base-image-repo-public:latest
working_directory: ~/repo
resource_class: large
environment:
AMPLIFY_DIR: /home/circleci/repo/out
AMPLIFY_PATH: /home/circleci/repo/out/amplify-pkg-linux
steps:
- attach_workspace:
at: ./
- restore_cache:
key: >-
amplify-cli-yarn-deps-{{ .Branch }}-{{ checksum "yarn.lock" }}-{{
arch }}
- run:
name: Publish to verdaccio
command: |
source .circleci/local_publish_helpers.sh
startLocalRegistry "$(pwd)/.circleci/verdaccio.yaml"
setNpmRegistryUrlToLocal
loginToLocalRegistry
git config user.email not@used.com
git config user.name "Doesnt Matter"
yarn publish-to-verdaccio
unsetNpmRegistryUrl
- run:
name: Generate unified changelog
command: |
git reset --hard HEAD
yarn update-versions
yarn ts-node scripts/unified-changelog.ts
- run:
name: Save new amplify GitHub tag
command: node scripts/echo-current-cli-version.js > .amplify-pkg-version
- save_cache:
key: amplify-verdaccio-cache-{{ .Branch }}-{{ .Revision }}
paths:
- ~/verdaccio-cache/
- save_cache:
key: amplify-unified-changelog-{{ .Branch }}-{{ .Revision }}
paths:
- ~/repo/UNIFIED_CHANGELOG.md
- save_cache:
key: amplfiy-pkg-tag-{{ .Branch }}-{{ .Revision }}
paths:
- ~/repo/.amplify-pkg-version
amplify_console_integration_tests:
working_directory: ~/repo
parameters:
os:
type: executor
default: linux
executor: << parameters.os >>
steps:
- attach_workspace:
at: ./
- restore_cache:
key: amplify-verdaccio-cache-{{ .Branch }}-{{ .Revision }}
- run:
name: Start verdaccio, install node CLI and amplify-app
command: |
source .circleci/local_publish_helpers.sh
startLocalRegistry "$(pwd)/.circleci/verdaccio.yaml"
setNpmRegistryUrlToLocal
changeNpmGlobalPath
npm install -g @aws-amplify/cli
npm install -g amplify-app
unsetNpmRegistryUrl
- run:
command: |
echo "export PATH=~/.npm-global/bin:$PATH" >> $BASH_ENV
source $BASH_ENV
source .circleci/local_publish_helpers.sh
amplify -v
cd packages/amplify-console-integration-tests
retry yarn run console-integration --maxWorkers=3
name: Run Amplify Console integration tests
no_output_timeout: 90m
- run:
name: Scan And Cleanup E2E Test Artifacts
command: |
if ! yarn ts-node .circleci/scan_artifacts.ts; then
echo "Cleaning the repository"
git clean -fdx
exit 1
fi
when: always
- store_test_results:
path: packages/amplify-console-integration-tests/
- store_artifacts:
path: >-
~/repo/packages/amplify-console-integration-tests/console-integration-reports
cleanup_resources:
docker:
- image: public.ecr.aws/a6e6w2n0/amplify-cli-e2e-base-image-repo-public:latest
working_directory: ~/repo
resource_class: large
environment:
AMPLIFY_DIR: /home/circleci/repo/out
AMPLIFY_PATH: /home/circleci/repo/out/amplify-pkg-linux
steps:
- attach_workspace:
at: ./
- restore_cache:
key: >-
amplify-cli-yarn-deps-{{ .Branch }}-{{ checksum "yarn.lock" }}-{{
arch }}
- run:
name: Run cleanup script
command: |
cd packages/amplify-e2e-tests
yarn clean-e2e-resources
no_output_timeout: 90m
- run:
name: Scan And Cleanup E2E Test Artifacts
command: |
if ! yarn ts-node .circleci/scan_artifacts.ts; then
echo "Cleaning the repository"
git clean -fdx
exit 1
fi
when: always
- store_artifacts:
path: ~/repo/packages/amplify-e2e-tests/amplify-e2e-reports

# our single workflow, that triggers the setup job defined above
workflows:
setup:
when: << pipeline.parameters.setup >>
jobs:
- setup
nightly_console_integration_tests:
when: << pipeline.parameters.nightly_console_integration_tests >>
jobs:
- build
- publish_to_local_registry:
requires:
- build
- amplify_console_integration_tests:
context:
- amplify-ecr-image-pull
- console-e2e-test
- e2e-auth-credentials
- e2e-test-context
requires:
- build
- publish_to_local_registry
e2e_resource_cleanup:
when: << pipeline.parameters.e2e_resource_cleanup >>
jobs:
- build
- cleanup_resources:
context:
- cleanup-resources
- e2e-test-context
requires:
- build

0 comments on commit 02894dc

Please sign in to comment.