├── test ├── images │ └── .gitkeep ├── test_fap.c └── application.fam ├── .gitignore ├── problem_matcher.json ├── .github └── workflows │ └── test_action.yml ├── LICENSE ├── README.md └── action.yml /test/images/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode/ 2 | dist/ 3 | .clang-format 4 | -------------------------------------------------------------------------------- /test/test_fap.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int32_t test_fap_app(void* p) { 4 | UNUSED(p); 5 | FURI_LOG_I("TEST", "Hello world"); 6 | FURI_LOG_I("TEST", "I'm test_fap!"); 7 | 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /problem_matcher.json: -------------------------------------------------------------------------------- 1 | { 2 | "problemMatcher": [ 3 | { 4 | "owner": "flipperzero-ufbt-action", 5 | "pattern": [ 6 | { 7 | "regexp": "^(.*):(\\d+):(\\d+):\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$", 8 | "file": 1, 9 | "line": 2, 10 | "column": 3, 11 | "severity": 4, 12 | "message": 5 13 | } 14 | ] 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /test/application.fam: -------------------------------------------------------------------------------- 1 | # For details & more options, see documentation/AppManifests.md in firmware repo 2 | 3 | App( 4 | appid="test_fap", # Must be unique 5 | name="App test_fap", # Displayed in UI 6 | apptype=FlipperAppType.EXTERNAL, 7 | entry_point="test_fap_app", 8 | stack_size=2 * 1024, 9 | fap_category="Misc", 10 | # Optional values 11 | # fap_version=(0, 1), # (major, minor) 12 | # fap_icon="test_fap.png", # 10x10 1-bit PNG 13 | # fap_description="A simple app", 14 | # fap_author="J. Doe", 15 | # fap_weburl="https://github.com/user/test_fap", 16 | fap_icon_assets="images", # Image assets to compile for this application 17 | ) 18 | -------------------------------------------------------------------------------- /.github/workflows/test_action.yml: -------------------------------------------------------------------------------- 1 | name: Test action 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | build_rc: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@v3 15 | 16 | - name: Build test fap 17 | uses: oleksiikutuzov/flipperzero-ufbt-action@main 18 | with: 19 | path: test 20 | channel: rc 21 | 22 | lint_dev: 23 | runs-on: ubuntu-latest 24 | 25 | steps: 26 | - name: Checkout 27 | uses: actions/checkout@v3 28 | 29 | - name: Build test fap 30 | uses: oleksiikutuzov/flipperzero-ufbt-action@main 31 | with: 32 | path: test 33 | lint_only: true 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Oleksii Kutuzov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # flipperzero-ufbt-action (deprecated) 2 | 3 | > **Warning** 4 | > Project will no longer be maintained! Please use an official github action https://github.com/flipperdevices/flipperzero-ufbt-action 5 | 6 | ## Features 7 | 8 | * Saves ufbt cache for your repository as you run it and automatically updates it as needed. [More about managing caches.](https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#managing-caches) 9 | 10 | * Has error matching and shows errors in Annotations section of the Summary. 11 | 12 | * Uploads artifact after successful build. 13 | 14 | ## Inputs 15 | 16 | ### `path` 17 | 18 | Is **not required**. Sets the path to a folder where your fap source code is located if it is not in repository root. 19 | 20 | ### `channel` 21 | 22 | Is **not required**. Sets a channel, from which SDK should be pulled. Can be `dev`, `rc`, `release`. When not specified, defaults to `dev`. 23 | 24 | ### `lint_only` 25 | 26 | Is **not required**. Will only lint your code without building. Can be `true` or `false`. When not specified, defaults to `false`. 27 | 28 | ## Usage examples 29 | 30 | Example of a workflow, that will pull SDK from `rc` channel and build your fap: 31 | 32 | ```yml 33 | name: Build FAP 34 | 35 | on: 36 | push: 37 | 38 | jobs: 39 | build: 40 | runs-on: ubuntu-latest 41 | 42 | steps: 43 | - name: Checkout 44 | uses: actions/checkout@v3 45 | 46 | - name: Build 47 | uses: oleksiikutuzov/flipperzero-ufbt-action@v2 48 | with: 49 | channel: rc 50 | ``` 51 | 52 | Example of a workflow, that will pull SDK from default `dev` channel and lint your code located in `lightmeter-fap` directory: 53 | ```yml 54 | name: Lint code 55 | 56 | on: 57 | push: 58 | 59 | jobs: 60 | lint: 61 | runs-on: ubuntu-latest 62 | 63 | steps: 64 | - name: Checkout 65 | uses: actions/checkout@v3 66 | 67 | - name: Lint 68 | uses: oleksiikutuzov/flipperzero-ufbt-action@v2 69 | with: 70 | path: lightmeter-fap 71 | lint_only: true 72 | ``` 73 | 74 | # Revision History 75 | ### Version v2 76 | - Preparation to ufbt changes 77 | 78 | ### Version v1.5.1 79 | - Refactor action 80 | 81 | ### Version v1.5.0 82 | - Add problem matcher 83 | 84 | ### Version v1.4.2 85 | - Inputs naming overhaul 86 | 87 | ### Version v1.4.1 88 | - Inputs naming overhaul 89 | 90 | ### Version v1.4.0 91 | - Support for lint command 92 | 93 | ### Version v1.3.2 94 | - Do not use external action for jq 95 | 96 | ### Version v1.3.1 97 | - Automatically set artifact name to fap name 98 | 99 | ### Version v1.3 100 | - Push artifact after successful build 101 | 102 | ### Version v1.2.3 103 | - Added `channel` input to set SDK channel 104 | 105 | ### Version v1.0 106 | - First release 107 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: "Build Flipper Application Package" 2 | author: "Oleksii Kutuzov" 3 | description: "Github Action that builds your fap with ufbt" 4 | branding: 5 | icon: "cpu" 6 | color: "orange" 7 | inputs: 8 | path: 9 | description: "Path to fap source code (if not in the root of repository)" 10 | required: false 11 | default: "" 12 | lint_only: 13 | description: "Whether you want to only lint your source code" 14 | required: false 15 | default: "false" 16 | channel: 17 | description: "SDK channel to use" 18 | required: false 19 | default: "dev" 20 | runs: 21 | using: "composite" 22 | steps: 23 | - name: Set fap source path 24 | shell: bash 25 | run: > 26 | if [ -z ${{ inputs.path }} ]; then 27 | echo "FAP_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV 28 | else 29 | echo "FAP_PATH=$GITHUB_WORKSPACE/${{ inputs.path }}" >> $GITHUB_ENV 30 | fi 31 | 32 | - name: Get ufbt 33 | shell: bash 34 | run: > 35 | git clone --depth 1 --branch dev https://github.com/flipperdevices/flipperzero-ufbt ${{ runner.temp }}/flipperzero-ufbt; 36 | echo "${{ runner.temp }}/flipperzero-ufbt" >> $GITHUB_PATH 37 | 38 | - name: Set channel 39 | shell: bash 40 | run: > 41 | if [ ${{ inputs.channel }} = 'dev' ]; then 42 | echo "CHANNEL=0" >> $GITHUB_ENV 43 | elif [ ${{ inputs.channel }} = 'rc' ]; then 44 | echo "CHANNEL=1" >> $GITHUB_ENV 45 | elif [ ${{ inputs.channel }} = 'release' ]; then 46 | echo "CHANNEL=2" >> $GITHUB_ENV 47 | else 48 | echo "::error::channel: Bad input!"; exit 1 49 | fi 50 | 51 | - name: Get commit id 52 | shell: bash 53 | run: > 54 | curl -o directory.json https://update.flipperzero.one/firmware/directory.json; 55 | echo "COMMIT_ID=$(jq -r '.channels[0].versions[0].version' directory.json)" >> $GITHUB_ENV 56 | 57 | - name: Cache toolchain 58 | id: cache-fbt 59 | uses: actions/cache@v3 60 | env: 61 | cache-name: cache-ufbt 62 | with: 63 | path: ${{ runner.temp }}/flipperzero-ufbt/.ufbt/ 64 | key: ${{ runner.os }}-${{ env.cache-name }}-${{ inputs.channel }}-${{ env.COMMIT_ID }} 65 | restore-keys: | 66 | ${{ runner.os }}-${{ env.cache-name }}-${{ inputs.channel }}-${{ env.COMMIT_ID }} 67 | 68 | - if: ${{ steps.cache-fbt.outputs.cache-hit != 'true' }} 69 | name: Update ufbt if cache not found 70 | shell: bash 71 | run: ufbt update --channel=${{ inputs.channel }} 72 | 73 | - name: Download problem_matcher.json 74 | shell: bash 75 | run: curl -o problem_matcher.json https://raw.githubusercontent.com/oleksiikutuzov/flipperzero-ufbt-action/main/problem_matcher.json 76 | 77 | - name: Execute ufbt 78 | shell: bash 79 | run: > 80 | if [ ${{ inputs.lint_only }} = 'false' ]; then 81 | echo "::add-matcher::$GITHUB_WORKSPACE/problem_matcher.json"; 82 | cd ${{ env.FAP_PATH }}; ufbt; 83 | echo "ARTIFACT=$(basename ${{ env.FAP_PATH }}/dist/*.fap)" >> $GITHUB_ENV; 84 | elif [ ${{ inputs.lint_only }} = 'true' ]; then 85 | echo "::add-matcher::$GITHUB_WORKSPACE/problem_matcher.json"; 86 | cd ${{ env.FAP_PATH }}; ufbt lint 87 | else 88 | echo "::error::lint_only: Bad input!"; exit 1 89 | fi 90 | 91 | 92 | - if: ${{ inputs.lint_only == 'false' }} 93 | name: Upload artifact 94 | uses: actions/upload-artifact@v3 95 | with: 96 | name: ${{ env.ARTIFACT }} 97 | path: ${{ env.FAP_PATH }}/dist/${{ env.ARTIFACT }} 98 | --------------------------------------------------------------------------------