diff --git a/.gitlab/.gitlab-ci.yml b/.gitlab/.gitlab-ci.yml index 39f12afcb..f12c60249 100644 --- a/.gitlab/.gitlab-ci.yml +++ b/.gitlab/.gitlab-ci.yml @@ -4,140 +4,140 @@ include: - template: Security/Dependency-Scanning.gitlab-ci.yml stages: - # - test - # - build + - test + - build - integration -# install lattice: -# stage: test -# image: node:14 -# script: -# - echo "Installing lattice dependencies..." -# - cd lattice -# - yarn install +install lattice: + stage: test + image: node:14 + script: + - echo "Installing lattice dependencies..." + - cd lattice + - yarn install -# build lattice: -# stage: test -# image: node:14 -# variables: -# CI: "true" -# script: -# - echo "Building lattice..." -# - cd lattice -# - yarn build -# - tar -czvf lattice.tar.gz lattice/build -# artifacts: -# paths: -# - lattice/lattice.tar.gz -# needs: -# - job: install lattice -# allow_failure: true +build lattice: + stage: test + image: node:14 + variables: + CI: "true" + script: + - echo "Building lattice..." + - cd lattice + - yarn build + - tar -czvf lattice.tar.gz lattice/build + artifacts: + paths: + - lattice/lattice.tar.gz + needs: + - job: install lattice + allow_failure: true -# run jest tests: -# stage: test -# image: node:14 -# variables: -# CI: "true" -# script: -# - echo "Testing lattice..." -# - cd lattice -# - npm install --force -# - npm test -- --coverage --testResultsProcessor=jest-sonar-reporter -# artifacts: -# paths: -# - lattice/coverage/lcov.info +run jest tests: + stage: test + image: node:14 + variables: + CI: "true" + script: + - echo "Testing lattice..." + - cd lattice + - npm install --force + - npm test -- --coverage --testResultsProcessor=jest-sonar-reporter + artifacts: + paths: + - lattice/coverage/lcov.info -# run go tests: -# stage: test -# image: golang:1.16.9 -# script: -# - echo "Running featurebase unit tests..." -# - go test -covermode=atomic -coverprofile=coverage.out -# artifacts: -# paths: -# - coverage.out +run go tests: + stage: test + image: golang:1.16.9 + script: + - echo "Running featurebase unit tests..." + - go test -covermode=atomic -coverprofile=coverage.out + artifacts: + paths: + - coverage.out -# run go tests with output: -# stage: test -# image: golang:1.16.9 -# script: -# - echo "Running featurebase unit tests to capture JSON output..." -# - go test -json > test-report.out -# artifacts: -# paths: -# - test-report.out +run go tests with output: + stage: test + image: golang:1.16.9 + script: + - echo "Running featurebase unit tests to capture JSON output..." + - go test -json > test-report.out + artifacts: + paths: + - test-report.out -# generate coverage html: -# stage: test -# image: golang:1.16.9 -# script: -# - echo "Generating coverage HTML.." -# - go tool cover -html coverage.out -o coverage.html -# artifacts: -# paths: -# - coverage.html -# needs: -# - job: run go tests +generate coverage html: + stage: test + image: golang:1.16.9 + script: + - echo "Generating coverage HTML.." + - go tool cover -html coverage.out -o coverage.html + artifacts: + paths: + - coverage.html + needs: + - job: run go tests -# upload to sonarcloud: -# stage: test -# image: sonarsource/sonar-scanner-cli:4.6 -# variables: -# SONAR_TOKEN: $SONAR_TOKEN -# script: -# - sonar-scanner -Dsonar.projectKey=molecula_featurebase -Dsonar.organization=molecula -Dsonar.sources=. -Dsonar.host.url=https://sonarcloud.io -Dsonar.go.coverage.reportPaths=coverage.out -Dsonar.go.tests.reportPaths=test-report.out -Dsonar.javascript.lcov.reportPaths=lattice/coverage/lcov.info -# needs: -# - job: run go tests -# - job: run go tests with output -# - job: run jest tests +upload to sonarcloud: + stage: test + image: sonarsource/sonar-scanner-cli:4.6 + variables: + SONAR_TOKEN: $SONAR_TOKEN + script: + - sonar-scanner -Dsonar.projectKey=molecula_featurebase -Dsonar.organization=molecula -Dsonar.sources=. -Dsonar.host.url=https://sonarcloud.io -Dsonar.go.coverage.reportPaths=coverage.out -Dsonar.go.tests.reportPaths=test-report.out -Dsonar.javascript.lcov.reportPaths=lattice/coverage/lcov.info + needs: + - job: run go tests + - job: run go tests with output + - job: run jest tests -# build for linux amd64: -# stage: build -# image: registry.gitlab.com/molecula/featurebase/builder:0.0.3 -# variables: -# GOOS: "linux" -# GOARCH: "amd64" -# script: -# - go build -o featurebase_linux_amd64 ./cmd/featurebase -# artifacts: -# paths: -# - featurebase_linux_amd64 +build for linux amd64: + stage: build + image: registry.gitlab.com/molecula/featurebase/builder:0.0.3 + variables: + GOOS: "linux" + GOARCH: "amd64" + script: + - go build -o featurebase_linux_amd64 ./cmd/featurebase + artifacts: + paths: + - featurebase_linux_amd64 -# build for linux arm64: -# stage: build -# image: registry.gitlab.com/molecula/featurebase/builder:0.0.3 -# variables: -# GOOS: "linux" -# GOARCH: "arm64" -# script: -# - go build -o featurebase_linux_arm64 ./cmd/featurebase -# artifacts: -# paths: -# - featurebase_linux_arm64 +build for linux arm64: + stage: build + image: registry.gitlab.com/molecula/featurebase/builder:0.0.3 + variables: + GOOS: "linux" + GOARCH: "arm64" + script: + - go build -o featurebase_linux_arm64 ./cmd/featurebase + artifacts: + paths: + - featurebase_linux_arm64 -# build for darwin amd64: -# stage: build -# image: registry.gitlab.com/molecula/featurebase/builder:0.0.3 -# variables: -# GOOS: "darwin" -# GOARCH: "amd64" -# script: -# - go build -o featurebase_darwin_amd64 ./cmd/featurebase -# artifacts: -# paths: -# - featurebase_darwin_amd64 +build for darwin amd64: + stage: build + image: registry.gitlab.com/molecula/featurebase/builder:0.0.3 + variables: + GOOS: "darwin" + GOARCH: "amd64" + script: + - go build -o featurebase_darwin_amd64 ./cmd/featurebase + artifacts: + paths: + - featurebase_darwin_amd64 -# build for darwin arm64: -# stage: build -# image: registry.gitlab.com/molecula/featurebase/builder:0.0.3 -# variables: -# GOOS: "darwin" -# GOARCH: "arm64" -# script: -# - go build -o featurebase_darwin_arm64 ./cmd/featurebase -# artifacts: -# paths: -# - featurebase_darwin_arm64 +build for darwin arm64: + stage: build + image: registry.gitlab.com/molecula/featurebase/builder:0.0.3 + variables: + GOOS: "darwin" + GOARCH: "arm64" + script: + - go build -o featurebase_darwin_arm64 ./cmd/featurebase + artifacts: + paths: + - featurebase_darwin_arm64 deploy ec2 instance: stage: integration