.gitlab-ci.yml 1.92 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
Éloïs's avatar
Éloïs committed
5

Éloïs's avatar
Éloïs committed
6
7
8
9
10
push_to_github:
    stage: github-sync
    variables:
        GIT_STRATEGY: none
    tags:
11
        - redshift
Éloïs's avatar
Éloïs committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
    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 $?"

enforce_readme:
    stage: github-sync
    variables:
        GIT_STRATEGY: none
    tags:
29
        - redshift
Éloïs's avatar
Éloïs committed
30
31
32
33
34
35
36
37
38
39
40
41
42
    script:
      - rm -rf ./*
      - rm -rf .git
      - git clone $GITHUB_URL_AND_KEY .
      - git config --global user.email "contact@duniter.org"
      - git config --global user.name "Duniter"
      - git checkout master
      - cat .github/github_disclaimer.md > README.md.new
      - cat README.md >> README.md.new
      - mv README.md.new README.md
      - git commit -am "Enforce github readme"
      - git push origin master

Stéphane Veyret's avatar
Stéphane Veyret committed
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
build_linux:test:
  stage: build
  image: duniter/release-builder:v1.0.0
  tags:
    - nodejs
    - nwjs
  script:
    - bash "release/arch/linux/build-lin.sh" "$(date +%Y%m%d).$(date +%H%M).$(date +%S)"
  artifacts:
    paths:
      - work/bin/
    expire_in: 8h
  except:
    - tags

build_linux:deploy:
  stage: build
  image: duniter/release-builder:v1.0.0
  tags:
    - nodejs
    - nwjs
  script:
    - bash "release/arch/linux/build-lin.sh" "${CI_COMMIT_TAG#v}"
  artifacts:
    paths:
      - work/bin/
  only:
    - tags

72
test:
Cédric Moreau's avatar
Cédric Moreau committed
73
74
  stage: test
  tags:
Cédric Moreau's avatar
Cédric Moreau committed
75
    - redshift
Stéphane Veyret's avatar
Stéphane Veyret committed
76
77
78
  before_script:
    - export NVM_DIR="$HOME/.nvm"
    - . "$NVM_DIR/nvm.sh"
Cédric Moreau's avatar
Cédric Moreau committed
79
  script:
Cédric Moreau's avatar
Cédric Moreau committed
80
    - yarn
Cédric Moreau's avatar
Cédric Moreau committed
81
    - yarn test