2023-12-01 20:46:13 -08:00
|
|
|
#
|
|
|
|
# see https://github.com/rusefi/fw-Paralela/blob/master/.github/workflows/compile-board.yaml as an example of how to build custom board firmware
|
|
|
|
#
|
|
|
|
|
|
|
|
name: Build Custom Board Firmware
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
2023-12-23 18:07:24 -08:00
|
|
|
token:
|
|
|
|
description: 'Token for accessing private repos'
|
|
|
|
required: false
|
|
|
|
type: string
|
2024-01-10 09:34:12 -08:00
|
|
|
rusefi_dir:
|
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
default: ext/rusefi
|
2024-02-17 13:38:10 -08:00
|
|
|
board_dir:
|
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
default: .
|
|
|
|
bundle_name:
|
2024-01-10 10:10:38 -08:00
|
|
|
required: false
|
|
|
|
type: string
|
2024-02-07 13:15:19 -08:00
|
|
|
secrets:
|
|
|
|
MY_REPO_PAT:
|
2024-02-08 10:23:53 -08:00
|
|
|
required: false
|
2024-02-07 13:15:19 -08:00
|
|
|
RUSEFI_ONLINE_FTP_USER:
|
|
|
|
required: false
|
|
|
|
RUSEFI_ONLINE_FTP_PASS:
|
|
|
|
required: false
|
|
|
|
RUSEFI_FTP_SERVER:
|
|
|
|
required: false
|
|
|
|
RUSEFI_SSH_SERVER:
|
|
|
|
required: false
|
|
|
|
RUSEFI_SSH_USER:
|
|
|
|
required: false
|
|
|
|
RUSEFI_SSH_PASS:
|
|
|
|
required: false
|
|
|
|
ADDITIONAL_ENV:
|
2024-02-05 12:43:26 -08:00
|
|
|
required: false
|
2023-12-01 20:46:13 -08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
create-board:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2023-12-23 18:07:24 -08:00
|
|
|
- name: Set Token
|
|
|
|
run: |
|
|
|
|
if ! [[ -z "${{ inputs.token }}" ]]; then
|
|
|
|
echo "Got token input"
|
|
|
|
echo "TOKEN=${{ inputs.token }}" >> "$GITHUB_ENV"
|
2023-12-23 22:05:42 -08:00
|
|
|
elif ! [[ -z "${{ secrets.MY_REPO_PAT }}" ]]; then
|
2023-12-23 18:07:24 -08:00
|
|
|
echo "Using current secret"
|
|
|
|
echo "TOKEN=${{ secrets.MY_REPO_PAT }}" >> "$GITHUB_ENV"
|
2023-12-23 22:05:42 -08:00
|
|
|
else
|
|
|
|
echo "Using current token"
|
|
|
|
echo "TOKEN=${{ github.token }}" >> "$GITHUB_ENV"
|
2023-12-23 18:07:24 -08:00
|
|
|
fi
|
|
|
|
|
2023-12-01 20:46:13 -08:00
|
|
|
- name: Echo
|
|
|
|
run: |
|
2024-02-17 13:38:10 -08:00
|
|
|
echo "bundle_name=${{inputs.bundle_name}}"
|
2024-01-10 09:36:18 -08:00
|
|
|
echo "rusefi_dir=${{inputs.rusefi_dir}}"
|
2024-02-17 13:38:10 -08:00
|
|
|
echo "board_dir=${{inputs.board_dir}}"
|
2023-12-20 07:45:25 -08:00
|
|
|
|
2024-02-17 16:02:46 -08:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
token: ${{ env.TOKEN }}
|
|
|
|
submodules: recursive
|
|
|
|
|
2023-12-23 18:07:24 -08:00
|
|
|
- name: Invoking Post-Checkout Action
|
|
|
|
run: |
|
|
|
|
if [ -f .github/workflows/actions/post-checkout.sh ]; then
|
|
|
|
bash .github/workflows/actions/post-checkout.sh
|
|
|
|
fi
|
|
|
|
|
2024-02-17 13:38:10 -08:00
|
|
|
- name: Set Env Variables
|
|
|
|
env:
|
|
|
|
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
|
|
|
|
run: |
|
|
|
|
echo "REF=${{github.ref_name}}" >> $GITHUB_ENV
|
|
|
|
ROOT_DIR="../$(echo ${{inputs.rusefi_dir}} | sed -E 's/[^/]{2,}/../g')"
|
|
|
|
cd ${{inputs.rusefi_dir}}/firmware
|
|
|
|
BOARD_DIR=$(realpath --relative-to=. "$ROOT_DIR/${{inputs.board_dir}}")
|
|
|
|
BOARD_META_PATH=$(bash bin/find_meta_info.sh "$BOARD_DIR" "${{inputs.bundle_name}}")
|
|
|
|
source config/boards/common_script_read_meta_env.inc "$BOARD_META_PATH"
|
|
|
|
echo "BOARD_META_PATH=$BOARD_META_PATH" >> $GITHUB_ENV
|
|
|
|
echo "BOARD_DIR=$BOARD_DIR" >> $GITHUB_ENV
|
|
|
|
echo "SHORT_BOARD_NAME=$SHORT_BOARD_NAME" >> $GITHUB_ENV
|
|
|
|
echo "BUNDLE_NAME=$SHORT_BOARD_NAME" >> $GITHUB_ENV
|
|
|
|
cd ..
|
2024-02-18 06:25:16 -08:00
|
|
|
echo "META_OUTPUT_ROOT_FOLDER=$(realpath firmware/$BOARD_DIR/generated)/" >> $GITHUB_ENV
|
2024-02-17 13:38:10 -08:00
|
|
|
echo "${{ secrets.ADDITIONAL_ENV }}" >> $GITHUB_ENV
|
2024-02-05 17:15:36 -08:00
|
|
|
echo "BUNDLE_SIMULATOR=no" >> $GITHUB_ENV
|
2024-02-17 13:38:10 -08:00
|
|
|
|
2024-02-27 04:56:38 -08:00
|
|
|
- name: Install Arm GNU Toolchain (arm-none-eabi-gcc)
|
2023-12-01 20:46:13 -08:00
|
|
|
if: ${{ env.skip != 'true' }}
|
2024-02-27 04:56:38 -08:00
|
|
|
uses: carlosperate/arm-none-eabi-gcc-action@v1
|
|
|
|
with:
|
|
|
|
release: '12.3.Rel1'
|
2023-12-01 20:46:13 -08:00
|
|
|
|
|
|
|
- uses: actions/setup-java@v4
|
|
|
|
with:
|
|
|
|
distribution: 'zulu'
|
|
|
|
java-version: '11'
|
|
|
|
|
|
|
|
- name: Test Compiler
|
|
|
|
run: javac -version
|
|
|
|
|
|
|
|
- name: Install Tools
|
|
|
|
run: |
|
2024-01-10 10:10:38 -08:00
|
|
|
sudo bash ${{inputs.rusefi_dir}}/misc/actions/add-ubuntu-latest-apt-mirrors.sh
|
2023-12-01 20:46:13 -08:00
|
|
|
sudo apt-get install sshpass sshpass mtools
|
|
|
|
|
2023-12-20 06:59:25 -08:00
|
|
|
- name: Repo Status
|
|
|
|
run: |
|
|
|
|
git status
|
|
|
|
|
2024-01-10 10:10:38 -08:00
|
|
|
- name: rusefi_dir Status
|
|
|
|
working-directory: ${{inputs.rusefi_dir}}
|
2023-12-01 20:46:13 -08:00
|
|
|
run: |
|
2023-12-23 18:07:24 -08:00
|
|
|
if [ -d .git ]; then
|
|
|
|
git status
|
|
|
|
else
|
|
|
|
echo Not a repository
|
|
|
|
fi
|
2023-12-01 20:46:13 -08:00
|
|
|
|
2024-02-06 19:17:06 -08:00
|
|
|
- name: Configs build_server upload SSH variables
|
|
|
|
env:
|
|
|
|
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
|
|
|
|
run: |
|
|
|
|
if [ "${{github.event_name}}" = "push" ] && [ "${{github.ref}}" = "refs/heads/master" ]; then
|
|
|
|
echo "Setting credentials..."
|
|
|
|
echo "RUSEFI_SSH_SERVER=${{secrets.RUSEFI_SSH_SERVER}}" >> $GITHUB_ENV
|
|
|
|
echo "RUSEFI_SSH_USER=${{secrets.RUSEFI_SSH_USER}}" >> $GITHUB_ENV
|
|
|
|
echo "RUSEFI_SSH_PASS=${{secrets.RUSEFI_SSH_PASS}}" >> $GITHUB_ENV
|
|
|
|
else
|
|
|
|
echo "NOT setting credentials: ${{github.event_name}} ${{github.ref}}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Build Firmware
|
|
|
|
working-directory: ${{inputs.rusefi_dir}}/firmware
|
2024-02-27 17:22:35 -08:00
|
|
|
run: bash bin/compile.sh ${{env.BOARD_META_PATH}} all deliver/rusefi.bin
|
2024-02-06 19:17:06 -08:00
|
|
|
|
2024-02-27 17:08:34 -08:00
|
|
|
- name: Upload Bundle
|
|
|
|
working-directory: ${{inputs.rusefi_dir}}/firmware
|
|
|
|
run: bash ../firmware/bin/upload_bundle.sh
|
|
|
|
|
2023-12-20 06:59:25 -08:00
|
|
|
- name: Push Config
|
|
|
|
run: |
|
|
|
|
git config --local user.email "action@github.com"
|
|
|
|
git config --local user.name "GitHub git update Action"
|
|
|
|
git add generated/*
|
|
|
|
OUT=$(git commit -am "GHA Automation" 2>&1) || echo "commit failed, finding out why"
|
|
|
|
if echo "$OUT" | grep 'nothing to commit'; then
|
|
|
|
echo "Configs: looks like nothing to commit"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
git status
|
2023-12-01 21:30:20 -08:00
|
|
|
|
2023-12-03 10:31:28 -08:00
|
|
|
- name: Connectors Status
|
|
|
|
run: |
|
|
|
|
git status
|
|
|
|
|
|
|
|
- name: Push Connectors
|
|
|
|
run: |
|
2023-12-15 13:42:36 -08:00
|
|
|
if [ -d connectors ]; then
|
|
|
|
git add connectors/*
|
|
|
|
fi
|
2023-12-04 07:15:00 -08:00
|
|
|
OUT=$(git commit -am "GHA Connectors Generated" 2>&1) || echo "commit failed, finding out why"
|
|
|
|
if echo "$OUT" | grep 'nothing to commit'; then
|
|
|
|
echo "Connectors: looks like nothing to commit"
|
|
|
|
exit 0
|
|
|
|
fi
|
2023-12-04 07:21:07 -08:00
|
|
|
echo "[$OUT]"
|
2023-12-03 10:31:28 -08:00
|
|
|
|
|
|
|
- name: Push
|
|
|
|
uses: ad-m/github-push-action@master
|
|
|
|
with:
|
|
|
|
github_token: ${{ github.token }}
|
|
|
|
|
2024-02-25 09:03:40 -08:00
|
|
|
- name: Upload .ini files to rusEFI Online server
|
2023-12-20 08:08:46 -08:00
|
|
|
working-directory: generated/tunerstudio/generated
|
2024-02-18 04:57:52 -08:00
|
|
|
run: ../../../${{inputs.rusefi_dir}}/firmware/tunerstudio/upload_ini.sh ${{ secrets.RUSEFI_ONLINE_FTP_USER }} ${{ secrets.RUSEFI_ONLINE_FTP_PASS }} ${{ secrets.RUSEFI_FTP_SERVER }}
|
2023-12-01 20:46:13 -08:00
|
|
|
|
2024-02-25 09:03:40 -08:00
|
|
|
- name: Upload github action bin artifact
|
2023-12-15 00:37:05 -08:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-12-01 20:46:13 -08:00
|
|
|
with:
|
|
|
|
name: rusefi.bin
|
2024-01-10 10:10:38 -08:00
|
|
|
path: ${{inputs.rusefi_dir}}/firmware/deliver/rusefi*.bin
|
2023-12-01 20:46:13 -08:00
|
|
|
|
2024-02-25 09:03:40 -08:00
|
|
|
- name: Upload github action srec artifact
|
2024-02-03 17:46:14 -08:00
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: rusefi_update.srec
|
|
|
|
path: ${{inputs.rusefi_dir}}/firmware/build/rusefi.srec
|
|
|
|
|
2024-02-25 09:03:40 -08:00
|
|
|
- name: Upload github action hex artifact
|
2023-12-15 00:37:05 -08:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-12-01 20:46:13 -08:00
|
|
|
with:
|
|
|
|
name: rusefi.hex
|
2024-02-05 17:15:36 -08:00
|
|
|
path: ${{inputs.rusefi_dir}}/firmware/build/rusefi*.hex
|
2023-12-01 20:46:13 -08:00
|
|
|
|
2024-02-25 09:03:40 -08:00
|
|
|
- name: Upload github action list artifact
|
2024-01-30 10:11:49 -08:00
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: rusefi.list
|
2024-02-03 17:46:14 -08:00
|
|
|
path: ${{inputs.rusefi_dir}}/firmware/build/rusefi*.list
|
2024-01-30 10:11:49 -08:00
|
|
|
|
2024-02-25 09:03:40 -08:00
|
|
|
- name: Upload github action map artifact
|
2023-12-15 00:37:05 -08:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-12-01 20:46:13 -08:00
|
|
|
with:
|
|
|
|
name: rusefi.map
|
2024-02-03 17:46:14 -08:00
|
|
|
path: ${{inputs.rusefi_dir}}/firmware/build/rusefi*.map
|
2023-12-01 20:46:13 -08:00
|
|
|
|
2024-02-25 09:03:40 -08:00
|
|
|
- name: Upload github action elf artifact
|
2024-01-29 19:43:49 -08:00
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: rusefi.elf
|
2024-02-03 17:46:14 -08:00
|
|
|
path: ${{inputs.rusefi_dir}}/firmware/build/rusefi*.elf
|
2024-01-29 19:43:49 -08:00
|
|
|
|
2024-02-25 09:03:40 -08:00
|
|
|
- name: Upload github action bundle artifact
|
2023-12-15 00:37:05 -08:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-12-01 20:46:13 -08:00
|
|
|
with:
|
2024-02-17 13:38:10 -08:00
|
|
|
name: rusefi_bundle_${{env.SHORT_BOARD_NAME}}.zip
|
2024-01-10 10:10:38 -08:00
|
|
|
path: ${{inputs.rusefi_dir}}/artifacts/rusefi_bundle*.zip
|