Browse Source

build: baby steps, super basic checkout

Keeley Hammond 1 year ago
parent
commit
8720664dac
2 changed files with 93 additions and 25 deletions
  1. 1 20
      .circleci/config.yml
  2. 92 5
      .github/workflows/mac-build.yml

+ 1 - 20
.circleci/config.yml

@@ -49,28 +49,9 @@ jobs:
     docker:
       - image: cimg/node:16.14
     steps:
-      - checkout
-      - path-filtering/set-parameters:
-          base-revision: main
-          mapping: |
-            ^((?!docs/).)*$ run-build-mac false
-            ^((?!docs/).)*$ run-build-linux false
-            docs/.* run-docs-only true
-            ^((?!docs/).)*$ run-docs-only false
       - run:
           command: |
-            cd .circleci/config
-            yarn
-            export CIRCLECI_BINARY="$HOME/circleci"
-            curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/main/install.sh | DESTDIR=$CIRCLECI_BINARY bash
-            node build.js
-          name: Pack config.yml
-      - run:
-          name: Set params
-          command: node .circleci/config/params.js
-      - continuation/continue:
-          configuration_path: .circleci/config-staging/built.yml
-          parameters: /tmp/pipeline-parameters.json
+            echo "Disabled workflows for this PR"
 
 # Initial setup workflow
 workflows:

+ 92 - 5
.github/workflows/mac-build.yml

@@ -1,13 +1,100 @@
-name: Build macOS
+name: Build MacOS
 
 on:
   push
 
 jobs:
-  build:
+  install-dependencies:
     runs-on: macos-13-xlarge
 
     steps:
-    - uses: actions/checkout@v3
-    - name: get disk info
-      run: df -h
+    - name: Checkout Electron
+      uses: actions/checkout@v4
+      with:
+        path: src/electron
+    - name: Setup Node/NPM
+      uses: actions/setup-node@v3
+      with:
+        node-version: 18.18.x
+        cache: yarn
+        cache-dependency-path: src/electron/yarn.lock
+    - run: |
+        cd src/electron
+        node script/yarn install
+    - name: Get Depot Tools
+      run: |
+        git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
+        if [ "`uname`" == "Darwin" ]; then
+          # remove ninjalog_uploader_wrapper.py from autoninja since we don't use it and it causes problems
+          sed -i '' '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
+        else
+          sed -i '/ninjalog_uploader_wrapper.py/d' ./depot_tools/autoninja
+          # Remove swift-format dep from cipd on macOS until we send a patch upstream.
+          cd depot_tools
+          cat > gclient.diff \<< 'EOF'
+        diff --git a/gclient.py b/gclient.py
+        index c305c248..e6e0fbdc 100755
+        --- a/gclient.py
+        +++ b/gclient.py
+        @@ -735,7 +735,8 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
+  
+                    if dep_type == 'cipd':
+                        cipd_root = self.GetCipdRoot()
+        -                for package in dep_value.get('packages', []):
+        +                packages = dep_value.get('packages', [])
+        +                for package in (x for x in packages if "infra/3pp/tools/swift-format" not in x.get('package')):
+                            deps_to_add.append(
+                                CipdDependency(parent=self,
+                                                name=name,
+        EOF
+          git apply --3way gclient.diff
+        fi
+        # Ensure depot_tools does not update.
+        test -d depot_tools && cd depot_tools
+        touch .disable_auto_update
+
+  # gclient-sync-and-cache:
+  #   runs-on: macos-13-xlarge
+
+  #   steps:
+  #   - name: Gclient Sync
+  #     run: |
+  #       # If we did not restore a complete sync then we need to sync for realz
+  #       if [ ! -s "src/electron/.circle-sync-done" ]; then
+  #         gclient config \
+  #           --name "src/electron" \
+  #           --unmanaged \
+  #           $GCLIENT_EXTRA_ARGS \
+  #           "$CIRCLE_REPOSITORY_URL"
+
+  #         ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 gclient sync --with_branch_heads --with_tags
+  #         if [ "$IS_RELEASE" != "true" ]; then
+  #           # Re-export all the patches to check if there were changes.
+  #           python3 src/electron/script/export_all_patches.py src/electron/patches/config.json
+  #           cd src/electron
+  #           git update-index --refresh || true
+  #           if ! git diff-index --quiet HEAD --; then
+  #             # There are changes to the patches. Make a git commit with the updated patches
+  #             git add patches
+  #             GIT_COMMITTER_NAME="PatchUp" GIT_COMMITTER_EMAIL="73610968+patchup[bot]@users.noreply.github.com" git commit -m "chore: update patches" --author="PatchUp <73610968+patchup[bot]@users.noreply.github.com>"
+  #             # Export it
+  #             mkdir -p ../../patches
+  #             git format-patch -1 --stdout --keep-subject --no-stat --full-index > ../../patches/update-patches.patch
+  #             if (node ./script/push-patch.js 2> /dev/null > /dev/null); then
+  #               echo
+  #               echo "======================================================================"
+  #               echo "Changes to the patches when applying, we have auto-pushed the diff to the current branch"
+  #               echo "A new CI job will kick off shortly"
+  #               echo "======================================================================"
+  #               exit 1
+  #             else
+  #               echo
+  #               echo "======================================================================"
+  #               echo "There were changes to the patches when applying."
+  #               echo "Check the CI artifacts for a patch you can apply to fix it."
+  #               echo "======================================================================"
+  #               exit 1
+  #             fi
+  #           fi
+  #         fi
+  #       fi