<commit_before>image: node:latest

cache:
  paths:
    - node_modules

stages:
  - build
  - deploy

lint:
  script:
    - yarn install --pure-lockfile
    - npm run lint
  stage: build

# Unit test
test:
  script:
    - yarn install --pure-lockfile
    - npm test -- --runInBand
  stage: build

# Compile assets
build:
  script:
    - yarn install --pure-lockfile
    - npm run build:prod
  stage: build
  artifacts:
    paths:
      - dist

# Deploy production artifact to Firebase Hosting (Main deployment)
firebase:
  script:
    - npm -g config set user root # Workaround for EACCES issue when run as root
    - npm install -g firebase-tools
    - firebase deploy --token $FIREBASE_TOKEN
  stage: deploy
  environment:
    name: firebase
    url: https://bridge.holi0317.net
  only:
    - master

# Deploy production artifact to GitLab pages (Secondary deployment)
pages:
  script: mkdir public && cp -R dist/* public/
  stage: deploy
  artifacts:
    paths:
      - public
  environment:
    name: gitlab-page
    url: https://holi0317.gitlab.io/bridge-calc
  only:
   - master

# Deploy staging artifact to Google Cloud Storage
gcs:
  image: google/cloud-sdk:latest
  script:
    # Set up auth
    - echo $GCLOUD_SERVICE_KEY | base64 -d - > gcloud-service-key.json
    - gcloud auth activate-service-account --key-file gcloud-service-key.json
    - rm gcloud-service-key.json
    - gcloud config set project $GCLOUD_PROJECT

    - gsutil rsync -d -r dist/ $GCLOUD_BUCKET
  environment:
    name: gcloud
    url: https://staging.bridge-calc-8c2a7.appspot.com/
  variables:
    GCLOUD_PROJECT: bridge-calc-8c2a7
    GCLOUD_BUCKET: gs://staging.bridge-calc-8c2a7.appspot.com/
  stage: deploy
  only:
    - staging<commit_msg>Change staging deployment to gitlab page<commit_after>image: node:latest

cache:
  paths:
    - node_modules

stages:
  - build
  - deploy

lint:
  script:
    - yarn install --pure-lockfile
    - npm run lint
  stage: build

# Unit test
test:
  script:
    - yarn install --pure-lockfile
    - npm test -- --runInBand
  stage: build

# Compile assets
build:
  script:
    - yarn install --pure-lockfile
    - npm run build:prod
  stage: build
  artifacts:
    paths:
      - dist

# Deploy production artifact to Firebase Hosting (Master deployment)
firebase:
  script:
    - npm -g config set user root # Workaround for EACCES issue when run as root
    - npm install -g firebase-tools
    - firebase deploy --token $FIREBASE_TOKEN
  stage: deploy
  environment:
    name: firebase
    url: https://bridge.holi0317.net
  only:
    - master

# Deploy production artifact to GitLab pages (Staging deployment)
pages:
  script: mkdir public && cp -R dist/* public/
  stage: deploy
  artifacts:
    paths:
      - public
  environment:
    name: staging
    url: https://holi0317.gitlab.io/bridge-calc
  only:
   - staging
{'fraction_non_alphanumeric': 0.09234550561797752, 'fraction_numerical': 0.009480337078651686, 'mean_word_length': 2.58816120906801, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': 0}}
{'dir': 'git-commits-cleaned', 'id': '2678317', 'n_tokens_mistral': 991, 'n_tokens_neox': 955, 'n_words': 283}