From 5230520f384326046c9e772e895b3cb2615c6939 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89lo=C3=AFs?= <elois@ifee.fr>
Date: Tue, 28 Nov 2017 00:41:50 +0000
Subject: [PATCH] Add new file

---
 .gitlab-ci.yml | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 000000000..1e70f0a8a
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,55 @@
+stages:
+    - github-sync
+    - test
+
+
+push_to_github:
+    stage: github-sync
+    variables:
+        GIT_STRATEGY: none
+    tags:
+        - github
+    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:
+        - github
+    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
+      
+test:
+    stage: test
+    tags:
+      - nodejs
+    image: registry.duniter.org/docker/ubuntu-node:17.10-DUNITER-2
+    script:
+      - bash -c ". ~/.nvm/nvm.sh && npm install -g yarn"
+      - bash -c ". ~/.nvm/nvm.sh && yarn install"
+      - bash -c ". ~/.nvm/nvm.sh && yarn run test-travis"
+    cache:
+      paths:
+        - node_modules/
+
-- 
GitLab