.gitlab-ci.yml 2.55 KB
Newer Older
Éloïs's avatar
Éloïs committed
1
stages:
Stéphane Veyret's avatar
Stéphane Veyret committed
2
  - github-sync
releaser-duniter's avatar
releaser-duniter committed
3
  - build
Cédric Moreau's avatar
Cédric Moreau committed
4
  - pages
Éloïs's avatar
Éloïs committed
5
  - test
Stéphane Veyret's avatar
Stéphane Veyret committed
6
7
8
  - package
  - prerelease
  - release
9

Éloïs's avatar
Éloïs committed
10
push_to_github:
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  stage: github-sync
  variables:
    GIT_STRATEGY: none
  tags:
    - redshift
  script:
    - rm -rf ./*
    - rm -rf .git
    - git clone --mirror $CI_REPOSITORY_URL .
    - git remote add github $GITHUB_URL_AND_KEY
    - git config --global user.email "contact@duniter.org"
    - git config --global user.name "Duniter"
    # Job would fail if we don't remove refs about pull requests
    - bash -c "cat packed-refs | grep -v 'refs/pull' > packed-refs-new; echo 'Removed pull refs.'"
    - mv packed-refs-new packed-refs
    - bash -c "git push --force --mirror github 2>&1 | grep -v duniter-gitlab; echo $?"
  only:
    - nodes/typescript/duniter
Stéphane Veyret's avatar
Stéphane Veyret committed
29
30

.nvm_env: &nvm_env
releaser-duniter's avatar
releaser-duniter committed
31
32
33
34
35
  tags:
    - redshift
  before_script:
    - export NVM_DIR="$HOME/.nvm"
    - . "$NVM_DIR/nvm.sh"
Stéphane Veyret's avatar
Stéphane Veyret committed
36
37
38
39
  
build:
  <<: *nvm_env
  stage: build
releaser-duniter's avatar
releaser-duniter committed
40
41
42
  script:
    - yarn

Cédric Moreau's avatar
Cédric Moreau committed
43
44
45
46
pages:
  <<: *nvm_env
  stage: pages
  script:
47
    - yarn
48
    - yarn doc
49
50
    - mkdir -p public
    - mv typedoc public/
51
    - mv /tmp/coverage public/
Cédric Moreau's avatar
Cédric Moreau committed
52
53
54
55
    - ls public
  artifacts:
    untracked: true
    paths:
56
      - public
57
58
  only:
    - loki
Cédric Moreau's avatar
Cédric Moreau committed
59
60


Éloïs's avatar
Éloïs committed
61
62
63
64
65
66
test:
  <<: *nvm_env
  stage: test
  script:
    - yarn
    - yarn test
67
68
69
70
    # Clean the dump directory before testing
    - rm -rf /tmp/duniter_ci_dump/
    - bash .gitlab/test/check_indexes.sh /tmp/duniter_ci_dump/
    # Code coverage
71
    - cp -R coverage /tmp/coverage
Éloïs's avatar
Éloïs committed
72
    - sed -n 23p coverage/index.html
Éloïs's avatar
Éloïs committed
73

Stéphane Veyret's avatar
Stéphane Veyret committed
74
.build_releases: &build_releases
Stéphane Veyret's avatar
Stéphane Veyret committed
75
  stage: package
Stéphane Veyret's avatar
Stéphane Veyret committed
76
  allow_failure: false
77
  image: duniter/release-builder:v1.0.1
Stéphane Veyret's avatar
Stéphane Veyret committed
78
  tags:
Éloïs's avatar
Éloïs committed
79
    - redshift-duniter-builder
Stéphane Veyret's avatar
Stéphane Veyret committed
80
81
82
83
84
85
86
  when: manual
  artifacts:
    paths: &releases_artifacts
      - work/bin/

releases:test:
  <<: *build_releases
Stéphane Veyret's avatar
Stéphane Veyret committed
87
  script:
releaser-duniter's avatar
releaser-duniter committed
88
    - bash "release/arch/linux/build-lin.sh" "$(date +%Y%m%d).$(date +%H%M).$(date +%S)"
Stéphane Veyret's avatar
Stéphane Veyret committed
89
  artifacts:
Stéphane Veyret's avatar
Stéphane Veyret committed
90
91
    paths: *releases_artifacts
    expire_in: 4h
92
93
  except:
    - tags
Stéphane Veyret's avatar
Stéphane Veyret committed
94

Stéphane Veyret's avatar
Stéphane Veyret committed
95
releases:x64:
Stéphane Veyret's avatar
Stéphane Veyret committed
96
  <<: *build_releases
Stéphane Veyret's avatar
Stéphane Veyret committed
97
98
99
  script:
    - bash "release/arch/linux/build-lin.sh" "${CI_COMMIT_TAG#v}"
  artifacts:
Stéphane Veyret's avatar
Stéphane Veyret committed
100
101
    paths: *releases_artifacts
    expire_in: 2 weeks
Stéphane Veyret's avatar
Stéphane Veyret committed
102
  only:
Stéphane Veyret's avatar
Stéphane Veyret committed
103
104
    - tags

Stéphane Veyret's avatar
Stéphane Veyret committed
105
.release_jobs: &release_jobs
Éloïs's avatar
Éloïs committed
106
  image: tensorflow/tensorflow:latest-py3
Éloïs's avatar
Éloïs committed
107
108
  tags:
    - redshift-duniter-builder
Cédric Moreau's avatar
Cédric Moreau committed
109
  script:
110
    - python3 .gitlab/releaser
111
  only:
Stéphane Veyret's avatar
Stéphane Veyret committed
112
    - tags
Stéphane Veyret's avatar
Stéphane Veyret committed
113
114
115
116
117
118
119
120
121
122
123
124

prerelease:
  <<: *release_jobs
  stage: prerelease
  variables:
    RELEASE_BIN_DIR: work/bin/
    SOURCE_EXT: '["tar.gz", "zip"]'

publish:
  <<: *release_jobs
  stage: release
  variables:
125
    RELEASE_BIN_DIR: work/bin/
Stéphane Veyret's avatar
Stéphane Veyret committed
126
127
128
    WIKI_RELEASE: Releases
  allow_failure: false
  when: manual