-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
77 lines (68 loc) · 2.43 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
variables:
LC_ALL: C.UTF-8
DEBIAN_FRONTEND: noninteractive
# this job aims to setup a common Ruby dev environment
ruby_latest:
image: ruby
script:
- ruby -v
- for f in `find * -name \*.rb`; do printf "$f\t"; ruby -c $f; done
- apt-get update
- apt-get install -y bundler
- bundle config set path 'vendor'
- bundle install
- bundle exec rubocop lib spec
- bundle exec rspec
# this job aims to reproduce the production setup
fdroid-website:
image: debian:buster
variables:
DEBIAN_FRONTEND: noninteractive
LANG: C.UTF-8
artifacts:
paths:
- public
script:
- apt-get -q update
- apt-get -qy install bundler git ruby --no-install-recommends
- git -C .. clone --depth=1 https://gitlab.com/fdroid/fdroid-website.git
- cd ../fdroid-website
# use the 'gitlab ci' subset of languages
- sed -i
-e 's,^languages:,ignored_languages:,'
-e 's,^gitlab_ci_languages:,languages:,'
_config.yml
# force the use of the local jekyll-fdroid
- perl -i -pe "BEGIN{undef $/;} s@\n *gem 'jekyll-fdroid'.*?\n\s*:ref *=> *'[^']+'\n@\n@smg" Gemfile
- sed -i "s@^end@ gem 'jekyll-fdroid', path\x3a '$CI_PROJECT_DIR'\nend@" Gemfile
# run fdroid-website setup
- ruby -e "require 'yaml'; d=YAML.load_file('.gitlab-ci.yml');
puts d['.apt-template'].gsub(/\\\\\\n/, ' ');
puts d['.setup_for_jekyll'].gsub(/\\\\\\n/, ' ')"
| bash -e
- cd $CI_PROJECT_DIR
- rubocop lib spec
- rspec
- cd ../fdroid-website
# This is where GitLab pages will deploy to by default (e.g. "https://fdroid.gitlab.io/jekyll-fdroid")
# so we need to make sure that the Jekyll configuration understands this.
- sed -Ei
-e "s,^(url\x3a).*,\1 'https://$CI_PROJECT_NAMESPACE.gitlab.io',"
-e "s,^(baseurl\x3a).*,\1 '/$CI_PROJECT_NAME',"
_config.yml
- echo "Jekyll config used for CI:" && cat _config.yml
- jekyll build -d $CI_PROJECT_DIR/public --trace
- ./tools/prepare-multi-lang.sh $CI_PROJECT_DIR/public --no-type-maps
# TODO kludge to get css until someone figures out why sass is not compiling the css
- apt-get install curl
- mkdir -p $CI_PROJECT_DIR/public/css
- curl https://fdroid.gitlab.io/fdroid-website/css/main.css > $CI_PROJECT_DIR/public/css/main.css
pages:
stage: deploy
artifacts:
paths:
- public
expire_in: 1w
when: always
script:
- ls -lR public