<commit_before>name: Workflow build and tests

on:
  push:

jobs:
  build:
    runs-on: ubuntu-20.04
    strategy:
      matrix:
        node-version: [15]
    steps:
    - uses: actions/checkout@v2
    
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v2
      with:
        node-version: ${{ matrix.node-version }}
    
    - name: Cache .pnpm-store
      uses: actions/cache@v1
      with:
        path: ~/.pnpm-store
        key: ${{ runner.os }}-node${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
    
    - name: Install pnpm
      run: curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@6
    
    - name: Install dependencies
      run: cd monorepo && pnpm install
    
    - name: Run tests
      run: cd monorepo && pnpm m run test:coverage
    
    - name: Upload coverage to Codecov
      uses: codecov/codecov-action@v2
      with:
        token: ${{ secrets.CODECOV_TOKEN }}
        fail_ci_if_error: true
        files: ./monorepo/clients/canary/coverage/clover.xml,./monorepo/libs/components/coverage/clover.xml
        flags: unittests
        verbose: true
    
    - name: Log in to Docker Hub
      uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
      with:
        username: ${{ secrets.DOCKER_USERNAME }}
        password: ${{ secrets.DOCKER_PASSWORD }}

    - name: Extract metadata (tags, labels) for Docker
      id: meta
      uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
      with:
        images: nossas/bonde-clients

    - name: Build and push Docker image
      uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
      with:
        context: ./monorepo
        file: ./monorepo/Dockerfile.clients
        push: true
        tags: ${{ steps.meta.outputs.tags }}
        labels: ${{ steps.meta.outputs.labels }}

    - name: Rancher Deploy clients/canary-2
      uses: yantadeu/rancher-deploy-action@v0.0.3
      env:
        RANCHER_ACCESS_KEY: ${{ secrets.RANCHER_ACCESS_KEY }}
        RANCHER_SECRET_KEY: ${{ secrets.RANCHER_SECRET_KEY }}
        RANCHER_URL_API: ${{ secrets.RANCHER_URL_API }}
        SERVICE_NAME: 'clients/canary-2'
        DOCKER_IMAGE: ${{ format('nossas/bonde-clients:{0}', steps.meta.outputs.tags) }}
        DOCKER_IMAGE_LATEST: 'nossas/bonde-clients:latest'<commit_msg>fix(ci): add environment to deploy<commit_after>name: Workflow build and tests

on:
  push:
    branches:
      - feature/*
      - hotfix/*

jobs:
  build:
    runs-on: ubuntu-20.04
    environment: staging
    strategy:
      matrix:
        node-version: [15]
    steps:
    - uses: actions/checkout@v2
    
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v2
      with:
        node-version: ${{ matrix.node-version }}
    
    - name: Cache .pnpm-store
      uses: actions/cache@v1
      with:
        path: ~/.pnpm-store
        key: ${{ runner.os }}-node${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
    
    - name: Install pnpm
      run: curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm@6
    
    - name: Install dependencies
      run: cd monorepo && pnpm install
    
    - name: Run tests
      run: cd monorepo && pnpm m run test:coverage
    
    - name: Upload coverage to Codecov
      uses: codecov/codecov-action@v2
      with:
        token: ${{ secrets.CODECOV_TOKEN }}
        fail_ci_if_error: true
        files: ./monorepo/clients/canary/coverage/clover.xml,./monorepo/libs/components/coverage/clover.xml
        flags: unittests
        verbose: true
    
    - name: Log in to Docker Hub
      uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
      with:
        username: ${{ secrets.DOCKER_USERNAME }}
        password: ${{ secrets.DOCKER_PASSWORD }}

    - name: Extract metadata (tags, labels) for Docker
      id: meta
      uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
      with:
        images: nossas/bonde-clients

    - name: Build and push Docker image
      uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
      with:
        context: ./monorepo
        file: ./monorepo/Dockerfile.clients
        push: true
        tags: ${{ steps.meta.outputs.tags }}
        labels: ${{ steps.meta.outputs.labels }}

    - name: Rancher Deploy clients/canary-2
      uses: yantadeu/rancher-deploy-action@v0.0.3
      env:
        RANCHER_ACCESS_KEY: ${{ secrets.RANCHER_ACCESS_KEY }}
        RANCHER_SECRET_KEY: ${{ secrets.RANCHER_SECRET_KEY }}
        RANCHER_URL_API: ${{ secrets.RANCHER_URL_API }}
        SERVICE_NAME: 'clients/canary-2'
        DOCKER_IMAGE: ${{ format('nossas/bonde-clients:{0}', steps.meta.outputs.tags) }}
        DOCKER_IMAGE_LATEST: 'nossas/bonde-clients:latest'
{'fraction_non_alphanumeric': 0.12034919975057161, 'fraction_numerical': 0.03741425898981501, 'mean_word_length': 2.3603351955307263, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 2}}
{'dir': 'git-commits-cleaned', 'id': '5970905', 'n_tokens_mistral': 1821, 'n_tokens_neox': 1696, 'n_words': 314}