Browse Source

CircleCI updates (#10647)

* Update CircleCi for release and test

* Update test storage dir
John Kleinschmidt 7 years ago
parent
commit
d9d557dcc5
3 changed files with 234 additions and 9 deletions
  1. 225 6
      .circleci/config.yml
  2. 1 0
      spec/package.json
  3. 8 3
      spec/static/index.html

+ 225 - 6
.circleci/config.yml

@@ -6,10 +6,58 @@ jobs:
       - image: electronbuilds/electron:0.0.3
         environment:
           TARGET_ARCH: arm
+    resource_class: xlarge
     steps:
       - checkout
-      - run: script/cibuild
-
+      - run:
+          name: Setup for headless testing
+          command: sh -e /etc/init.d/xvfb start
+      - run:
+          name: Check for release
+          command: |
+            MESSAGE="$(git log --format=%B -n 1 HEAD)"
+            case ${MESSAGE} in
+              Bump* ) echo 'export ELECTRON_RELEASE=1' >> $BASH_ENV
+            esac
+      - run:
+         name: Bootstrap
+         command: |
+           if [ "$ELECTRON_RELEASE" == "1" ]; then
+              echo 'Bootstrapping Electron for release build'
+              script/bootstrap.py --target_arch=$TARGET_ARCH
+           else
+              echo 'Bootstrapping Electron for debug build'
+              script/bootstrap.py --target_arch=$TARGET_ARCH --dev
+           fi
+      - run: npm run lint
+      - run:
+         name: Build
+         command: |
+           if [ "$ELECTRON_RELEASE" == "1" ]; then
+              echo 'Building Electron for release'
+              script/build.py -c R
+           else
+              echo 'Building Electron for debug'
+              script/build.py -c D
+           fi
+      - run:
+          name: Create distribution
+          command: |
+             if [ "$ELECTRON_RELEASE" == "1" ]; then
+                echo 'Creating Electron release distribution'
+                script/create-dist.py
+             else
+                echo 'Skipping create distribution because build is not for release'
+             fi
+      - run:
+          name: Upload distribution
+          command: |
+             if [ "$ELECTRON_RELEASE" == "1" ]; then
+                echo 'Uploading Electron release distribution'
+                script/upload.py
+             else
+                echo 'Skipping upload distribution because build is not for release'
+             fi
   electron-linux-arm64:
     docker:
       - image: electronbuilds/electron:0.0.3
@@ -17,25 +65,196 @@ jobs:
           TARGET_ARCH: arm64
     steps:
       - checkout
-      - run: script/cibuild
-
+      - run:
+          name: Setup for headless testing
+          command: sh -e /etc/init.d/xvfb start
+      - run:
+          name: Check for release
+          command: |
+            MESSAGE="$(git log --format=%B -n 1 HEAD)"
+            case ${MESSAGE} in
+              Bump* ) echo 'export ELECTRON_RELEASE=1' >> $BASH_ENV
+            esac
+      - run:
+         name: Bootstrap
+         command: |
+           if [ "$ELECTRON_RELEASE" == "1" ]; then
+              echo 'Bootstrapping Electron for release build'
+              script/bootstrap.py --target_arch=$TARGET_ARCH
+           else
+              echo 'Bootstrapping Electron for debug build'
+              script/bootstrap.py --target_arch=$TARGET_ARCH --dev
+           fi
+      - run: npm run lint
+      - run:
+         name: Build
+         command: |
+           if [ "$ELECTRON_RELEASE" == "1" ]; then
+              echo 'Building Electron for release'
+              script/build.py -c R
+           else
+              echo 'Building Electron for debug'
+              script/build.py -c D
+           fi
+      - run:
+          name: Create distribution
+          command: |
+             if [ "$ELECTRON_RELEASE" == "1" ]; then
+                echo 'Creating Electron release distribution'
+                script/create-dist.py
+             else
+                echo 'Skipping create distribution because build is not for release'
+             fi
+      - run:
+          name: Upload distribution
+          command: |
+             if [ "$ELECTRON_RELEASE" == "1" ]; then
+                echo 'Uploading Electron release distribution'
+                script/upload.py
+             else
+                echo 'Skipping upload distribution because build is not for release'
+             fi
   electron-linux-ia32:
     docker:
       - image: electronbuilds/electron:0.0.3
         environment:
           TARGET_ARCH: ia32
+    resource_class: xlarge
     steps:
       - checkout
