185 lines
		
	
	
		
			5.2 KiB
		
	
	
	
		
			YAML
		
	
	
	
			
		
		
	
	
			185 lines
		
	
	
		
			5.2 KiB
		
	
	
	
		
			YAML
		
	
	
	
| stages:
 | |
|   - coverage
 | |
|   - builddocs
 | |
|   - deploy
 | |
|   
 | |
| coverage:
 | |
|   tags:
 | |
|     - linux
 | |
|   stage: coverage
 | |
|   image: debian:testing
 | |
|   dependencies: []
 | |
|   script:
 | |
|     - apt update
 | |
|     - apt install -y curl gnupg2 git unzip
 | |
|     - git clone https://github.com/flutter/flutter.git -b stable
 | |
|     - export PATH="$PATH:`pwd`/flutter/bin"
 | |
|     - sed -i s/#//g pubspec.yaml
 | |
|     - flutter doctor
 | |
|     - apt update
 | |
|     - apt install -y lcov libolm3 sqlite3 libsqlite3-dev
 | |
|     - ln -s /usr/lib/dart/bin/pub /usr/bin/
 | |
|     - useradd -m test
 | |
|     - chown -R 'test:' '.'
 | |
|     - chmod +x ./prepare.sh
 | |
|     - chmod +x ./test.sh
 | |
|     - rm -r example
 | |
|     - su -c ./prepare.sh test
 | |
|     - su -c ./test.sh test
 | |
|   artifacts:
 | |
|     paths:
 | |
|       - coverage/
 | |
| 
 | |
| coverage_without_olm:
 | |
|   tags:
 | |
|     - linux
 | |
|   stage: coverage
 | |
|   image: debian:testing
 | |
|   dependencies: []
 | |
|   script:    
 | |
|     - apt update
 | |
|     - apt install -y curl gnupg2 git sqlite3 libsqlite3-dev
 | |
|     - curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
 | |
|     - curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list
 | |
|     - apt update
 | |
|     - apt install -y dart
 | |
|     - ln -s /usr/lib/dart/bin/pub /usr/bin/
 | |
|     - useradd -m test
 | |
|     - chown -R 'test:' '.'
 | |
|     - chmod +x ./test.sh
 | |
|     - pub get
 | |
|     - pub run test
 | |
|   
 | |
| e2ee_test:
 | |
|   tags:
 | |
|     - linux
 | |
|   stage: coverage
 | |
|   image: debian:testing
 | |
|   dependencies: []
 | |
|   script:
 | |
|     - apt update
 | |
|     - apt install -y curl gnupg2 git
 | |
|     - curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
 | |
|     - curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list
 | |
|     - apt update
 | |
|     - apt install -y dart lcov libolm3 sqlite3 libsqlite3-dev
 | |
|     - ln -s /usr/lib/dart/bin/pub /usr/bin/
 | |
|     - useradd -m test
 | |
|     - chown -R 'test:' '.'
 | |
|     - chmod +x ./prepare.sh
 | |
|     - chmod +x ./test_driver.sh
 | |
|     - printf "abstract class TestUser {\n  static const String homeserver = '$TEST_HOMESERVER';\n  static const String username = '$TEST_USER1';\n  static const String username2 = '$TEST_USER2';\n  static const String password = '$TEST_USER_PASSWORD';\n}" > ./test_driver/test_config.dart
 | |
|     - su -c ./prepare.sh test
 | |
|     - su -c ./test_driver.sh test
 | |
|   timeout: 16m
 | |
|   resource_group: e2ee_test
 | |
| 
 | |
| code_analyze:
 | |
|   tags:
 | |
|     - docker
 | |
|   stage: coverage
 | |
|   image: cirrusci/flutter
 | |
|   dependencies: []
 | |
|   script:
 | |
|     - flutter format lib/ test/ test_driver/ --set-exit-if-changed
 | |
|     - flutter analyze
 | |
| 
 | |
| build_api_doc:
 | |
|   tags:
 | |
|     - docker
 | |
|   stage: builddocs
 | |
|   image: cirrusci/flutter
 | |
|   script:
 | |
|     - dartdoc --exclude "dart:async,dart:collection,dart:convert,dart:core,dart:developer,dart:io,dart:isolate,dart:math,dart:typed_data,dart:ui"
 | |
