.gitlab-ci.yml 1.46 KB
Newer Older
Éloïs's avatar
Éloïs committed
1
2
3
4
stages:
    - github-sync
    - test

Éloïs's avatar
Éloïs committed
5
6
7
before_script:
    - export NVM_DIR="$HOME/.nvm"
    - . "$NVM_DIR/nvm.sh"
Éloïs's avatar
Éloïs committed
8

Éloïs's avatar
Éloïs committed
9
10
11
12
13
push_to_github:
    stage: github-sync
    variables:
        GIT_STRATEGY: none
    tags:
14
        - redshift
Éloïs's avatar
Éloïs committed
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
    before_script:
        - ''
    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:
34
        - redshift
Éloïs's avatar
Éloïs committed
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
    before_script:
        - ''
    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

50
test:
Cédric Moreau's avatar
Cédric Moreau committed
51
52
  stage: test
  tags:
Cédric Moreau's avatar
Cédric Moreau committed
53
    - redshift
Cédric Moreau's avatar
Cédric Moreau committed
54
  script:
Cédric Moreau's avatar
Cédric Moreau committed
55
    - yarn
Cédric Moreau's avatar
Cédric Moreau committed
56
    - yarn test