Skip to content

Instantly share code, notes, and snippets.

@rust20
Last active May 7, 2021 08:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rust20/7e58f4246a51ef9cb40819bef5ae98c2 to your computer and use it in GitHub Desktop.
Save rust20/7e58f4246a51ef9cb40819bef5ae98c2 to your computer and use it in GitHub Desktop.
gitlab ci test
stages:
- test
- lint
- deploy
backend:test:
image: golang
stage: test
cache:
key: ${CI_COMMIT_REF_SLUG}
script:
# prepare test environment
- export GOWORKDIR=$GOPATH/src/PPLA4
- mkdir -p $GOWORKDIR
- ln -svf $CI_PROJECT_DIR/backend $GOWORKDIR
- cd $GOWORKDIR/backend
- mkdir coverage
# install dependencies
- go get -t ./...
# testing
- go test ./... -coverprofile=coverage/coverage.out
- go tool cover -func=coverage/coverage.out
- go tool cover -html=coverage/coverage.out -o coverage/coverage.html
artifacts:
paths:
- backend/coverage
only:
changes:
- backend/**/*
- .gitlab-ci.yml
.mobile:unit-test: &unit-test-mobile
image: rust20/flutter-build:latest
stage: test
variables:
APP: ""
script:
- cd mobile/$APP
- flutter doctor -v
- flutter test --coverage
- lcov --summary coverage/lcov.info
- genhtml coverage/lcov.info --output=coverage
mitra:unit-test:
<<: *unit-test-mobile
variables:
APP: "mitra_app"
artifacts:
paths:
- mobile/mitra_app/coverage/
only:
changes:
- mobile/mitra_app/**/*
- .gitlab-ci.yml
customer:unit-test:
<<: *unit-test-mobile
variables:
APP: "customer_app"
artifacts:
paths:
- mobile/customer_app/coverage/
only:
changes:
- mobile/customer_app/**/*
- .gitlab-ci.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment