From 17d98e14e4cb31537445ddcc394fa938ed79456f Mon Sep 17 00:00:00 2001 From: Anna Prosvetova Date: Tue, 11 Apr 2023 16:05:31 +0200 Subject: [PATCH 1/9] Fix example URL --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9ffda67..1d416eb 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ jobs: - name: Unofficial firmware # example URL, replace with a valid one # you can also use other modes for specifying SDK sources - sdk-index-url: https://up.unofficialflip.com/directory.json + sdk-index-url: https://flipper.example.com/directory.json sdk-channel: dev name: 'ufbt: Build for ${{ matrix.name }}' steps: @@ -157,4 +157,4 @@ A version of the toolchain used to build the application. Defined by current SDK ## Acknowledgements -First version of this action was created by [Oleksii Kutuzov](https://github.com/oleksiikutuzov) and is available [here](https://github.com/oleksiikutuzov/flipperzero-ufbt-action). However, it no longer works with the latest version of `ufbt`. This version is a complete rewrite, with problem matcher borrowed from original verison. \ No newline at end of file +First version of this action was created by [Oleksii Kutuzov](https://github.com/oleksiikutuzov) and is available [here](https://github.com/oleksiikutuzov/flipperzero-ufbt-action). However, it no longer works with the latest version of `ufbt`. This version is a complete rewrite, with problem matcher borrowed from original verison. From f144bee5dac001e66697257e40961c2906c76e7e Mon Sep 17 00:00:00 2001 From: hedger Date: Tue, 11 Apr 2023 21:01:54 +0400 Subject: [PATCH 2/9] examples: better artifact naming --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1d416eb..bccbb71 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ jobs: - name: Upload app artifacts uses: actions/upload-artifact@v3 with: - name: fap-${{ steps.build-app.outputs.suffix }} + name: ${{ github.event.repository.name }}-${{ steps.build-app.outputs.suffix }} path: ${{ steps.build-app.outputs.fap-artifacts }} # You can remove this step if you don't want to check source code formatting - name: Lint sources @@ -85,7 +85,7 @@ jobs: - name: Upload app artifacts uses: actions/upload-artifact@v3 with: - name: fap-${{ steps.build-app.outputs.suffix }} + name: ${{ github.event.repository.name }}-${{ steps.build-app.outputs.suffix }} path: ${{ steps.build-app.outputs.fap-artifacts }} ``` From 50a43548d805e4059c365281a9baee1985543d99 Mon Sep 17 00:00:00 2001 From: hedger Date: Tue, 11 Apr 2023 21:04:19 +0400 Subject: [PATCH 3/9] Changed test workflow triggers --- .github/workflows/test_with_dev.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_with_dev.yml b/.github/workflows/test_with_dev.yml index 5bb2ec5..3065ff3 100644 --- a/.github/workflows/test_with_dev.yml +++ b/.github/workflows/test_with_dev.yml @@ -1,7 +1,13 @@ name: Test ufbt action with dev SDK on: - [push, pull_request] + push: + branches: + - dev + - "release*" + tags: + - '*' + pull_request: jobs: run-test-on-latest: From e904e921e9a614f9d08fda4c7f2e62b6f2704c63 Mon Sep 17 00:00:00 2001 From: hedger Date: Tue, 11 Apr 2023 21:15:06 +0400 Subject: [PATCH 4/9] readme: cleanup and formatting --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bccbb71..e30cdf1 100644 --- a/README.md +++ b/README.md @@ -91,30 +91,32 @@ jobs: ## Inputs +All inputs are **optional**. If you don't specify any inputs, `ufbt` will build your application for the latest release version of official firmware. You can use [fap-artifacts](#fap-artifacts) output to get a list of built files to [upload them](https://github.com/marketplace/actions/upload-a-build-artifact). + #### `task` -**Optional** Task to run. Can be `setup`, `build` or `lint`. Default is `"build"`. +Task to run. Can be `setup`, `build` or `lint`. Default is `"build"`. #### `app-dir` -**Optional** Path to application's source code. Default is `"."` - the root of the repository. +Path to application's source code. Default is `"."` — the root of the repository. #### `ufbt-version` -**Optional** Version of `ufbt` to use. Default is `"latest"` - the latest version available on PyPI. If set to `prerelease`, this action will fetch the latest [pre-release version](https://pypi.org/project/ufbt/#history). You can also use a PyPI version specifier, such as `">=0.2.1,<0.3.0"`. +Version of `ufbt` to use. Default is `"latest"` — the latest version available on PyPI. If set to `prerelease`, this action will fetch the latest [pre-release version](https://pypi.org/project/ufbt/#history). You can also use a PyPI version specifier, such as `">=0.2.1,<0.3.0"`. #### `ufbt-args` -**Optional** Additional arguments to pass to `ufbt`. Default is `-s` - which suppresses build system output, only leaving subcommands' outputs, such as compiler messages. Set to `""` for extra verbosity. +Additional arguments to pass to `ufbt`. Default is `-s` — which suppresses build system output, only leaving subcommands' outputs, such as compiler messages. Set to `""` for extra verbosity. Only handled when `task` is set to `build` or `lint`. See `ufbt` documentation for details. #### `skip-setup` -**Optional** If set to `true`, skips SDK setup. Useful when running multiple action multiple times. Default is `false`. +If set to `true`, skips SDK setup. Useful when running multiple action multiple times. Default is `false`. #### SDK source options -Table below describes options for SDK update. See ufbt documentation on available [SDK update modes](https://github.com/flipperdevices/flipperzero-ufbt/blob/dev/README.md#managing-the-sdk) for details. All these inputs are **optional**. +Table below describes options for SDK update. See ufbt documentation on available [SDK update modes](https://github.com/flipperdevices/flipperzero-ufbt/blob/dev/README.md#managing-the-sdk) for details. | Input name | `ufbt update` argument | Description | | --- | --- | --- | From b9f69342078ea473f1de4669d0a2872fb5709b90 Mon Sep 17 00:00:00 2001 From: hedger Date: Wed, 3 May 2023 19:34:05 +0400 Subject: [PATCH 5/9] Fixed path resolution for app-dir input --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index e8c831d..c695fb9 100644 --- a/action.yml +++ b/action.yml @@ -170,7 +170,7 @@ runs: shell: bash run: | set +e - FAP_SRC_PATH=`realpath $GITHUB_WORKSPACE/${{ inputs.app-dir }}` + FAP_SRC_PATH=`realpath ${{ inputs.app-dir }}` DIST_PATH=$FAP_SRC_PATH/dist cd $FAP_SRC_PATH BUILD_MESSAGES="$(ufbt ${{ inputs.ufbt-args }} 2>&1 | tee /dev/stderr)" @@ -200,7 +200,7 @@ runs: shell: bash run: | set +e - cd $GITHUB_WORKSPACE/${{ inputs.app-dir }} + cd ${{ inputs.app-dir }} LINT_MESSAGES="$(ufbt lint ${{ inputs.ufbt-args }} 2>&1 | tee /dev/stderr)" LINT_STATUS=${PIPESTATUS[0]} if [ "$LINT_STATUS" -eq 0 ]; then From 6781e528f73edd9f3b1360ca0c6d8386b897fd2e Mon Sep 17 00:00:00 2001 From: hedger Date: Wed, 3 May 2023 19:37:23 +0400 Subject: [PATCH 6/9] readme: updated tag --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e30cdf1..02ce7b3 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Build with ufbt - uses: flipperdevices/flipperzero-ufbt-action@v0.1.0 + uses: flipperdevices/flipperzero-ufbt-action@v0.1.1 id: build-app with: # Set to 'release' to build for latest published release version @@ -43,7 +43,7 @@ jobs: path: ${{ steps.build-app.outputs.fap-artifacts }} # You can remove this step if you don't want to check source code formatting - name: Lint sources - uses: flipperdevices/flipperzero-ufbt-action@v0.1.0 + uses: flipperdevices/flipperzero-ufbt-action@v0.1.1 with: # skip SDK setup, we already did it in previous step skip-setup: true @@ -77,7 +77,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Build with ufbt - uses: flipperdevices/flipperzero-ufbt-action@v0.1.0 + uses: flipperdevices/flipperzero-ufbt-action@v0.1.1 id: build-app with: sdk-channel: ${{ matrix.sdk-channel }} From e9a8e859fd817dfdbe503f8a3520628208086c34 Mon Sep 17 00:00:00 2001 From: hedger Date: Thu, 11 May 2023 00:29:52 +0300 Subject: [PATCH 7/9] Added error output for build step; added scheduled builds to examples (#5) * Added error output for build step; added scheduled builds to examples * Added docs on build errors * Changed default Python version to 3.11 --- .github/workflows/test_ufbt.yml | 4 ++++ README.md | 22 +++++++++++++++++----- action.yml | 7 ++++++- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_ufbt.yml b/.github/workflows/test_ufbt.yml index d409516..6cadc7e 100644 --- a/.github/workflows/test_ufbt.yml +++ b/.github/workflows/test_ufbt.yml @@ -82,3 +82,7 @@ jobs: - name: Fail if lint or build of broken app succeeded if: steps.lint-broken-app.outcome == 'success' || steps.build-broken-app.outcome == 'success' run: exit 1 + + - name: Fail if lint or build of broken app did not produce error output + if: steps.lint-broken-app.outputs.lint-messages == '' || steps.build-broken-app.outputs.build-errors == '' + run: exit 1 diff --git a/README.md b/README.md index 02ce7b3..ed17682 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Build with ufbt - uses: flipperdevices/flipperzero-ufbt-action@v0.1.1 + uses: flipperdevices/flipperzero-ufbt-action@v0.1.2 id: build-app with: # Set to 'release' to build for latest published release version @@ -43,7 +43,7 @@ jobs: path: ${{ steps.build-app.outputs.fap-artifacts }} # You can remove this step if you don't want to check source code formatting - name: Lint sources - uses: flipperdevices/flipperzero-ufbt-action@v0.1.1 + uses: flipperdevices/flipperzero-ufbt-action@v0.1.2 with: # skip SDK setup, we already did it in previous step skip-setup: true @@ -52,11 +52,19 @@ jobs: ### Advanced example: build for multiple SDK sources -This example will build your application for 3 different SDK sources: `dev` and `release` channels of official firmware, and for an SDK from an unofficial source. It will upload generated binaries to GitHub artifacts. +This example will build your application for 3 different SDK sources: `dev` and `release` channels of official firmware, and for an SDK from an unofficial source. It will upload generated binaries to GitHub artifacts. It will also do a build every day, even if there are no new commits in the repository, so you can be sure that your application is always up to date with the latest SDK. ```yaml name: "FAP: Build for multiple SDK sources" -on: [push, pull_request] +on: + push: + ## put your main branch name under "braches" + #branches: + # - master + pull_request: + schedule: + # do a build every day + - cron: "1 1 * * *" jobs: ufbt-build-action: runs-on: ubuntu-latest @@ -77,7 +85,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Build with ufbt - uses: flipperdevices/flipperzero-ufbt-action@v0.1.1 + uses: flipperdevices/flipperzero-ufbt-action@v0.1.2 id: build-app with: sdk-channel: ${{ matrix.sdk-channel }} @@ -149,6 +157,10 @@ A suffix to use in artifact names, includes hardware target, API and SDK version A list of linter messages, in case of any formatting errors. Only available in `lint` mode. +#### `build-errors` + +A list of build errors, in case of any. Only available in `build` mode. + #### `ufbt-status` A string, JSON object with ufbt status. Contains `ufbt status --json` output. Useful for extracting information about ufbt's directories, configured modes, etc. Useful in combination with [fromJSON() function](https://docs.github.com/en/actions/learn-github-actions/expressions#fromjson) to extract information from the output. For example, `${{ fromJSON(steps..ufbt-status).toolchain_dir }}`. Available in all modes. diff --git a/action.yml b/action.yml index c695fb9..f058bee 100644 --- a/action.yml +++ b/action.yml @@ -1,4 +1,5 @@ name: "Build Flipper Application Package (.fap)" + author: "@flipperdevices" description: | Provides a composite action to install `ufbt`, build and lint applications for Flipper Zero. @@ -84,6 +85,10 @@ outputs: description: Linter output. Set by lint task value: ${{ steps.lint-app.outputs.lint-messages }} + build-errors: + description: Build errors. Set by build task + value: ${{ steps.build-fap.outputs.build-messages }} + ufbt-status: description: JSON status object for ufbt. Use with fromJSON() value: ${{ steps.ufbt-status.outputs.json }} @@ -100,7 +105,7 @@ runs: uses: actions/setup-python@v3 if: inputs.skip-setup == 'false' with: - python-version: '3.8' + python-version: '3.11' - name: Install ufbt if: inputs.skip-setup == 'false' From ac923ebbd9c8fa1ad19c23572c89136e7151a55f Mon Sep 17 00:00:00 2001 From: hedger Date: Wed, 25 Oct 2023 21:27:19 +0400 Subject: [PATCH 8/9] Bumped dependency versions; invoking pip as python module (#6) * Bumped dependency versions; invoking pip as python module * github: updated test flow naming * More naming changes --- .github/workflows/test_ufbt.yml | 6 +++--- .github/workflows/test_with_dev.yml | 4 ++-- README.md | 10 +++++----- action.yml | 10 +++++----- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test_ufbt.yml b/.github/workflows/test_ufbt.yml index 6cadc7e..dba88c0 100644 --- a/.github/workflows/test_ufbt.yml +++ b/.github/workflows/test_ufbt.yml @@ -1,4 +1,4 @@ -name: Run tests for ufbt action +name: Testsuite on: workflow_call: @@ -22,10 +22,10 @@ on: jobs: test-ufbt-action: runs-on: ubuntu-latest - name: Test ufbt action + name: Test action steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup ufbt uses: ./ # Uses an action in the root directory diff --git a/.github/workflows/test_with_dev.yml b/.github/workflows/test_with_dev.yml index 3065ff3..47968df 100644 --- a/.github/workflows/test_with_dev.yml +++ b/.github/workflows/test_with_dev.yml @@ -1,4 +1,4 @@ -name: Test ufbt action with dev SDK +name: Action tests on: push: @@ -11,7 +11,7 @@ on: jobs: run-test-on-latest: - name: Test ufbt action with dev SDK + name: Using dev sdk uses: ./.github/workflows/test_ufbt.yml with: ufbt-version: prerelease diff --git a/README.md b/README.md index ed17682..8ff31b6 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,9 @@ jobs: name: 'ufbt: Build for Dev branch' steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Build with ufbt - uses: flipperdevices/flipperzero-ufbt-action@v0.1.2 + uses: flipperdevices/flipperzero-ufbt-action@v0.1 id: build-app with: # Set to 'release' to build for latest published release version @@ -43,7 +43,7 @@ jobs: path: ${{ steps.build-app.outputs.fap-artifacts }} # You can remove this step if you don't want to check source code formatting - name: Lint sources - uses: flipperdevices/flipperzero-ufbt-action@v0.1.2 + uses: flipperdevices/flipperzero-ufbt-action@v0.1 with: # skip SDK setup, we already did it in previous step skip-setup: true @@ -83,9 +83,9 @@ jobs: name: 'ufbt: Build for ${{ matrix.name }}' steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Build with ufbt - uses: flipperdevices/flipperzero-ufbt-action@v0.1.2 + uses: flipperdevices/flipperzero-ufbt-action@v0.1 id: build-app with: sdk-channel: ${{ matrix.sdk-channel }} diff --git a/action.yml b/action.yml index f058bee..bd47694 100644 --- a/action.yml +++ b/action.yml @@ -102,7 +102,7 @@ runs: using: composite steps: - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 if: inputs.skip-setup == 'false' with: python-version: '3.11' @@ -111,13 +111,13 @@ runs: if: inputs.skip-setup == 'false' shell: bash run: | - python -m pip install --upgrade pip + python3 -m pip install --upgrade pip if [ "${{ inputs.ufbt-version }}" == "prerelease" ]; then - pip install --upgrade --pre ufbt + python3 -m pip install --upgrade --pre ufbt elif [ "${{ inputs.ufbt-version }}" == "latest" ]; then - pip install --upgrade ufbt + python3 -m pip install --upgrade ufbt else - pip install --upgrade ufbt${{ inputs.ufbt-version }} + python3 -m pip install --upgrade ufbt${{ inputs.ufbt-version }} fi - name: Update ufbt From 6237e4616a47217903940b09c883dd67cb615cf8 Mon Sep 17 00:00:00 2001 From: Silent Date: Wed, 6 Mar 2024 22:18:15 +0100 Subject: [PATCH 9/9] Update dependency versions (#8) Fixes #7 --- .github/workflows/test_ufbt.yml | 2 +- action.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_ufbt.yml b/.github/workflows/test_ufbt.yml index dba88c0..f444cf4 100644 --- a/.github/workflows/test_ufbt.yml +++ b/.github/workflows/test_ufbt.yml @@ -51,7 +51,7 @@ jobs: app-dir: 'test' - name: Upload app artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: fap-${{ steps.build-app.outputs.suffix }} path: ${{ steps.build-app.outputs.fap-artifacts }} diff --git a/action.yml b/action.yml index bd47694..560d372 100644 --- a/action.yml +++ b/action.yml @@ -102,7 +102,7 @@ runs: using: composite steps: - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 if: inputs.skip-setup == 'false' with: python-version: '3.11' @@ -158,7 +158,7 @@ runs: echo "deployed-version=`cat ${{ fromJSON(steps.ufbt-status.outputs.json).toolchain_dir }}/*/VERSION 2>/dev/null || echo 0`" >> $GITHUB_OUTPUT - name: Cache toolchain - uses: actions/cache@v3 + uses: actions/cache@v4 if: steps.get-tooclhain-version.outputs.required-version != steps.get-tooclhain-version.outputs.deployed-version with: path: ${{ fromJSON(steps.ufbt-status.outputs.json).toolchain_dir }}