This repository has been archived by the owner on Jan 28, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Generic matrix build for cross-compile targets
Moved cross-compile configuration into matrix build configuration. Targets can be added with additional matrix configuration entries. The rest of the build is now generic. This allows to use the new Buildroot SDK in YIO-Remote/remote-os#3
- Loading branch information
Showing
1 changed file
with
51 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,6 @@ | |
|
||
env: | ||
APP_NAME: YIO-remote-software | ||
APP_ARCHITECTURE: RPi0 | ||
PROJECT_NAME: remote-software | ||
HASH_FILENAME: yio-remote-software.hash | ||
|
||
|
@@ -23,46 +22,61 @@ | |
matrix: | ||
config: | ||
- { | ||
name: "RPi0 Release Build", artifact: "RPi0-release", | ||
qmake-args: "CONFIG+=release" | ||
name: "remote-os v0.x Build", artifact: "RPi0-release", | ||
qmake-args: "CONFIG+=release", | ||
build-image: "zehnm/yio-crosscompile-action:1.1.0" | ||
} | ||
|
||
- { | ||
name: "remote-os v1.x Build", artifact: "RPi0-Qt5.12.8", | ||
qmake-args: "CONFIG+=release", | ||
build-image: "zehnm/yio-crosscompile-action:2.0.0" | ||
} | ||
|
||
steps: | ||
- name: github env vars | ||
run: | | ||
echo "$GITHUB_REF" | ||
echo "$GITHUB_HEAD_REF" | ||
echo "$GITHUB_BASE_REF" | ||
- name: Checkout ${{ env.PROJECT_NAME}} | ||
uses: actions/checkout@v2 | ||
with: | ||
# History of 500 should be more than enough to calculate commit count since last release tag. | ||
fetch-depth: 500 | ||
# Check out into sub folder, we also need the integrations.library at the same level! | ||
path: ${{ env.PROJECT_NAME}} | ||
|
||
- name: Fetch all tags to determine version | ||
# Used in cross compile step | ||
run: | | ||
cd ${{ env.PROJECT_NAME}} | ||
git fetch origin +refs/tags/*:refs/tags/* | ||
git describe --match "v[0-9]*" --tags HEAD --always | ||
- name: Set build timestamp | ||
run: echo "::set-env name=TIMESTAMP::$(date +"%Y%m%d_%H%M%S")" | ||
|
||
# Unfortunately we can't use a dynamic Action as in "uses: ${{ matrix.config.build-image }}" | ||
# - name: Cross compile | ||
# id: cross-compile | ||
# uses: zehnm/[email protected] | ||
# with: | ||
# project-name: ${{ env.PROJECT_NAME }} | ||
# output-path: ${GITHUB_WORKSPACE}/binaries/app | ||
# qmake-args: ${{ matrix.config.qmake-args }} | ||
# | ||
# So let's do it manually :-( Maybe one day we'll get that feature from GitHub... | ||
- name: Cross compile | ||
id: cross-compile | ||
uses: zehnm/[email protected] | ||
with: | ||
project-name: ${{ env.PROJECT_NAME }} | ||
output-path: ${GITHUB_WORKSPACE}/binaries/app | ||
qmake-args: ${{ matrix.config.qmake-args }} | ||
|
||
run: | | ||
docker pull ${{ matrix.config.build-image }} | ||
docker run --workdir /github/workspace --rm \ | ||
-e GITHUB_WORKSPACE=/github/workspace \ | ||
-v /home/runner/work/${{ env.PROJECT_NAME}}/${{ env.PROJECT_NAME}}:/github/workspace \ | ||
${{ matrix.config.build-image }} ${{ env.PROJECT_NAME}} /github/workspace/binaries/app ${{ matrix.config.qmake-args }} https://github.com/YIO-Remote/integrations.library.git . | ||
- name: Get artifact version | ||
run: | | ||
read -r APP_VERSION < binaries/version.txt | ||
echo "::set-env name=APP_VERSION::$APP_VERSION" | ||
- name: Upload build artefacts | ||
uses: actions/upload-artifact@v1 | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
path: binaries | ||
name: ${{ env.APP_NAME }}-${{ matrix.config.artifact }} | ||
name: ${{ env.APP_NAME }}-v${{ env.APP_VERSION }}-${{ matrix.config.artifact }} | ||
if-no-files-found: error | ||
|
||
release: | ||
name: Create Release | ||
|
@@ -71,49 +85,47 @@ | |
needs: build | ||
|
||
steps: | ||
- run: mkdir release | ||
- name: Download release artifact | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: ${{ env.APP_NAME }}-${{ env.APP_ARCHITECTURE }}-release | ||
path: ./release | ||
- name: Download build artifacts | ||
uses: actions/download-artifact@v2 | ||
|
||
- name: Get artifact version | ||
- name: Display structure of downloaded files | ||
run: ls -R | ||
|
||
- name: Get timestamp | ||
run: | | ||
read -r APP_VERSION < release/version.txt | ||
echo "::set-env name=APP_VERSION::$APP_VERSION" | ||
echo "::set-env name=TIMESTAMP::$(date +"%Y%m%d_%H%M%S")" | ||
- name: Create GitHub development build archives | ||
if: "!contains(github.ref, 'tags/v')" | ||
run: | | ||
tar cvf ${{ env.APP_NAME }}-v${{ env.APP_VERSION }}-${{ env.TIMESTAMP }}-${{ env.APP_ARCHITECTURE }}-release.tar -C release . | ||
for D in *; do if [ -d "${D}" ]; then tar cvf $D-${{ env.TIMESTAMP }}.tar -C $D .; fi; done; | ||
for filename in *.tar; do echo "sha256 `sha256sum $filename`" >> ${{ env.HASH_FILENAME }}; done; | ||
- name: Create Pre-Release ${{ env.APP_VERSION }} | ||
- name: Create Pre-Release | ||
uses: "marvinpinto/action-automatic-releases@latest" | ||
if: "!contains(github.ref, 'tags/v')" | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
automatic_release_tag: "latest" | ||
prerelease: true | ||
title: "Development Build ${{ env.APP_VERSION }}" | ||
title: "Development Build" | ||
files: | | ||
*.tar | ||
${{ env.HASH_FILENAME }} | ||
- name: Create GitHub release archives | ||
if: "contains(github.ref, 'tags/v')" | ||
run: | | ||
tar cvf ${{ env.APP_NAME }}-v${{ env.APP_VERSION }}-${{ env.APP_ARCHITECTURE }}-release.tar -C release . | ||
for D in *; do if [ -d "${D}" ]; then tar cvf $D.tar -C $D .; fi; done; | ||
for filename in *.tar; do echo "sha256 `sha256sum $filename`" >> ${{ env.HASH_FILENAME }}; done; | ||
- name: Create Release ${{ env.APP_VERSION }} | ||
- name: Create Release | ||
uses: "marvinpinto/action-automatic-releases@latest" | ||
if: "contains(github.ref, 'tags/v')" | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
prerelease: false | ||
files: | | ||
*.tar | ||
${{ env.HASH_FILENAME }} | ||
*.tar | ||
${{ env.HASH_FILENAME }} | ||