From 5bdc7cb7547dbd58b70347f50f8576bd24ac9b33 Mon Sep 17 00:00:00 2001 From: murage Date: Mon, 29 Nov 2021 14:55:33 +0300 Subject: [PATCH] build: upate build pipelines --- .github/dependabot.yml | 8 - .github/workflows/branches.yml | 4 +- .github/workflows/master-workflow.yml | 293 ---------------------- .github/workflows/staging-workflow.yml | 333 ------------------------- 4 files changed, 2 insertions(+), 636 deletions(-) delete mode 100644 .github/dependabot.yml delete mode 100644 .github/workflows/master-workflow.yml delete mode 100644 .github/workflows/staging-workflow.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index a17026253..000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,8 +0,0 @@ -version: 2 -updates: -- package-ecosystem: npm - directory: "/" - schedule: - interval: weekly - time: '00:00' - open-pull-requests-limit: 3 \ No newline at end of file diff --git a/.github/workflows/branches.yml b/.github/workflows/branches.yml index f7db1ffbb..03a881c95 100644 --- a/.github/workflows/branches.yml +++ b/.github/workflows/branches.yml @@ -7,7 +7,7 @@ on: jobs: FrontendTest: - name: Test Wikonnect Frontend + name: Frontend Lint test runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 @@ -50,7 +50,7 @@ jobs: run: yarn --cwd ./frontend lint:js BackendTest: - name: Test Wikonnect Backend + name: Backend Lint test runs-on: ubuntu-18.04 services: # Label used to access the service container diff --git a/.github/workflows/master-workflow.yml b/.github/workflows/master-workflow.yml deleted file mode 100644 index f71e55017..000000000 --- a/.github/workflows/master-workflow.yml +++ /dev/null @@ -1,293 +0,0 @@ -name: Production Deployment - -on: - push: - branches: - - master - -jobs: - - FrontendTest: - name: Test Wikonnect Frontend - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - - # Initialize Node.js - - name: Install Node.js 14.x - uses: actions/setup-node@v1 - with: - node-version: '14.x' - - # Yarn cache dir - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v2 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - # Install project dependencies, test and build - - name: Install Wikonnect dependencies - run: yarn --frozen-lockfile - - # Install project dependencies, test and build - - name: Install frontend dependencies - run: yarn --frozen-lockfile --cwd ./frontend - - name: Run build - run: yarn --frozen-lockfile --cwd ./frontend build --prod - - # Install project dependencies, test and build - - name: Install backend dependencies - run: yarn --frozen-lockfile --cwd ./server - - # Frontend tests - - name: Lint Ember hbs - run: yarn --cwd ./frontend lint:hbs - - name: Ember Lint:js - run: yarn --cwd ./frontend lint:js - - BackendTest: - name: Test Wikonnect Backend - runs-on: ubuntu-18.04 - services: - # Label used to access the service container - postgres: - # Docker Hub image - image: postgres - # Provide the password for postgres - env: - POSTGRES_PASSWORD: postgres - # Set health checks to wait until postgres has started - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - # Maps tcp port 5432 on service container to the host - - 5432:5432 - - steps: - - uses: actions/checkout@v2 - - # Initialize Node.js - - name: Install Node.js 14.x - uses: actions/setup-node@v1 - with: - node-version: '14.x' - - # Yarn cache dir - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v2 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - # Install project dependencies, test and build - - name: Install Wikonnect dependencies - run: yarn --frozen-lockfile - - # Install project dependencies, test and build - - name: Install frontend dependencies - run: yarn --frozen-lockfile --cwd ./frontend - - name: Run build - run: yarn --frozen-lockfile --cwd ./frontend build --prod - - # Install project dependencies, test and build - - name: Install backend dependencies - run: yarn --frozen-lockfile --cwd ./server - - # Backend migrate database nad seed - - name: Backend database set-up - run: yarn --cwd ./server db:init; yarn --cwd ./server db:seed - env: - POSTGRES_HOST: localhost - SEEDS: 25 - POSTGRES_PORT: 5432 - NODE_ENV: action - - # Install project dependencies, test and build - - name: Backend testing - run: yarn --cwd ./server test:local - env: - NODE_ENV: action - - IntegrationTest: - name: Integration Test - runs-on: ubuntu-18.04 - strategy: - fail-fast: false - matrix: - containers: [1, 2, 3, 4, 5] - services: - # Label used to access the service container - postgres: - # Docker Hub image - image: postgres - # Provide the password for postgres - env: - POSTGRES_PASSWORD: postgres - # Set health checks to wait until postgres has started - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - # Maps tcp port 5432 on service container to the host - - 5432:5432 - - needs: [FrontendTest, BackendTest] - steps: - - uses: actions/checkout@v2 - - # Initialize Node.js - - name: Install Node.js 14.x - uses: actions/setup-node@v1 - with: - node-version: '14.x' - - # Install YARN dependencies, cache them correctly - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v2 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - # Install project dependencies, test and build - - name: Install Wikonnect dependencies - run: yarn --frozen-lockfile - - # Install project dependencies, test and build - - name: Install frontend dependencies - run: yarn --frozen-lockfile --cwd ./frontend - - name: Run build - run: yarn --frozen-lockfile --cwd ./frontend build --prod - - # Install project dependencies, test and build - - name: Install backend dependencies - run: yarn --frozen-lockfile --cwd ./server - - # Backend migrate database nad seed - - name: Backend database set-up - run: yarn --cwd ./server db:init; yarn --cwd ./server db:seed - env: - POSTGRES_HOST: localhost - POSTGRES_PORT: 5432 - SEEDS: 25 - NODE_ENV: action - - # Run all Cypress tests - - name: Cypress run - uses: cypress-io/github-action@v2 - env: - NODE_ENV: action - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} - with: - start: yarn --cwd ./server start, yarn --cwd ./frontend start - wait-on: "http://localhost:4200" - wait-on-timeout: 120 - parallel: true - record: true - - - uses: actions/upload-artifact@v1 - if: failure() - with: - name: cypress-screenshots - path: cypress/screenshots - - deploy: - name: CD Pipeline - runs-on: ubuntu-18.04 - strategy: - matrix: - python-version: [3.8] - appname: ['aws-codedeploy'] - deploy-group: ['wikonnect-production'] - s3-bucket: ['wikonnect-codedeploy-deployments'] - s3-filename: ['master-wikonnect-codedeploy-${{ github.sha }}'] - - needs: ['IntegrationTest'] - steps: - - uses: actions/checkout@v2 - - # cache node_modules in our monorepo project instead of caching the yarn cache - - uses: actions/cache@v2 - with: - path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} - - # Initialize Node.js - - name: Install Node.js 14.x - uses: actions/setup-node@v1 - with: - node-version: '14.x' - - # Wikonnect root install dependencies - - name: Wikonnect root install dependencies - run: yarn --frozen-lockfile - - # Frontend install dependencies - - name: Frontend install dependencies - run: yarn --frozen-lockfile --cwd ./frontend - - # Frontend run build - - name: Frontend run build - env: - GOOGLE_KEY: ${{ secrets.GOOGLE_KEY }} - run: yarn --cwd ./frontend build --prod - - # Install project dependencies, test and build - - name: Install dependencies - run: yarn --frozen-lockfile --cwd ./server - - # Install AWS CLI 2 - - name: Install AWS CLI 2 - run: | - curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" - unzip awscliv2.zip - sudo ./aws/install --update - # Configure AWS credentials - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - # Deploy push to AWS S3 - - name: AWS Deploy push - run: | - aws deploy push \ - --application-name ${{ matrix.appname }} \ - --description "This is a revision for the ${{ matrix.appname }}-${{ github.sha }}" \ - --ignore-hidden-files \ - --s3-location s3://${{ matrix.s3-bucket }}/${{ matrix.s3-filename }}.zip \ - --source . - # Create deployment to CodeDeploy - - name: AWS Create Deployment - run: | - aws deploy create-deployment \ - --application-name ${{ matrix.appname }} \ - --deployment-config-name CodeDeployDefault.OneAtATime \ - --deployment-group-name ${{ matrix.deploy-group }} \ - --file-exists-behavior OVERWRITE \ - --s3-location bucket=${{ matrix.s3-bucket }},key=${{ matrix.s3-filename }}.zip,bundleType=zip \ diff --git a/.github/workflows/staging-workflow.yml b/.github/workflows/staging-workflow.yml deleted file mode 100644 index 4ea405ae8..000000000 --- a/.github/workflows/staging-workflow.yml +++ /dev/null @@ -1,333 +0,0 @@ -name: Staging Deployment - -on: - push: - branches: - - staging -jobs: - Build: - name: Build Wikonnect - runs-on: ubuntu-18.04 - - steps: - - uses: actions/checkout@v2 - - # Initialize Node.js - - name: Install Node.js 14.x - uses: actions/setup-node@v1 - with: - node-version: '14.x' - - # Yarn cache dir - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v2 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - # Install project dependencies, test and build - - name: Install Wikonnect dependencies - run: yarn --frozen-lockfile - - # Install project dependencies, test and build - - name: Install frontend dependencies - run: yarn --frozen-lockfile --cwd ./frontend - - - name: Run build - run: yarn --frozen-lockfile --cwd ./frontend build --prod - - # Install project dependencies, test and build - - name: Install backend dependencies - run: yarn --frozen-lockfile --cwd ./server - - FrontendTest: - name: Test Wikonnect Frontend - runs-on: ubuntu-18.04 - needs: Build - steps: - - uses: actions/checkout@v2 - - # Initialize Node.js - - name: Install Node.js 14.x - uses: actions/setup-node@v1 - with: - node-version: '14.x' - - # Yarn cache dir - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v2 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - # Install project dependencies, test and build - - name: Install Wikonnect dependencies - run: yarn --frozen-lockfile - - # Install project dependencies, test and build - - name: Install frontend dependencies - run: yarn --frozen-lockfile --cwd ./frontend - - name: Run build - run: yarn --frozen-lockfile --cwd ./frontend build --prod - - # Install project dependencies, test and build - - name: Install backend dependencies - run: yarn --frozen-lockfile --cwd ./server - - # Frontend tests - - name: Lint Ember hbs - run: yarn --cwd ./frontend lint:hbs - - name: Ember Lint:js - run: yarn --cwd ./frontend lint:js - - BackendTest: - name: Test Wikonnect Backend - runs-on: ubuntu-18.04 - needs: Build - services: - # Label used to access the service container - postgres: - # Docker Hub image - image: postgres - # Provide the password for postgres - env: - POSTGRES_PASSWORD: postgres - # Set health checks to wait until postgres has started - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - # Maps tcp port 5432 on service container to the host - - 5432:5432 - - steps: - - uses: actions/checkout@v2 - - # Initialize Node.js - - name: Install Node.js 14.x - uses: actions/setup-node@v1 - with: - node-version: '14.x' - - # Yarn cache dir - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v2 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - # Install project dependencies, test and build - - name: Install Wikonnect dependencies - run: yarn --frozen-lockfile - - # Install project dependencies, test and build - - name: Install frontend dependencies - run: yarn --frozen-lockfile --cwd ./frontend - - name: Run build - run: yarn --frozen-lockfile --cwd ./frontend build --prod - - # Install project dependencies, test and build - - name: Install backend dependencies - run: yarn --frozen-lockfile --cwd ./server - - # Backend migrate database nad seed - - name: Backend database set-up - run: yarn --cwd ./server db:init; yarn --cwd ./server db:seed - env: - POSTGRES_HOST: localhost - SEEDS: 25 - POSTGRES_PORT: 5432 - NODE_ENV: action - - # Install project dependencies, test and build - - name: Backend testing - run: yarn --cwd ./server test:local - env: - NODE_ENV: action - - IntegrationTest: - name: Integration Test - runs-on: ubuntu-18.04 - strategy: - fail-fast: false - matrix: - containers: [1, 2, 3, 4, 5] - services: - # Label used to access the service container - postgres: - # Docker Hub image - image: postgres - # Provide the password for postgres - env: - POSTGRES_PASSWORD: postgres - # Set health checks to wait until postgres has started - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - # Maps tcp port 5432 on service container to the host - - 5432:5432 - - needs: [FrontendTest, BackendTest] - steps: - - uses: actions/checkout@v2 - - # Initialize Node.js - - name: Install Node.js 14.x - uses: actions/setup-node@v1 - with: - node-version: '14.x' - - # Install YARN dependencies, cache them correctly - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v2 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - # Install project dependencies, test and build - - name: Install Wikonnect dependencies - run: yarn --frozen-lockfile - - # Install project dependencies, test and build - - name: Install frontend dependencies - run: yarn --frozen-lockfile --cwd ./frontend - - name: Run build - run: yarn --frozen-lockfile --cwd ./frontend build --prod - - # Install project dependencies, test and build - - name: Install backend dependencies - run: yarn --frozen-lockfile --cwd ./server - - # Backend migrate database nad seed - - name: Backend database set-up - run: yarn --cwd ./server db:init; yarn --cwd ./server db:seed - env: - POSTGRES_HOST: localhost - POSTGRES_PORT: 5432 - SEEDS: 25 - NODE_ENV: action - - # Run all Cypress tests - - name: Cypress run - uses: cypress-io/github-action@v2 - env: - NODE_ENV: action - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} - with: - start: yarn --cwd ./server start, yarn --cwd ./frontend start - wait-on: "http://localhost:4200" - wait-on-timeout: 120 - parallel: true - record: true - - - uses: actions/upload-artifact@v1 - if: failure() - with: - name: cypress-screenshots - path: cypress/screenshots - deploy: - name: CD Pipeline - runs-on: ubuntu-18.04 - strategy: - matrix: - python-version: [3.8] - appname: ['aws-codedeploy'] - deploy-group: ['wikonnect-staging'] - s3-bucket: ['wikonnect-codedeploy-deployments'] - s3-filename: ['staging-wikonnect-codedeploy-${{ github.sha }}'] - - needs: ['IntegrationTest'] - steps: - - uses: actions/checkout@v2 - - # cache node_modules in our monorepo project instead of caching the yarn cache - - uses: actions/cache@v2 - with: - path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} - - # Initialize Node.js - - name: Install Node.js 14.x - uses: actions/setup-node@v1 - with: - node-version: '14.x' - - # Wikonnect root install dependencies - - name: Wikonnect root install dependencies - run: yarn --frozen-lockfile - - # Frontend install dependencies - - name: Frontend install dependencies - run: yarn --frozen-lockfile --cwd ./frontend - - # Frontend run build - - name: Frontend run build - env: - GOOGLE_KEY: ${{ secrets.GOOGLE_KEY }} - run: yarn --cwd ./frontend build --prod - - # Install project dependencies, test and build - - name: Install dependencies - run: yarn --frozen-lockfile --cwd ./server - - # Install AWS CLI 2 - - name: Install AWS CLI 2 - run: | - curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" - unzip awscliv2.zip - sudo ./aws/install --update - # Configure AWS credentials - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - # Deploy push to AWS S3 - - name: AWS Deploy push - run: | - aws deploy push \ - --application-name ${{ matrix.appname }} \ - --description "This is a revision for the ${{ matrix.appname }}-${{ github.sha }}" \ - --ignore-hidden-files \ - --s3-location s3://${{ matrix.s3-bucket }}/${{ matrix.s3-filename }}.zip \ - --source . - # Create deployment to CodeDeploy - - name: AWS Create Deployment - run: | - aws deploy create-deployment \ - --application-name ${{ matrix.appname }} \ - --deployment-config-name CodeDeployDefault.OneAtATime \ - --deployment-group-name ${{ matrix.deploy-group }} \ - --file-exists-behavior OVERWRITE \ - --s3-location bucket=${{ matrix.s3-bucket }},key=${{ matrix.s3-filename }}.zip,bundleType=zip \ \ No newline at end of file