Skip to content

Commit

Permalink
New build system
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy-JL committed Mar 10, 2024
1 parent 33aab8c commit d0b32f1
Show file tree
Hide file tree
Showing 14 changed files with 101 additions and 295 deletions.
4 changes: 0 additions & 4 deletions .github/workflow_data/commit.sh

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflow_data/package.sh

This file was deleted.

13 changes: 0 additions & 13 deletions .github/workflow_data/version.sh

This file was deleted.

36 changes: 0 additions & 36 deletions .github/workflow_data/webupdater.py

This file was deleted.

81 changes: 61 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,99 @@
name: 'Build'
name: "Build"

on:
push:
branches:
- dev
- main
tags:
- '*'
- "*"
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
TARGETS: f7
DEFAULT_TARGET: f7
FBT_GIT_SUBMODULE_SHALLOW: 1

jobs:
build:
main:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [f7]
steps:

- name: 'Checkout code'
- name: "Checkout code"
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: 1
ref: ${{ github.event.pull_request.head.sha }}

- name: "Read version tag"
run: bash .github/workflow_data/commit.sh
- name: "Get commit details"
id: names
run: |
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 "TARGET=${{ matrix.target }}" >> $GITHUB_ENV
echo "TARGET_HW=$(echo "${{ matrix.target }}" | sed 's/f//')" >> $GITHUB_ENV
- name: 'Build the firmware'
- name: "Check API versions for consistency between targets"
run: |
set -e
for TARGET in ${TARGETS}; do
TARGET_HW="$(echo "${TARGET}" | sed 's/f//')"; \
./fbt TARGET_HW=$TARGET_HW DIST_SUFFIX=$VERSION_TAG updater_package
done
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: "Build the firmware and apps"
id: build-fw
run: |
./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"
run: |
git diff --exit-code
- name: 'Dist artifact'
- name: "Upload artifacts to GitHub"
uses: actions/upload-artifact@v3
with:
name: dist
path: |
dist/${{ env.DEFAULT_TARGET }}-*/
dist/${TARGET}-*/flipper-z-${TARGET}-update-*
dist/${TARGET}-*/flipper-z-${TARGET}-sdk-*
- name: "Make tgz, zip and sdk"
run: bash .github/workflow_data/package.sh
- name: "Copy build output"
run: |
set -e
rm -rf artifacts || true
mkdir artifacts
cp dist/${TARGET}-*/flipper-z-${TARGET}-{update,sdk}-* artifacts/
cd dist/${TARGET}-*/${TARGET}-update-*/
artifact="$basename "$(realpath .)")"
7z a ../../../artifacts/flipper-z-${artifact}.zip .
- name: "Upload artifacts to update server"
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
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: Send devbuild webhook
# if: "github.event_name == 'push' && github.ref_name == 'dev' && !contains(github.event.head_commit.message, '--nobuild')"
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: 'Lint'
name: "Lint"

on:
push:
branches:
- dev
- main
tags:
- '*'
- "*"
pull_request:

env:
Expand All @@ -16,12 +16,11 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:

- name: 'Checkout code'
- name: "Checkout code"
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: 'Check code formatting'
- name: "Check code formatting"
run: ./fbt lint lint_py
27 changes: 27 additions & 0 deletions .github/workflows/reindex.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Post-release hooks"

on:
release:
types: [prereleased, released]

jobs:
reindex:
name: "Post-release hooks"
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@v4

- name: "Trigger reindex"
run: |
curl --fail -L -H "Token: ${{ secrets.INDEXER_TOKEN }}" \
"${{ secrets.INDEXER_URL }}"/firmware/reindex;
# - name: "Send release notification"
# if: ${{ github.event.action == 'released' }}
# run: |
# echo '${{ secrets.FIREBASE_TOKEN }}' > firebase-token.json;
# python3 -m pip install firebase-admin==6.4.0;
# python3 scripts/send_firebase_notification.py \
# "--version=${{ github.event.release.name }}" \
# "--token=firebase-token.json";
83 changes: 0 additions & 83 deletions .github/workflows/release.yml

This file was deleted.

Loading

0 comments on commit d0b32f1

Please sign in to comment.