buildbrain/.github/workflows/build.yml
2021-03-22 22:41:50 +09:00

174 lines
6.0 KiB
YAML

name: Build
on:
push:
branches: ci*
tags: '*'
jobs:
create_release:
name: Create release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Generate release name
id: release_name
# https://github.community/t/how-to-get-just-the-tag-name/16241/4
run: echo ::set-output name=name::${GITHUB_REF/refs\/*s\//}
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.release_name.outputs.name }}
release_name: ${{ steps.release_name.outputs.name }}
body: |
Build ${{ steps.release_name.outputs.name }}
draft: false
prerelease: true
build-linux:
runs-on: ubuntu-20.04
needs: [create_release]
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Workaround for apt update failure
run: sudo rm /etc/apt/sources.list.d/github_git-lfs.*
- name: Install deps
run: sudo apt update && sudo apt install build-essential bison flex libncurses5-dev gcc-arm-linux-gnueabi qemu-user-static debootstrap python3-pip
- name: Upgrade pip and setuptools
run: pip3 install -U pip setuptools
- name: Install listconfig
run: pip3 install listconfig
- name: Configure for Linux
run: make ldefconfig
- name: Build Linux
run: make lbuild
- name: Setup releases
id: release_name
run: |
mkdir release
cp ./linux-brain/arch/arm/boot/dts/imx28-pwsh*.dtb release/
cp ./linux-brain/arch/arm/boot/zImage release/zImage
zip -r release.zip release/
- name: Generate archive name
id: archive_name
run: echo ::set-output name=name::linux-${GITHUB_REF/refs\/*s\//}
- name: Upload release.zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: release.zip
asset_name: ${{ steps.archive_name.outputs.name }}.zip
asset_content_type: application/zip
- name: Generate listconfig
run: listconfig ./linux-brain/Kconfig ./linux-brain/.config > listconfig
- name: Upload listconfig
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: listconfig
asset_name: listconfig
asset_content_type: text/plain
build-uboot:
runs-on: ubuntu-20.04
needs: [create_release]
strategy:
matrix:
include:
- model: sh1
nk: edsa1exe.bin
- model: sh2
nk: edsa2exe.bin
- model: sh3
nk: edsa3exe.bin
- model: sh4
nk: edsh4exe.bin
- model: sh5
nk: edsh5exe.bin
- model: sh6
nk: edsh6exe.bin
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Workaround for apt update failure
run: sudo rm /etc/apt/sources.list.d/github_git-lfs.*
- name: Install deps
run: sudo apt update && sudo apt install build-essential bison flex libncurses5-dev gcc-arm-linux-gnueabi qemu-user-static debootstrap
- name: Build nkbin-maker
run: make nkbin-maker
- name: Configure for U-Boot
run: make udefconfig-${{ matrix.model }}
- name: Build U-Boot
run: make ubuild
- name: Generate NK.bin
run: make nk.bin
- name: Setup releases
id: release_name
run: |
mkdir release
cp ./u-boot-brain/u-boot.bin release/u-boot.bin
cp ./u-boot-brain/u-boot.sb release/u-boot.sb
cp ./nk.bin release/${{ matrix.nk }}
zip -r release.zip release/
- name: Generate archive name
id: archive_name
run: echo ::set-output name=name::uboot-${{ matrix.model }}-${GITHUB_REF/refs\/*s\//}
- name: Upload release.zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: release.zip
asset_name: ${{ steps.archive_name.outputs.name }}.zip
asset_content_type: application/zip
build-sd:
runs-on: ubuntu-20.04
needs: [create_release]
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Workaround for apt update failure
run: sudo rm /etc/apt/sources.list.d/github_git-lfs.*
- name: Install deps
run: sudo apt update && sudo apt install kpartx build-essential bison flex libncurses5-dev gcc-arm-linux-gnueabi qemu-user-static debootstrap
- name: Configure for Linux
run: make ldefconfig
- name: Build Linux
run: make lbuild
- name: Build Debian Root
run: make brainux
- name: Build bsd-ce
run: make -C nkbin_maker bsd-ce
- name: Generate image name
id: image_name
run: echo ::set-output name=name::sdimage-${GITHUB_REF/refs\/*s\//}
- name: Build SD image
run: make image/sd.img && mv image/sd.img ${{ steps.image_name.outputs.name }}.img
- name: Compress
run: zip ${{ steps.image_name.outputs.name }}.zip ${{ steps.image_name.outputs.name }}.img
- name: Upload the image
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ${{ steps.image_name.outputs.name }}.zip
asset_name: ${{ steps.image_name.outputs.name }}.zip
asset_content_type: application/zip