|   artifacts:
 | |
|     paths:
 | |
|       - doc/api/
 | |
|   only:
 | |
|     - main
 | |
| 
 | |
| build_doc:
 | |
|   tags:
 | |
|     - docker
 | |
|   stage: builddocs
 | |
|   image: registry.gitlab.com/larodar/mdbook-dtmo:latest
 | |
|   script:
 | |
|     - cd doc
 | |
|     - mdbook-dtmo build -d public
 | |
|     - mv public ../doc-public
 | |
|   artifacts:
 | |
|     paths:
 | |
|       - doc-public
 | |
|   only:
 | |
|     - main
 | |
| 
 | |
| pages:
 | |
|   tags:
 | |
|     - linux
 | |
|   stage: deploy
 | |
|   image: alpine:latest
 | |
|   script:
 | |
|     - mv doc/api/ ./home/api
 | |
|     - mv doc-public ./home/doc
 | |
|     - mv home public
 | |
|   dependencies:
 | |
|     - build_api_doc
 | |
|     - build_doc
 | |
|   artifacts:
 | |
|     paths:
 | |
|       - public
 | |
|   only:
 | |
|     - main
 | |
| 
 | |
| # Adds license-scanning job. Because Gitlab does not support pub.dev
 | |
| # we added https://github.com/oss-review-toolkit/ort
 | |
| 
 | |
| #include:
 | |
| #  - template: Security/License-Scanning.gitlab-ci.yml
 | |
| 
 | |
| #license_scanning:
 | |
| #  stage: coverage
 | |
| #  image:
 | |
| #    name: "registry.gitlab.com/gitlab-org/security-products/analyzers/ort/ort:latest"
 | |
| #  script:
 | |
| #    - /opt/ort/bin/ort analyze -i $CI_PROJECT_DIR -o $CI_PROJECT_DIR/ --allow-dynamic-versions
 | |
| #    - /opt/ort/bin/ort scan -i $CI_PROJECT_DIR/analyzer-result.yml -o $CI_PROJECT_DIR/ || true
 | |
| #    - /opt/ort/bin/ort report -f GitLabLicenseModel -i $CI_PROJECT_DIR/scan-result.yml -o $CI_PROJECT_DIR/
 | |
| 
 | |
| update-dependencies:
 | |
|   stage: coverage
 | |
|   image: debian:testing
 | |
|   needs: []
 | |
|   tags:
 | |
|     - docker
 | |
|   only:
 | |
|     - schedules
 | |
|   variables:
 | |
|     HOST: ${CI_PROJECT_URL}
 | |
|     UPDATE_BRANCH: ci-bot/dependency-updates
 | |
|     PRIVATE_TOKEN: ${GITLAB_API_TOKEN}
 | |
|   before_script:
 | |
|     - apt-get update && apt-get install -y curl git gnupg2 openssh-client python3
 | |
|     - curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
 | |
|     - curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list
 | |
|     - apt-get update && apt-get install -y dart
 | |
|     - ln -s /usr/lib/dart/bin/pub /usr/bin/
 | |
| 
 | |
|     - eval $(ssh-agent -s)
 | |
|     - echo "$SSH_PRIVATE_BOT_KEY" | tr -d '\r' | ssh-add - > /dev/null
 | |
| 
 | |
|     - mkdir -p ~/.ssh
 | |
|     - chmod 700 ~/.ssh
 | |
| 
 | |
|     - ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
 | |
|     - chmod 644 ~/.ssh/known_hosts
 | |
| 
 | |
|     - git config --global user.email "info@famedly.com"
 | |
|     - git config --global user.name "Famedly Bot"
 | |
|   script:
 | |
|     - pub get
 | |
|     - pub run dapackages:dapackages.dart ./pubspec.yaml
 | |
|     - pub get
 | |
|     - git remote set-url --push origin git@gitlab.com:$CI_PROJECT_PATH
 | |
|     - 'git diff --exit-code || (git checkout -B ${UPDATE_BRANCH} && git add . && git commit -m "chore: Update dependencies" && git push -f origin ${UPDATE_BRANCH} && ./scripts/open-mr.sh)'
 | |
| 
 |