This repository has been archived by the owner on Aug 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 52
/
.gitlab-ci.yml
129 lines (121 loc) · 4.07 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
stages:
- linting
- unit_tests
- mirror
variables:
LC_ALL: "en_US.UTF-8"
LANG: "en_US.UTF-8"
GEM_HOME: "$CI_PROJECT_DIR/gem"
PUBLIC_REPO_URL: [email protected]:ProtonVPN/mac-app.git
.linux-common: &linux-common
image: ubuntu:latest
cache: {}
stage: mirror
before_script:
- apt-get -y update
- apt-get install -y connect-proxy git
- 'which ssh-agent || apt-get -y install openssh-client'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- git config --global user.email $GIT_CI_EMAIL
- git config --global user.name $GIT_CI_USERNAME
- git config --global url."https://".insteadOf git://
- mkdir ~/.ssh 2> /dev/null
- |
cat <<EOF > ~/.ssh/config
Host github.com
Hostname ssh.github.com
User git
Port 443
ProxyCommand connect-proxy -H $http_proxy %h %p
EOF
- ssh-keyscan -t rsa ${CI_SERVER_HOST} > ~/.ssh/known_hosts
## ssh-keyscan doesn't support proxies so we can't fetch the fingerprint online
- |
cat <<EOF >> ~/.ssh/known_hosts
# ssh.github.com:443 SSH-2.0-babeld-2e9d163d
[ssh.github.com]:443 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
EOF
.before_script_mac: &before_script_mac
- rm -fr ../vpncore || true # ignore failure to delete
- git clone -b ${CI_COMMIT_REF_NAME} https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.protontech.ch/apple/vpn/vpncore.git ../vpncore || git clone -b develop https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.protontech.ch/apple/vpn/vpncore.git ../vpncore
- cd ProtonVPNUITests/ && Scripts/prepare_credentials.sh && cd ..
- cd ProtonVPN/ && ../../vpncore/Source/prepare_obfuscated_constants.sh && cd -
lint:
stage: linting
tags:
- macOS
before_script:
- *before_script_mac
script: Pods/SwiftLint/swiftlint --strict --reporter junit > swiftlint.xml
allow_failure: false
artifacts:
name: "mac-lint-$CI_COMMIT_TAG"
paths:
- swiftlint.xml
reports:
junit:
- swiftlint.xml
expire_in: 90 days
unit_tests:
dependencies: []
stage: unit_tests
before_script:
- *before_script_mac
script:
- base64 -D -o Certificates.p12 <<< $DEVELOPER_CERTIFICATE
- mkdir -pv ~/Library/MobileDevice/Provisioning\ Profiles/
- base64 -D -o ~/Library/MobileDevice/Provisioning\ Profiles/ProtonVPN_Mac_Development_PP.provisionprofile <<< $DEVELOPMENT_PROFILE
- pod install
- fastlane ci_test
- fastlane/print-coverage.sh fastlane/test_output/ProtonVPN.xcresult
tags:
- macOS
artifacts:
name: "macos-tests-$CI_COMMIT_TAG"
when: always
paths:
- fastlane/test_output/
expire_in: 3 days
reports:
junit:
- fastlane/test_output/report.junit
sync-app:
extends: .linux-common
<<: *linux-common
only:
refs:
- master
artifacts:
expire_in: 1 day
paths:
- log.txt
script:
- git clone [email protected]:agarroux/publish-github.git
- ./publish-github/sync commit --private-url $CI_REPOSITORY_URL --public-url "$PUBLIC_REPO_URL"
sync-app-2.0:
extends: .linux-common
<<: *linux-common
only:
refs:
- release-candidate-2.0.0
artifacts:
expire_in: 1 day
paths:
- log.txt
script:
- git clone [email protected]:agarroux/publish-github.git
- ./publish-github/sync commit --private-url $CI_REPOSITORY_URL --public-url "$PUBLIC_REPO_URL --branch release-candidate-2.0.0"
publish-github-release:
extends: .linux-common
<<: *linux-common
only:
refs:
- tags
artifacts:
expire_in: 1 day
paths:
- log.txt
script:
- git clone [email protected]:agarroux/publish-github.git
- ./publish-github/sync tag --private-url $CI_REPOSITORY_URL --public-url "$PUBLIC_REPO_URL"