stages: - coverage - builddocs - deploy - publish workflow: rules: - if: $CI_MERGE_REQUEST_IID - if: $CI_COMMIT_TAG - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH 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/#\([^ ]\)/\1/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 ./scripts/prepare.sh - chmod +x ./scripts/test.sh - rm -r example - ./scripts/prepare.sh test - ./scripts/test.sh test artifacts: paths: - coverage/ coverage_without_olm: tags: - linux stage: coverage image: google/dart dependencies: [] script: - dart pub get - dart 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 ./scripts/prepare.sh - chmod +x ./scripts/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 ./scripts/prepare.sh test - su -c ./scripts/test_driver.sh test timeout: 16m resource_group: e2ee_test code_analyze: tags: - docker stage: coverage image: google/dart dependencies: [] script: - dart pub get - dart format lib/ test/ test_driver/ --set-exit-if-changed - dart analyze code_quality: tags: - docker stage: coverage image: google/dart before_script: - dart pub global activate dart_code_metrics script: - dart pub global run dart_code_metrics:metrics lib -r gitlab > code-quality-report.json artifacts: reports: codequality: code-quality-report.json # also create an actual artifact for inspection purposes paths: - code-quality-report.json dry-run: stage: publish image: google/dart allow_failure: true script: - rm -rf ./docs - dart pub get - dart pub publish --dry-run pub-dev: stage: publish image: google/dart script: - rm -rf ./docs - | if [ -z "${PUB_DEV_PUBLISH_ACCESS_TOKEN}" ]; then echo "Missing PUB_DEV_PUBLISH_ACCESS_TOKEN environment variable" exit 1 fi if [ -z "${PUB_DEV_PUBLISH_REFRESH_TOKEN}" ]; then echo "Missing PUB_DEV_PUBLISH_REFRESH_TOKEN environment variable" exit 1 fi if [ -z "${PUB_DEV_PUBLISH_TOKEN_ENDPOINT}" ]; then echo "Missing PUB_DEV_PUBLISH_TOKEN_ENDPOINT environment variable" exit 1 fi if [ -z "${PUB_DEV_PUBLISH_EXPIRATION}" ]; then echo "Missing PUB_DEV_PUBLISH_EXPIRATION environment variable" exit 1 fi cat < ~/.pub-cache/credentials.json { "accessToken":"$(echo "${PUB_DEV_PUBLISH_ACCESS_TOKEN}" | base64 -d)", "refreshToken":"$(echo "${PUB_DEV_PUBLISH_REFRESH_TOKEN}" | base64 -d)", "tokenEndpoint":"${PUB_DEV_PUBLISH_TOKEN_ENDPOINT}", "scopes":["https://www.googleapis.com/auth/userinfo.email","openid"], "expiration":${PUB_DEV_PUBLISH_EXPIRATION} } EOF - dart pub get - dart pub publish --force rules: - if: $CI_COMMIT_TAG