-      - run: script/cibuild
+      - run:
+          name: Setup for headless testing
+          command: sh -e /etc/init.d/xvfb start
+      - run:
+          name: Check for release
+          command: |
+            MESSAGE="$(git log --format=%B -n 1 HEAD)"
+            case ${MESSAGE} in
+              Bump* ) echo 'export ELECTRON_RELEASE=1' >> $BASH_ENV
+            esac
+      - run:
+         name: Bootstrap
+         command: |
+           if [ "$ELECTRON_RELEASE" == "1" ]; then
+              echo 'Bootstrapping Electron for release build'
+              script/bootstrap.py --target_arch=$TARGET_ARCH
+           else
+              echo 'Bootstrapping Electron for debug build'
+              script/bootstrap.py --target_arch=$TARGET_ARCH --dev
+           fi
+      - run: npm run lint
+      - run:
+         name: Build
+         command: |
+           if [ "$ELECTRON_RELEASE" == "1" ]; then
+              echo 'Building Electron for release'
+              script/build.py -c R
+           else
+              echo 'Building Electron for debug'
+              script/build.py -c D
+           fi
+      - run:
+          name: Create distribution
+          command: |
+             if [ "$ELECTRON_RELEASE" == "1" ]; then
+                echo 'Creating Electron release distribution'
+                script/create-dist.py
+             else
+                echo 'Skipping create distribution because build is not for release'
+             fi
+      - run:
+          name: Upload distribution
+          command: |
+             if [ "$ELECTRON_RELEASE" == "1" ]; then
+                echo 'Uploading Electron release distribution'
+                script/upload.py
+             else
+                echo 'Skipping upload distribution because build is not for release'
+             fi
 
   electron-linux-x64:
     docker:
       - image: electronbuilds/electron:0.0.3
         environment:
           TARGET_ARCH: x64
+    resource_class: xlarge
     steps:
       - checkout
-      - run: script/cibuild
+      - run:
+          name: Setup for headless testing
+          command: sh -e /etc/init.d/xvfb start
+      - run:
+          name: Check for release
+          command: |
+            MESSAGE="$(git log --format=%B -n 1 HEAD)"
+            case ${MESSAGE} in
+              Bump* ) echo 'export ELECTRON_RELEASE=1' >> $BASH_ENV
+            esac
+      - run:
+         name: Bootstrap
+         command: |
+           if [ "$ELECTRON_RELEASE" == "1" ]; then
+              echo 'Bootstrapping Electron for release build'
+              script/bootstrap.py --target_arch=$TARGET_ARCH
+           else
+              echo 'Bootstrapping Electron for debug build'
+              script/bootstrap.py --target_arch=$TARGET_ARCH --dev
+           fi
+      - run: npm run lint
+      - run:
+         name: Build
+         command: |
+           if [ "$ELECTRON_RELEASE" == "1" ]; then
+              echo 'Building Electron for release'
+              script/build.py -c R
+           else
+              echo 'Building Electron for debug'
+              script/build.py -c D
+           fi
+      - run:
+          name: Create distribution
+          command: |
+             if [ "$ELECTRON_RELEASE" == "1" ]; then
+                echo 'Creating Electron release distribution'
+                script/create-dist.py
+             else
+                echo 'Skipping create distribution because build is not for release'
+             fi
+      - run:
+          name: Upload distribution
+          command: |
+             if [ "$ELECTRON_RELEASE" == "1" ]; then
+                echo 'Uploading Electron release distribution'
+                script/upload.py
+             else
+                echo 'Skipping upload distribution because build is not for release'
+             fi
+      - run:
+          name: Test
+          environment:
+            MOCHA_FILE: junit/test-results.xml
+            MOCHA_REPORTER: mocha-junit-reporter
+          command: |
+             if [ "$ELECTRON_RELEASE" != "1" ]; then
+                echo 'Testing Electron debug build'
+                mkdir junit
+                script/test.py --ci --rebuild_native_modules
+             else
+                echo 'Skipping testing on release build'
+             fi
+      - run:
+          name: Verify FFmpeg
+          command: |
+             if [ "$ELECTRON_RELEASE" != "1" ]; then
+                echo 'Verifying ffmpeg on debug build'
+                script/verify-ffmpeg.py
+             else
+                echo 'Skipping verify ffmpeg on release build'
+             fi
+      - store_test_results:
+          path: junit
+      - store_artifacts:
+          path: junit
 
 workflows:
   version: 2

+ 1 - 0
spec/package.json

@@ -9,6 +9,7 @@
     "graceful-fs": "^4.1.9",
     "mkdirp": "^0.5.1",
     "mocha": "^3.1.0",
+    "mocha-junit-reporter": "^1.14.0",
     "multiparty": "^4.1.3",
     "q": "^1.4.1",
     "send": "^0.14.1",

+ 8 - 3
spec/static/index.html

@@ -51,10 +51,15 @@
   var Coverage = require('electabul').Coverage;
 
   var Mocha = require('mocha');
+  var mochaOpts = {};
+  if (process.env.MOCHA_REPORTER) {
+    mochaOpts.reporter = process.env.MOCHA_REPORTER;
+  }
+  var mocha = new Mocha(mochaOpts);
 
-  var mocha = new Mocha();
-
-  mocha.ui('bdd').reporter(isCi ? 'tap' : 'html');
+  if (!process.env.MOCHA_REPORTER) {
+    mocha.ui('bdd').reporter(isCi ? 'tap' : 'html');
+  }
   mocha.timeout(isCi ? 30000 : 10000)
 
   var query = Mocha.utils.parseQuery(window.location.search || '');