rusefi/.github/workflows/custom-board-build.yaml

194 lines
6.5 KiB
YAML
Raw Normal View History

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:
shortBoardName:
required: true
type: string
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-01-10 10:10:38 -08:00
relative_board_dir:
required: false
type: string
default: ../..
2023-12-01 20:46:13 -08:00
jobs:
create-board:
runs-on: ubuntu-latest
steps:
- name: Set Token
run: |
if ! [[ -z "${{ inputs.token }}" ]]; then
echo "Got token input"
echo "TOKEN=${{ inputs.token }}" >> "$GITHUB_ENV"
elif ! [[ -z "${{ secrets.MY_REPO_PAT }}" ]]; then
echo "Using current secret"
echo "TOKEN=${{ secrets.MY_REPO_PAT }}" >> "$GITHUB_ENV"
else
echo "Using current token"
echo "TOKEN=${{ github.token }}" >> "$GITHUB_ENV"
fi
2023-12-01 20:46:13 -08:00
- name: Echo
run: |
echo "shortBoardName=${{inputs.shortBoardName}}"
2024-01-10 09:36:18 -08:00
echo "rusefi_dir=${{inputs.rusefi_dir}}"
2024-01-10 10:10:38 -08:00
echo "relative_board_dir=${{inputs.relative_board_dir}}"
2023-12-01 20:46:13 -08:00
- name: Set Env Variables
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
run: |
2024-01-10 10:10:38 -08:00
echo "META_OUTPUT_ROOT_FOLDER=../${{inputs.relative_board_dir}}/generated/" >> $GITHUB_ENV
echo "gha_shortBoardName=${{inputs.shortBoardName}}" >> $GITHUB_ENV
echo "gha_iniFileName=rusefi_${{inputs.shortBoardName}}.ini" >> $GITHUB_ENV
- uses: actions/checkout@v4
2023-12-01 20:46:13 -08:00
with:
token: ${{ env.TOKEN }}
2023-12-01 20:46:13 -08:00
submodules: recursive
- name: Invoking Post-Checkout Action
run: |
if [ -f .github/workflows/actions/post-checkout.sh ]; then
bash .github/workflows/actions/post-checkout.sh
fi
2023-12-01 20:46:13 -08:00
# Build machines don't have arm-none-eabi gcc, so let's download it and put it on the path
- name: Download & Install GCC
if: ${{ env.skip != 'true' }}
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
run: |
2024-01-10 09:34:12 -08:00
${{inputs.rusefi_dir}}/firmware/provide_gcc.sh
2023-12-01 20:46:13 -08:00
echo "::add-path::`pwd`/gcc-arm-none-eabi/bin"
- 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
- name: Gen Config
2024-01-10 09:34:12 -08:00
working-directory: ${{inputs.rusefi_dir}}/firmware
2023-12-01 20:46:13 -08:00
run: |
2024-01-10 10:10:38 -08:00
bash gen_config_board.sh ../${{inputs.relative_board_dir}} ${{env.gha_shortBoardName}}
2023-12-01 20:46:13 -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: |
if [ -d .git ]; then
git status
else
echo Not a repository
fi
2023-12-01 20:46:13 -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: |
if [ -d connectors ]; then
git add connectors/*
fi
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
echo "[$OUT]"
2023-12-03 10:31:28 -08:00
- name: Push
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
2023-12-01 20:46:13 -08:00
- name: Upload .ini files to server
working-directory: generated/tunerstudio/generated
2024-01-10 10:10:38 -08:00
run: ../../../${{inputs.rusefi_dir}}/firmware/tunerstudio/upload_ini.sh ${{env.gha_iniFileName}} ${{ secrets.RUSEFI_ONLINE_FTP_USER }} ${{ secrets.RUSEFI_ONLINE_FTP_PASS }} ${{ secrets.RUSEFI_FTP_SERVER }}
2023-12-01 20:46:13 -08:00
- name: Build Firmware
2024-01-10 10:10:38 -08:00
working-directory: ${{inputs.rusefi_dir}}
run: bash misc/jenkins/compile_other_versions/compile.sh ../${{inputs.relative_board_dir}} ${{env.gha_shortBoardName}}
2023-12-01 20:46:13 -08:00
- name: Upload build bin artifact
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
- name: Upload build hex artifact
uses: actions/upload-artifact@v4
2023-12-01 20:46:13 -08:00
with:
name: rusefi.hex
2024-01-10 10:10:38 -08:00
path: ${{inputs.rusefi_dir}}/firmware/deliver/rusefi*.hex
2023-12-01 20:46:13 -08:00
- name: Upload build map artifact
uses: actions/upload-artifact@v4
2023-12-01 20:46:13 -08:00
with:
name: rusefi.map
2024-01-10 10:10:38 -08:00
path: ${{inputs.rusefi_dir}}/firmware/deliver/rusefi*.map
2023-12-01 20:46:13 -08:00
- name: Build console
2024-01-10 10:10:38 -08:00
working-directory: ${{inputs.rusefi_dir}}
2023-12-01 20:46:13 -08:00
run: bash misc/jenkins/build_java_console.sh
- name: Set 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: Package and Upload Bundle
2024-01-10 10:10:38 -08:00
working-directory: ${{inputs.rusefi_dir}}
run: bash misc/jenkins/compile_other_versions/prepare_bundle.sh ${{env.gha_shortBoardName}} "${{inputs.relative_board_dir}}/generated/tunerstudio/generated/${{env.gha_iniFileName}}" master
2023-12-01 20:46:13 -08:00
- name: Upload bundle artifact
uses: actions/upload-artifact@v4
2023-12-01 20:46:13 -08:00
with:
name: rusefi_bundle_${{env.gha_shortBoardName}}.zip
2024-01-10 10:10:38 -08:00
path: ${{inputs.rusefi_dir}}/artifacts/rusefi_bundle*.zip