From f6d4e8fa84fbd57e39a46ea9ce8abd128424a183 Mon Sep 17 00:00:00 2001 From: Anna Prosvetova Date: Fri, 24 Dec 2021 22:35:25 +0300 Subject: [PATCH] CI: conditional compact build (#930) * CI: conditional compact build * Rpc: fix log line ending --- .github/workflows/build.yml | 68 +++++++++++++++++++++++++++++------ .github/workflows/lint_c.yml | 2 +- .github/workflows/reindex.yml | 2 +- applications/rpc/rpc.c | 2 +- 4 files changed, 60 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d440147f..859c58e2 100644 --- a/.github/workflows/build.yml +++ b/.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 \ No newline at end of file diff --git a/.github/workflows/lint_c.yml b/.github/workflows/lint_c.yml index 1fa47e5a..2cb2bccd 100644 --- a/.github/workflows/lint_c.yml +++ b/.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 diff --git a/.github/workflows/reindex.yml b/.github/workflows/reindex.yml index 56971eec..49c47eec 100644 --- a/.github/workflows/reindex.yml +++ b/.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 diff --git a/applications/rpc/rpc.c b/applications/rpc/rpc.c index bce934a5..3301e0d1 100644 --- a/applications/rpc/rpc.c +++ b/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 */