Update workflows

This commit is contained in:
Willy-JL
2023-03-07 22:23:19 +00:00
parent 07edb7eea8
commit 38fb1c8047
8 changed files with 61 additions and 300 deletions

View File

@@ -1,10 +1,10 @@
name: 'Build'
name: 'Build artifact'
on:
push:
branches:
- dev
- "release*"
- main
tags:
- '*'
pull_request:
@@ -12,17 +12,11 @@ on:
env:
TARGETS: f7
DEFAULT_TARGET: f7
FBT_TOOLCHAIN_PATH: /home/runner/work
jobs:
main:
build:
runs-on: ubuntu-latest
steps:
- name: 'Decontaminate previous build leftovers'
run: |
if [ -d .git ]; then
git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)"
fi
- name: 'Checkout code'
uses: actions/checkout@v3
@@ -30,78 +24,24 @@ jobs:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: 'Get commit details'
id: names
run: |
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"
echo random_hash=$(openssl rand -base64 40 | shasum -a 256 | awk '{print $1}') >> $GITHUB_OUTPUT
echo "event_type=$TYPE" >> $GITHUB_OUTPUT
- name: 'Make artifacts directory'
run: |
rm -rf artifacts
rm -rf map_analyser_files
mkdir artifacts
mkdir map_analyser_files
- name: 'Bundle scripts'
run: |
tar czpf artifacts/flipper-z-any-scripts-${SUFFIX}.tgz scripts debug
- name: 'Build the firmware'
run: |
set -e
for TARGET in ${TARGETS}; do
TARGET="$(echo "${TARGET}" | sed 's/f//')"; \
./fbt TARGET_HW=$TARGET copro_dist updater_package \
${{ startsWith(github.ref, 'refs/tags') && 'DEBUG=0 COMPACT=1' || '' }}
done
- name: 'Move upload files'
run: |
set -e
for TARGET in ${TARGETS}; do
mv dist/${TARGET}-*/* artifacts/
./fbt TARGET_HW=$TARGET updater_package
done
- name: "Check for uncommitted changes"
run: |
git diff --exit-code
- name: 'Bundle resources'
run: |
tar czpf "artifacts/flipper-z-any-resources-${SUFFIX}.tgz" -C assets resources
- name: 'Bundle core2 firmware'
run: |
cp build/core2_firmware.tgz "artifacts/flipper-z-any-core2_firmware-${SUFFIX}.tgz"
- name: 'Copy map analyser files'
run: |
cp build/f7-firmware-*/firmware.elf.map map_analyser_files/firmware.elf.map
cp build/f7-firmware-*/firmware.elf map_analyser_files/firmware.elf
cp ${{ github.event_path }} map_analyser_files/event.json
- name: 'Updater artifact'
uses: actions/upload-artifact@v3
with:
name: updater
path: |
artifacts/f7-*
- name: 'Firmware artifact'
uses: actions/upload-artifact@v3
with:
name: firmware
path: |
artifacts
dist/${{ env.DEFAULT_TARGET }}-*
# - name: 'Find Previous Comment'
# if: ${{ github.event.pull_request }}
@@ -110,7 +50,7 @@ jobs:
# with:
# issue-number: ${{ github.event.pull_request.number }}
# comment-author: 'github-actions[bot]'
# body-includes: 'Compiled firmware for commit'
# body-includes: 'Compiled firmware:'
# - name: Artifact info
# id: artifact-info
@@ -125,44 +65,6 @@ jobs:
# comment-id: ${{ steps.fc.outputs.comment-id }}
# issue-number: ${{ github.event.pull_request.number }}
# body: |
# **Compiled firmware for commit `${{steps.names.outputs.commit_sha}}`:**
# **Compiled firmware:**
# - [📦 Update package](${{steps.artifact-info.outputs.artifacts[0].archive_download_url}})
# edit-mode: replace
compact:
if: ${{ !startsWith(github.ref, 'refs/tags') }}
runs-on: ubuntu-latest
steps:
- name: 'Decontaminate previous build leftovers'
run: |
if [ -d .git ]
then
git submodule status \
|| git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)"
fi
- name: 'Checkout code'
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
ref: ${{ github.event.pull_request.head.sha }}
- name: 'Get commit details'
run: |
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"
- name: 'Build the firmware'
run: |
set -e
for TARGET in ${TARGETS}; do
TARGET="$(echo "${TARGET}" | sed 's/f//')"; \
./fbt TARGET_HW=$TARGET DEBUG=0 COMPACT=1 fap_dist updater_package
done