Просмотр исходного кода

Add workflow to check apps building (#27)

* Fix workflow

* test

* test

* maybe?

* Keep checked out apps commit

* sanity check for build failure

* Revert "sanity check for build failure"

This reverts commit 0ef848f2cca6dec9c982cb1c2f9007306e4d439f.

* Check linting too

* sanity check linting

* fix

* Revert "sanity check linting"

This reverts commit 11452eb5243b0f2bd5e0ffaee07c92d2231f9523.
WillyJL 1 год назад
Родитель
Сommit
36671ed586
2 измененных файлов с 43 добавлено и 109 удалено
  1. 11 109
      .github/workflows/build.yml
  2. 32 0
      .github/workflows/lint.yml

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

@@ -2,11 +2,6 @@ name: "Build"
 
 
 on:
 on:
   push:
   push:
-    branches:
-      - "**"
-      - "!release"
-    tags:
-      - "*"
   pull_request:
   pull_request:
 
 
 concurrency:
 concurrency:
@@ -19,68 +14,38 @@ env:
 
 
 jobs:
 jobs:
   build:
   build:
-    permissions:
-      issues: write
-      pull-requests: write
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
     strategy:
     strategy:
       fail-fast: false
       fail-fast: false
       matrix:
       matrix:
         target: [f7]
         target: [f7]
     steps:
     steps:
-      - name: "Checkout code"
+      - name: "Checkout firmware"
         uses: actions/checkout@v4
         uses: actions/checkout@v4
         with:
         with:
+          repository: Next-Flip/Momentum-Firmware
+          fetch-depth: 1
+          ref: dev
+          submodules: recursive
+
+      - name: "Checkout apps"
+        uses: actions/checkout@v4
+        with:
+          path: applications/external
           fetch-depth: 1
           fetch-depth: 1
           ref: ${{ github.event.pull_request.head.sha }}
           ref: ${{ github.event.pull_request.head.sha }}
 
 
       - name: "Get commit details"
       - name: "Get commit details"
-        id: names
         run: |
         run: |
           BUILD_TYPE='DEBUG=0 COMPACT=1'
           BUILD_TYPE='DEBUG=0 COMPACT=1'
-          if [[ ${{ github.event_name }} == 'pull_request' ]]; then
-            TYPE="pull"
-          elif [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
-            TYPE="tag"
-          else
-            TYPE="other"
-          fi
-          python3 scripts/get_env.py "--event_file=${{ github.event_path }}" "--type=$TYPE" || cat "${{ github.event_path }}"
-          echo "event_type=$TYPE" >> $GITHUB_OUTPUT
           echo "FBT_BUILD_TYPE=$BUILD_TYPE" >> $GITHUB_ENV
           echo "FBT_BUILD_TYPE=$BUILD_TYPE" >> $GITHUB_ENV
           echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV
           echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV
           echo "TARGET_HW=$(echo "${{ matrix.target }}" | sed 's/f//')" >> $GITHUB_ENV
           echo "TARGET_HW=$(echo "${{ matrix.target }}" | sed 's/f//')" >> $GITHUB_ENV
 
 
-      - name: "Check API versions for consistency between targets"
-        run: |
-          set -e
-          N_API_HEADER_SIGNATURES=`ls -1 targets/f*/api_symbols.csv | xargs -I {} sh -c "head -n2 {} | md5sum" | sort -u | wc -l`
-          if [ $N_API_HEADER_SIGNATURES != 1 ] ; then
-            echo API versions aren\'t matching for available targets. Please update!
-            echo API versions are:
-            head -n2 targets/f*/api_symbols.csv
-            exit 1
-          fi
-
-      - name: "Check API version for consistency with OFW release-candidate"
-        run: |
-          set -e
-          symbols="targets/$TARGET/api_symbols.csv"
-          ofw_api="$(curl -s "https://raw.githubusercontent.com/flipperdevices/flipperzero-firmware/release-candidate/${symbols}" | head -n2)"
-          our_api="$(head -n2 "${symbols}")"
-          if [ "$our_api" != "$ofw_api" ] ; then
-            echo API versions aren\'t matching OFW. Please update!
-            echo API versions are:
-            echo "Official: $(tail -n1 <<< "$ofw_api")"
-            echo "Momentum: $(tail -n1 <<< "$our_api")"
-            exit 1
-          fi
-
       - name: "Build the firmware and apps"
       - name: "Build the firmware and apps"
-        id: build-fw
         run: |
         run: |
+          git add applications/external
           ./fbt TARGET_HW=$TARGET_HW $FBT_BUILD_TYPE updater_package
           ./fbt TARGET_HW=$TARGET_HW $FBT_BUILD_TYPE updater_package
-          echo "firmware_api=$(./fbt TARGET_HW=$TARGET_HW get_apiversion)" >> $GITHUB_OUTPUT
 
 
       - name: "Check for uncommitted changes"
       - name: "Check for uncommitted changes"
         run: |
         run: |
@@ -91,66 +56,3 @@ jobs:
         with:
         with:
           path: |
           path: |
             dist/${{ env.TARGET }}-*/flipper-z-${{ env.TARGET }}-update-*
             dist/${{ env.TARGET }}-*/flipper-z-${{ env.TARGET }}-update-*
-            dist/${{ env.TARGET }}-*/flipper-z-${{ env.TARGET }}-sdk-*
-
-      - name: "Copy build output"
-        env:
-          INDEXER_URL: ${{ secrets.INDEXER_URL }}
-        if: ${{ env.INDEXER_URL != '' && (github.event.pull_request || (github.event_name == 'push' && ((github.ref_name == 'dev' && !contains(github.event.head_commit.message, '--nobuild')) || startsWith(github.ref, 'refs/tags/')))) }}
-        run: |
-          set -e
-          rm -rf artifacts || true
-          mkdir artifacts
-          cp dist/${TARGET}-*/flipper-z-${TARGET}-{update,sdk}-* artifacts/
-          cd dist/${TARGET}-*/${TARGET}-update-*/
-          ARTIFACT_TAG=flipper-z-"$(basename "$(realpath .)")"
-          7z a ../../../artifacts/${ARTIFACT_TAG}.zip .
-          echo "ARTIFACT_TAG=$ARTIFACT_TAG" >> $GITHUB_ENV
-          VERSION_TAG="$(basename "$(realpath .)" | cut -d- -f3-)"
-          echo "VERSION_TAG=$VERSION_TAG" >> $GITHUB_ENV
-
-      - name: "Upload artifacts to update server"
-        env:
-          INDEXER_URL: ${{ secrets.INDEXER_URL }}
-        if: ${{ env.INDEXER_URL != '' && (github.event.pull_request || (github.event_name == 'push' && ((github.ref_name == 'dev' && !contains(github.event.head_commit.message, '--nobuild')) || startsWith(github.ref, 'refs/tags/')))) }}
-        run: |
-          curl "${{ secrets.INDEXER_URL }}"/firmware/directory.json > previndex.json
-          FILES=$(for ARTIFACT in $(find artifacts -maxdepth 1 -not -type d); do echo "-F files=@${ARTIFACT}"; done)
-          curl --fail -L -H "Token: ${{ secrets.INDEXER_TOKEN }}" \
-              -F "branch=${BRANCH_NAME}" \
-              -F "version_token=${COMMIT_SHA}" \
-              ${FILES[@]} \
-              "${{ secrets.INDEXER_URL }}"/firmware/uploadfiles
-
-      - name: "Find previous comment"
-        env:
-          INDEXER_URL: ${{ secrets.INDEXER_URL }}
-        if: ${{ env.INDEXER_URL != '' && github.event.pull_request && matrix.target == env.DEFAULT_TARGET }}
-        uses: peter-evans/find-comment@v3
-        id: find-comment
-        with:
-          issue-number: ${{ github.event.pull_request.number }}
-          comment-author: "github-actions[bot]"
-          body-includes: "Compiled ${{ matrix.target }} firmware for commit"
-
-      - name: "Create or update comment"
-        env:
-          INDEXER_URL: ${{ secrets.INDEXER_URL }}
-        if: ${{ env.INDEXER_URL != '' && github.event.pull_request && matrix.target == env.DEFAULT_TARGET }}
-        uses: peter-evans/create-or-update-comment@v4
-        with:
-          comment-id: ${{ steps.find-comment.outputs.comment-id }}
-          issue-number: ${{ github.event.pull_request.number }}
-          body: |
-            **Compiled ${{ matrix.target }} firmware for commit `${{steps.names.outputs.commit_sha}}`:**
-            - [☁️ Flipper Lab/App](https://lab.flipper.net/?url=${{secrets.INDEXER_URL}}/firmware/${{steps.names.outputs.branch_name}}/flipper-z-${{steps.names.outputs.default_target}}-update-${{steps.names.outputs.suffix}}.tgz&channel=mntm-${{steps.names.outputs.branch_name}}&version=${{steps.names.outputs.commit_sha}})
-            - [📦 qFlipper Package](${{secrets.INDEXER_URL}}/firmware/${{steps.names.outputs.branch_name}}/flipper-z-${{steps.names.outputs.default_target}}-update-${{steps.names.outputs.suffix}}.tgz)
-          edit-mode: replace
-
-      - name: Send devbuild webhook
-        env:
-          INDEXER_URL: ${{ secrets.INDEXER_URL }}
-          BUILD_WEBHOOK: ${{ secrets.BUILD_WEBHOOK }}
-        if: ${{ env.INDEXER_URL != '' && github.event_name == 'push' && github.ref_name == 'dev' && !contains(github.event.head_commit.message, '--nobuild') }}
-        run: |
-          python .github/workflow_data/devbuild.py

+ 32 - 0
.github/workflows/lint.yml

@@ -0,0 +1,32 @@
+name: "Lint"
+
+on:
+  push:
+  pull_request:
+
+env:
+  SET_GH_OUTPUT: 1
+
+jobs:
+  lint:
+    runs-on: ubuntu-latest
+    steps:
+      - name: "Checkout firmware"
+        uses: actions/checkout@v4
+        with:
+          repository: Next-Flip/Momentum-Firmware
+          fetch-depth: 1
+          ref: dev
+          submodules: recursive
+
+      - name: "Checkout apps"
+        uses: actions/checkout@v4
+        with:
+          path: applications/external
+          fetch-depth: 1
+          ref: ${{ github.event.pull_request.head.sha }}
+
+      - name: "Check formatting"
+        run: |
+          git add applications/external
+          ./fbt lint_all