|
1 | | -name: 'Build' |
| 1 | +name: Build |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: |
6 | | - - main |
7 | | - tags: |
8 | | - - '*' |
| 5 | + branches: [main, "release*", "dev*"] |
| 6 | + tags: ["*"] |
9 | 7 | pull_request: |
| 8 | + branches: [main, "release*", "dev*"] |
| 9 | + workflow_dispatch: |
10 | 10 |
|
11 | | -env: |
12 | | - DEFAULT_TARGET: f7 |
13 | | - FBT_TOOLCHAIN_PATH: /runner/_work |
14 | | - FBT_GIT_SUBMODULE_SHALLOW: 1 |
15 | | - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
16 | | -permissions: write-all |
17 | | -jobs: |
18 | | - main: |
| 11 | +jobs: |
| 12 | + build: |
19 | 13 | runs-on: ubuntu-latest |
20 | 14 | strategy: |
21 | 15 | fail-fast: false |
22 | 16 | matrix: |
23 | 17 | target: [f7, f18] |
24 | | - steps: |
25 | | - - name: 'Wipe workspace' |
26 | | - run: sudo find ./ -mount -maxdepth 1 -exec rm -rf {} \; |
27 | 18 |
|
28 | | - - name: 'Checkout code' |
29 | | - uses: actions/checkout@v4 |
| 19 | + steps: |
| 20 | + - name: Checkout |
| 21 | + uses: actions/checkout@v3 |
30 | 22 | with: |
31 | | - fetch-depth: 1 |
32 | | - ref: ${{ github.event.pull_request.head.sha }} |
| 23 | + fetch-depth: 0 |
| 24 | + submodules: true |
33 | 25 |
|
34 | | - - name: 'Get commit details' |
35 | | - id: names |
| 26 | + # Setup environment variables |
| 27 | + - name: Set environment variables |
| 28 | + run: | |
| 29 | + echo "TARGETS=${{ matrix.target }}" >> $GITHUB_ENV |
| 30 | + echo "DEFAULT_TARGET=f7" >> $GITHUB_ENV |
| 31 | + echo "FBT_TOOLCHAIN_PATH=/tmp/toolchain" >> $GITHUB_ENV |
| 32 | + echo "FBT_GIT_SUBMODULE_SHALLOW=1" >> $GITHUB_ENV |
| 33 | + echo "DIST_SUFFIX=custom" >> $GITHUB_ENV |
| 34 | + |
| 35 | + - name: 'Create toolchain directory with proper permissions' |
| 36 | + run: | |
| 37 | + sudo mkdir -p $FBT_TOOLCHAIN_PATH |
| 38 | + sudo chmod -R 777 $FBT_TOOLCHAIN_PATH |
| 39 | +
|
| 40 | + # Build stuff |
| 41 | + - name: 'Build firmware' |
| 42 | + id: build-fw |
36 | 43 | run: | |
37 | | - set -e |
38 | | - sudo -i |
39 | | - BUILD_TYPE='DEBUG=1 COMPACT=0' |
40 | | - if [[ ${{ github.event_name }} == 'pull_request' ]]; then |
41 | | - TYPE="pull" |
42 | | - elif [[ "${{ github.ref }}" == "refs/tags/"* ]]; then |
43 | | - TYPE="tag" |
44 | | - BUILD_TYPE='DEBUG=0 COMPACT=1' |
45 | | - else |
46 | | - TYPE="other" |
47 | | - fi |
48 | | - sudo python3 scripts/get_env.py "--event_file=${{ github.event_path }}" "--type=$TYPE" || cat "${{ github.event_path }}" |
49 | | - echo "event_type=$TYPE" >> $GITHUB_OUTPUT |
50 | | - echo "FBT_BUILD_TYPE=$BUILD_TYPE" >> $GITHUB_ENV |
51 | 44 | echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV |
52 | 45 | echo "TARGET_HW=$(echo "${{ matrix.target }}" | sed 's/f//')" >> $GITHUB_ENV |
53 | 46 |
|
54 | 47 | - name: 'Check API versions for consistency between targets' |
55 | 48 | run: | |
56 | | - set -e |
57 | | - sudo -i |
58 | 49 | N_API_HEADER_SIGNATURES=`ls -1 targets/f*/api_symbols.csv | xargs -I {} sh -c "head -n2 {} | md5sum" | sort -u | wc -l` |
59 | | - if [ $N_API_HEADER_SIGNATURES != 1 ] ; then |
| 50 | + if [ "$N_API_HEADER_SIGNATURES" -ne 1 ]; then |
60 | 51 | echo API versions aren\'t matching for available targets. Please update! |
61 | | - echo API versions are: |
| 52 | + echo "Signatures found:" |
62 | 53 | head -n2 targets/f*/api_symbols.csv |
63 | 54 | exit 1 |
64 | | - fi |
65 | | -
|
66 | | - - name: 'Build the firmware and apps' |
67 | | - id: build-fw |
| 55 | + |
| 56 | + - name: 'Build firmware with fbt' |
| 57 | + id: build-fw-with-fbt |
68 | 58 | run: | |
69 | | - set -e |
70 | | - sudo -i |
71 | | - ./fbt TARGET_HW=$TARGET_HW $FBT_BUILD_TYPE copro_dist updater_package fap_dist |
| 59 | + # Use FBT_TOOLCHAIN_PATH that we've already set up with proper permissions |
| 60 | + sudo ./fbt TARGET_HW=$TARGET_HW $FBT_BUILD_TYPE copro_dist updater_package fap_dist |
72 | 61 | echo "firmware_api=$(./fbt TARGET_HW=$TARGET_HW get_apiversion)" >> $GITHUB_OUTPUT |
| 62 | + shell: /usr/bin/bash -e {0} |
73 | 63 |
|
74 | | - - name: 'Check for uncommitted changes' |
75 | | - run: | |
76 | | - set -e |
77 | | - sudo -i |
78 | | - git diff --exit-code |
79 | | -
|
80 | | - - name: 'Copy build output' |
| 64 | + - name: 'Prepare artifacts' |
81 | 65 | run: | |
82 | | - set -e |
83 | | - sudo -i |
84 | | - rm -rf artifacts map_analyser_files || true |
85 | | - sudo mkdir artifacts map_analyser_files |
86 | | - sudo cp dist/${TARGET}-*/* artifacts/ || true |
| 66 | + mkdir -p artifacts map_analyser_files |
| 67 | + cp dist/${TARGET}-*/* artifacts/ || true |
87 | 68 | tar czpf "artifacts/flipper-z-${TARGET}-resources-${SUFFIX}.tgz" \ |
88 | | - -C build/latest resources |
| 69 | + -C assets resources |
89 | 70 | tar czpf "artifacts/flipper-z-${TARGET}-debugapps-${SUFFIX}.tgz" \ |
90 | 71 | -C dist/${TARGET}-*/apps/Debug . |
91 | 72 | tar czpf "artifacts/flipper-z-${TARGET}-appsymbols-${SUFFIX}.tgz" \ |
|
0 commit comments