-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
194 lines (183 loc) · 5.94 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
stages:
- test
- build
- deploy
test:
stage: test
image: rust:latest
before_script:
- apt update
- apt install cmake -y
script:
- RUST_BACKTRACE=1 cargo test -p squiid -p squiid-engine -p squiid-parser --verbose
rules:
- if: '$CI_PIPELINE_SOURCE == "web" || $CI_PIPELINE_SOURCE == "merge_request_event"'
when: always
- if: '$CI_PIPELINE_SOURCE == "schedule"'
changes:
- '*'
# deploy-snap:
# stage: deploy
# image: ubuntudesktop/gnome-3-38-2004
# before_script:
# - apt update
# - apt install cargo gettext-base cmake -y
# script:
# - echo "$SNAPCRAFT_STORE_CREDENTIALS" > login.priv
# - snapcraft login --with login.priv
# - make snap
# - case "$CI_COMMIT_BRANCH" in
# "trunk") snapcraft upload --release=stable squiid*.snap; ;;
# *) snapcraft upload --release=edge squiid*.snap; ;;
# esac
# rules:
# - if: '$CI_PIPELINE_SOURCE == "web"'
# when: always
# - if: '$CI_PIPELINE_SOURCE == "schedule"'
# changes:
# - '*'
deploy-aur:
stage: deploy
image: archlinux:latest
before_script:
- pacman -Syu openssh base-devel git --noconfirm --needed
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- ssh-keyscan -v -t rsa,ecdsa,ed25519 aur.archlinux.org >> ~/.ssh/known_hosts
- chmod 700 ~/.ssh
- git config --global --add safe.directory '*'
- git config --global --add safe.directory '/builds/ImaginaryInfinity/squiid-calculator/squiid'
- git config --global user.name "Squiid Build CI"
- git config --global user.email "[email protected]"
script:
- make clean
- sudo -u nobody make aur-metadata
- git clone ssh://[email protected]/squiid.git squiid-aur
- cp -v package-build/PKGBUILD package-build/.SRCINFO squiid-aur/
- cd squiid-aur
- git add .
- git commit -m "$CI_COMMIT_MESSAGE"
- git push
rules:
- if: '$CI_PIPELINE_SOURCE == "web"'
build-appimage:
stage: build
image: archlinux:latest
before_script:
- pacman --noconfirm -Syu curl make cmake musl rustup gcc
- curl -L https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -o /usr/local/bin/appimagetool
- chmod a+rx /usr/local/bin/appimagetool
- previous_dir=`pwd`
- cd /opt; appimagetool --appimage-extract
- cd $previous_dir
- mv /opt/squashfs-root /opt/appimagetool.AppDir
- rm /usr/local/bin/appimagetool
- ln -s /opt/appimagetool.AppDir/AppRun /usr/local/bin/appimagetool
- rustup default stable
- rustup target add x86_64-unknown-linux-musl
script:
- make appimage
- mv package-build/Squiid_Calculator.AppImage Squiid_Calculator.AppImage
artifacts:
paths:
- Squiid_Calculator.AppImage
rules:
- if: '$CI_PIPELINE_SOURCE == "web"'
when: always
- if: '$CI_PIPELINE_SOURCE == "schedule"'
changes:
- '*'
build-musl:
stage: build
image: clux/muslrust:stable
script:
- make build
- mv target/x86_64-unknown-linux-musl/release/squiid squiid
artifacts:
paths:
- squiid
rules:
- if: '$CI_PIPELINE_SOURCE == "web"'
when: always
- if: '$CI_PIPELINE_SOURCE == "schedule"'
changes:
- '*'
build-windows:
stage: build
image: alpine:latest
before_script:
- apk update
- apk add curl make cmake gcc mingw-w64-gcc musl-dev gettext
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -t x86_64-pc-windows-gnu -y
script:
- source "$HOME/.cargo/env"
- make windows-build
- cp target/x86_64-pc-windows-gnu/release/squiid.exe squiid.exe
- make windows-installer skip_build=1
artifacts:
paths:
- ./squiid.exe
- package-build/
rules:
- if: '$CI_PIPELINE_SOURCE == "web"'
when: always
- if: '$CI_PIPELINE_SOURCE == "schedule"'
changes:
- '*'
build-windows-installer:
stage: build
needs:
- job: build-windows
artifacts: true
image:
name: amake/innosetup
entrypoint: [""]
script:
- cp -r --no-preserve=mode,ownership package-build/ new-package-build/
- cd new-package-build/
- iscc squiid.iss
- mv Output/squiid-installer.exe ../
- cd ..
artifacts:
paths:
- squiid-installer.exe
rules:
- if: '$CI_PIPELINE_SOURCE == "web"'
when: always
- if: '$CI_PIPELINE_SOURCE == "schedule"'
changes:
- '*'
# deploy-ppa:
# stage: deploy
# image: ubuntu:bionic
# before_script:
# - DEBIAN_FRONTEND=noninteractive apt update
# - DEBIAN_FRONTEND=noninteractive apt install -y build-essential binutils lintian debhelper dh-make devscripts fakeroot git gnupg python3-pip curl
# - echo "$GPG_PRIVATE_KEY_B64" | base64 --decode | gpg --batch --import
# - gpg --list-keys --fingerprint --with-colons | sed -E -n -e 's/^fpr:::::::::([0-9A-F]+):$/\1:6:/p' | gpg --import-ownertrust
# - echo -ne "[squiid]\nfqdn = ppa.launchpad.net\nmethod = ftp\nincoming = ~imaginaryinfinity/ubuntu/squiid/\nlogin = squiid\nallow_unsigned_uploads = 0" > ~/.dput.cf
# script:
# - make ppa DEBUILD_OPTIONS="-p\"gpg --batch --passphrase $GPG_PASSPHRASE --pinentry-mode loopback\""
# - echo $LAUNCHPAD_PASS | dput squiid squiid*_*_source.changes
# rules:
# - if: '$CI_PIPELINE_SOURCE == "web"'
build-deb:
stage: build
image: ubuntu:bionic
before_script:
- DEBIAN_FRONTEND=noninteractive apt update
- DEBIAN_FRONTEND=noninteractive apt install -y build-essential binutils lintian debhelper dh-make devscripts fakeroot git curl gnupg python3-pip
- echo "$GPG_PRIVATE_KEY_B64" | base64 --decode | gpg --batch --import
- gpg --list-keys --fingerprint --with-colons | sed -E -n -e 's/^fpr:::::::::([0-9A-F]+):$/\1:6:/p' | gpg --import-ownertrust
script:
- make deb
artifacts:
paths:
- squiid_*_amd64.deb
rules:
- if: '$CI_PIPELINE_SOURCE == "web"'
when: always
- if: '$CI_PIPELINE_SOURCE == "schedule"'
changes:
- '*'