image: node:12.16.3-buster-slim stages: - lint - test - sonar_scanner_test - deploy lint: stage: lint script: - npm install - npm run lint test: stage: test artifacts: expire_in: 1 hour paths: - coverage/lcov.info - test-report.xml script: - npm install - npm run test:coverage sonar_scanner_test: image: name: sonarsource/sonar-scanner-cli:latest entrypoint: [""] stage: sonar_scanner_test dependencies: - test script: - sonar-scanner -Dsonar.projectKey=$SONARQUBE_PROJECT_KEY -Dsonar.host.url=$SONARQUBE_HOST_URL -Dsonar.login=$SONARQUBE_TOKEN -Dsonar.branch.name=$CI_COMMIT_REF_NAME staging: stage: deploy variables: NETLIFY_AUTH_TOKEN: $STAGING_NETLIFY_AUTH_TOKEN NETLIFY_SITE_ID: $STAGING_NETLIFY_SITE_ID REACT_APP_BASE_URL: $STAGING_REACT_APP_BASE_URL script: - npm install - CI=false npm run build - npm install netlify-cli -g --unsafe-perm - netlify deploy --dir dist --prod only: - staging production: stage: deploy variables: AWS_ACCESS_KEY_ID: $PRODUCTION_AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY: $PRODUCTION_AWS_SECRET_ACCESS_KEY AWS_STORAGE_BUCKET_NAME: $PRODUCTION_AWS_STORAGE_BUCKET_NAME REACT_APP_BASE_URL: $PRODUCTION_REACT_APP_BASE_URL script: - npm install - CI=false npm run build - apt update -y && apt install python3-dev python3-pip zip -y - pip3 install awscli - cd dist - zip -r home-industry.zip * - aws s3 cp home-industry.zip s3://$AWS_STORAGE_BUCKET_NAME only: - master