Explorar o código

CI: conditional compact build (#930)

* CI: conditional compact build
* Rpc: fix log line ending
Anna Prosvetova %!s(int64=4) %!d(string=hai) anos
pai
achega
f6d4e8fa84

+ 57 - 11
.github/workflows/build.yml

@@ -1,6 +1,6 @@
 name: 'Build'
 
-on: 
+on:
   push:
     branches:
       - dev
@@ -14,8 +14,8 @@ env:
   DEFAULT_TARGET: f7
 
 jobs:
-  build:
-    runs-on: [self-hosted]
+  main:
+    runs-on: [self-hosted,Office]
     steps:
       - name: 'Cleanup workspace'
         uses: AutoModality/action-clean@v1
@@ -35,13 +35,6 @@ jobs:
           submodules: true
           ref: ${{ github.event.pull_request.head.sha }}
 
-      - name: 'Docker cache'
-        uses: satackey/action-docker-layer-caching@v0.0.11
-        continue-on-error: true
-        with:
-          key: docker-cache-${{ hashFiles('docker/**') }}-{hash}
-          restore-keys: docker-cache-${{ hashFiles('docker/**') }}-
-
       - name: 'Build docker image'
         uses: ./.github/actions/docker
 
@@ -85,7 +78,7 @@ jobs:
             set -e
             for TARGET in ${TARGETS}
             do
-              make TARGET=${TARGET}
+              make TARGET=${TARGET} ${{ startsWith(github.ref, 'refs/tags') && 'DEBUG=0 COMPACT=1' || '' }}
             done
 
       - name: 'Move upload files'
@@ -149,3 +142,56 @@ jobs:
           body: |
             [Click here](https://update.flipperzero.one/?url=https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.artifacts-path}}/flipper-z-${{steps.names.outputs.default-target}}-full-${{steps.names.outputs.suffix}}.dfu&channel=${{steps.names.outputs.artifacts-path}}&version=${{steps.names.outputs.short-hash}}&target=${{steps.names.outputs.default-target}}) to flash the `${{steps.names.outputs.short-hash}}` version of this branch via WebUSB.
           edit-mode: replace
+  compact:
+    if: ${{ !startsWith(github.ref, 'refs/tags') }}
+    runs-on: [self-hosted,koteeq]
+    steps:
+      - name: 'Cleanup workspace'
+        uses: AutoModality/action-clean@v1
+
+      - name: 'Decontaminate previous build leftovers'
+        run: |
+          if [ -d .git ]
+          then
+            git submodule status \
+              || git checkout `git rev-list --max-parents=0 HEAD | tail -n 1`
+          fi
+
+      - name: 'Checkout code'
+        uses: actions/checkout@v2
+        with:
+          fetch-depth: 0
+          submodules: true
+          ref: ${{ github.event.pull_request.head.sha }}
+
+      - name: 'Build docker image'
+        uses: ./.github/actions/docker
+      
+      - name: 'Generate suffix and folder name'
+        id: names
+        run: |
+          REF=${{ github.ref }}
+          if [[ ${{ github.event_name }} == 'pull_request' ]]; then
+            REF=${{ github.head_ref }}
+          fi
+          BRANCH_OR_TAG=${REF#refs/*/}
+          SHA=$(git rev-parse --short HEAD)
+          
+          if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
+            SUFFIX=${BRANCH_OR_TAG//\//_}
+          else
+            SUFFIX=${BRANCH_OR_TAG//\//_}-$(date +'%d%m%Y')-${SHA}
+          fi
+          
+          echo "WORKFLOW_BRANCH_OR_TAG=${BRANCH_OR_TAG}" >> $GITHUB_ENV
+          echo "DIST_SUFFIX=${SUFFIX}" >> $GITHUB_ENV
+
+      - name: 'Build the firmware in docker'
+        uses: ./.github/actions/docker
+        with:
+          run: |
+            set -e
+            for TARGET in ${TARGETS}
+            do
+              make TARGET=${TARGET} DEBUG=0 COMPACT=1
+            done

+ 1 - 1
.github/workflows/lint_c.yml

@@ -14,7 +14,7 @@ env:
 
 jobs:
   lint_c_cpp:
-    runs-on: [self-hosted]
+    runs-on: [self-hosted,Office]
     steps:
       - name: 'Cleanup workspace'
         uses: AutoModality/action-clean@v1

+ 1 - 1
.github/workflows/reindex.yml

@@ -7,7 +7,7 @@ on:
 jobs:
   reindex:
     name: 'Reindex updates'
-    runs-on: [self-hosted]
+    runs-on: [self-hosted,Office]
     steps:
       - name: Trigger reindex
         uses: wei/curl@master

+ 1 - 1
applications/rpc/rpc.c

@@ -393,7 +393,7 @@ RpcSession* rpc_session_open(Rpc* rpc) {
         };
         rpc_add_handler(rpc, PB_Main_stop_session_tag, &rpc_handler);
 
-        FURI_LOG_D(TAG, "Session started\r\n");
+        FURI_LOG_D(TAG, "Session started");
     }
 
     return result ? &rpc->session : NULL; /* support 1 open session for now */