.gitlab-ci.yml 1.95 KB
Newer Older
Éloïs's avatar
Éloïs committed
1
stages:
Stéphane Veyret's avatar
Stéphane Veyret committed
2
3
4
  - github-sync
  - build
  - test
5
6
  - release
  - release-message
Éloïs's avatar
Éloïs committed
7

Éloïs's avatar
Éloïs committed
8
9
10
11
12
push_to_github:
    stage: github-sync
    variables:
        GIT_STRATEGY: none
    tags:
13
        - redshift
Éloïs's avatar
Éloïs committed
14
15
16
17
18
19
20
21
22
23
24
    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 $?"
25
26
        
build:
Stéphane Veyret's avatar
Stéphane Veyret committed
27
  stage: build
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
  tags:
    - redshift
  before_script:
    - export NVM_DIR="$HOME/.nvm"
    - . "$NVM_DIR/nvm.sh"
  script:
    - yarn

test:
  stage: test
  tags:
    - redshift
  before_script:
    - export NVM_DIR="$HOME/.nvm"
    - . "$NVM_DIR/nvm.sh"
  script:
    - yarn
    - yarn test

release_linux:test:
  stage: release
Éloïs's avatar
Éloïs committed
49
  image: duniter/release-builder:v1.0.1
Stéphane Veyret's avatar
Stéphane Veyret committed
50
  tags:
Éloïs's avatar
Éloïs committed
51
    - redshift-duniter-builder
Stéphane Veyret's avatar
Stéphane Veyret committed
52
53
54
55
56
57
  script:
    - bash "release/arch/linux/build-lin.sh" "$(date +%Y%m%d).$(date +%H%M).$(date +%S)"
  artifacts:
    paths:
      - work/bin/
    expire_in: 8h
Éloïs's avatar
Éloïs committed
58
  when: manual
Stéphane Veyret's avatar
Stéphane Veyret committed
59

60
61
release_linux:deploy:
  stage: release
Éloïs's avatar
Éloïs committed
62
  image: duniter/release-builder:v1.0.1
Stéphane Veyret's avatar
Stéphane Veyret committed
63
  tags:
Éloïs's avatar
Éloïs committed
64
    - redshift-duniter-builder
Stéphane Veyret's avatar
Stéphane Veyret committed
65
66
67
68
69
  script:
    - bash "release/arch/linux/build-lin.sh" "${CI_COMMIT_TAG#v}"
  artifacts:
    paths:
      - work/bin/
Éloïs's avatar
Éloïs committed
70
  when: manual
Stéphane Veyret's avatar
Stéphane Veyret committed
71
  only:
Éloïs's avatar
Éloïs committed
72
  - master
73
74
75
    
enforce-message:
  stage: release-message
Cédric Moreau's avatar
Cédric Moreau committed
76
  tags:
Cédric Moreau's avatar
Cédric Moreau committed
77
    - redshift
78
79
80
  variables:
    JOB_ARTIFACTS: 'build'
    EXPECTED_ARTIFACTS: '["duniter-desktop-${CI_COMMIT_TAG}-linux-x64.deb","duniter-desktop-${CI_COMMIT_TAG}-linux-x64.tar.gz","duniter-server-${CI_COMMIT_TAG}-linux-x64.deb"]'
Cédric Moreau's avatar
Cédric Moreau committed
81
  script:
82
    - python3 .gitlab/releaser.py
Éloïs's avatar
Éloïs committed
83
  when: manual
84
  only:
Éloïs's avatar
Éloïs committed
85
  - master