# https://docs.gitea.com/usage/actions/overview
# https://github.com/marketplace?type=actions
# https://gitea.com/actions
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
name: Push Branch
on:
  push:
    branches:
      - '**'

jobs:
  Build_Test:
    name: Build Test
    runs-on: ubuntu-latest
    steps:

      # https://github.com/actions/checkout
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
          fetch-tags: true

      - name: Dev Tools Cache
        uses: actions/cache@v3
        with:
          path: |
            ~/.xpack-dev-tools
            /usr/bin/xxd
            /usr/bin/srec_cat
            /lib/x86_64-linux-gnu/libsrecord.so.0.0.0
            /lib/x86_64-linux-gnu/libsrecord.so.0
          key: ${{ runner.os }}-xpack-dev-tools-xxd-srecord

      - name: Dev Tools install
        run: sys/install.sh

      - name: Build M2 Debug
        if: success() || failure()
        run: . sys/export.sh; make -e MODEL=M2 debug

      - name: Build M2 Release
        if: success() || failure()
        run: . sys/export.sh; make -e MODEL=M2 release

      - name: Build M3 Debug
        if: success() || failure()
        run: . sys/export.sh; make -e MODEL=M3 debug

      - name: Build M3 Release
        if: success() || failure()
        run: . sys/export.sh; make -e MODEL=M3 release

      - name: Changelog
        if: success() || failure()
        run: sys/changelog.sh; cat CHANGELOG.md
