Skip to content
This repository was archived by the owner on Jan 28, 2022. It is now read-only.

Commit b30383f

Browse files
committed
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
1 parent f4d210a commit b30383f

File tree

1 file changed

+51
-33
lines changed

1 file changed

+51
-33
lines changed

.github/workflows/build.yml

+51-33
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
env:
1313
APP_NAME: YIO-integration.openhab
14-
APP_ARCHITECTURE: RPi0
1514
PROJECT_NAME: integration.openhab
1615
HASH_FILENAME: yio-integration-openhab.hash
1716

@@ -23,40 +22,61 @@
2322
matrix:
2423
config:
2524
- {
26-
name: "RPi0 Release Build", artifact: "RPi0-release",
27-
qmake-args: "CONFIG+=release"
25+
name: "remote-os v0.x Build", artifact: "RPi0-release",
26+
qmake-args: "CONFIG+=release",
27+
build-image: "zehnm/yio-crosscompile-action:1.1.0"
2828
}
29-
29+
- {
30+
name: "remote-os v1.x Build", artifact: "RPi0-Qt5.12.8",
31+
qmake-args: "CONFIG+=release",
32+
build-image: "zehnm/yio-crosscompile-action:2.0.0"
33+
}
34+
3035
steps:
3136
- name: Checkout ${{ env.PROJECT_NAME}}
3237
uses: actions/checkout@v2
3338
with:
3439
# History of 500 should be more than enough to calculate commit count since last release tag.
3540
fetch-depth: 500
41+
# Check out into sub folder, we also need the integrations.library at the same level!
3642
path: ${{ env.PROJECT_NAME}}
3743

3844
- name: Fetch all tags to determine version
45+
# Used in cross compile step
3946
run: |
4047
cd ${{ env.PROJECT_NAME}}
4148
git fetch origin +refs/tags/*:refs/tags/*
4249
git describe --match "v[0-9]*" --tags HEAD --always
4350
44-
- name: Set build timestamp
45-
run: echo "::set-env name=TIMESTAMP::$(date +"%Y%m%d_%H%M%S")"
46-
51+
# Unfortunately we can't use a dynamic Action as in "uses: ${{ matrix.config.build-image }}"
52+
# - name: Cross compile
53+
# id: cross-compile
54+
# uses: zehnm/[email protected]
55+
# with:
56+
# project-name: ${{ env.PROJECT_NAME }}
57+
# output-path: ${GITHUB_WORKSPACE}/binaries/app
58+
# qmake-args: ${{ matrix.config.qmake-args }}
59+
#
60+
# So let's do it manually :-( Maybe one day we'll get that feature from GitHub...
4761
- name: Cross compile
48-
id: cross-compile
49-
uses: zehnm/[email protected]
50-
with:
51-
project-name: ${{ env.PROJECT_NAME }}
52-
output-path: ${GITHUB_WORKSPACE}/binaries/app
53-
qmake-args: ${{ matrix.config.qmake-args }}
54-
62+
run: |
63+
docker pull ${{ matrix.config.build-image }}
64+
docker run --workdir /github/workspace --rm \
65+
-e GITHUB_WORKSPACE=/github/workspace \
66+
-v /home/runner/work/${{ env.PROJECT_NAME}}/${{ env.PROJECT_NAME}}:/github/workspace \
67+
${{ matrix.config.build-image }} ${{ env.PROJECT_NAME}} /github/workspace/binaries/app ${{ matrix.config.qmake-args }} https://github.com/YIO-Remote/integrations.library.git .
68+
69+
- name: Get artifact version
70+
run: |
71+
read -r APP_VERSION < binaries/version.txt
72+
echo "::set-env name=APP_VERSION::$APP_VERSION"
73+
5574
- name: Upload build artefacts
56-
uses: actions/upload-artifact@v1
75+
uses: actions/upload-artifact@v2
5776
with:
5877
path: binaries
59-
name: ${{ env.APP_NAME }}-${{ matrix.config.artifact }}
78+
name: ${{ env.APP_NAME }}-v${{ env.APP_VERSION }}-${{ matrix.config.artifact }}
79+
if-no-files-found: error
6080

6181
release:
6282
name: Create Release
@@ -65,49 +85,47 @@
6585
needs: build
6686

6787
steps:
68-
- run: mkdir release
69-
- name: Download release artifact
70-
uses: actions/download-artifact@v1
71-
with:
72-
name: ${{ env.APP_NAME }}-${{ env.APP_ARCHITECTURE }}-release
73-
path: ./release
88+
- name: Download build artifacts
89+
uses: actions/download-artifact@v2
7490

75-
- name: Get artifact version
91+
- name: Display structure of downloaded files
92+
run: ls -R
93+
94+
- name: Get timestamp
7695
run: |
77-
read -r APP_VERSION < release/version.txt
78-
echo "::set-env name=APP_VERSION::$APP_VERSION"
7996
echo "::set-env name=TIMESTAMP::$(date +"%Y%m%d_%H%M%S")"
80-
97+
8198
- name: Create GitHub development build archives
8299
if: "!contains(github.ref, 'tags/v')"
83100
run: |
84-
tar cvf ${{ env.APP_NAME }}-v${{ env.APP_VERSION }}-${{ env.TIMESTAMP }}-${{ env.APP_ARCHITECTURE }}-release.tar -C release .
101+
for D in *; do if [ -d "${D}" ]; then tar cvf $D-${{ env.TIMESTAMP }}.tar -C $D .; fi; done;
85102
for filename in *.tar; do echo "sha256 `sha256sum $filename`" >> ${{ env.HASH_FILENAME }}; done;
86103
87-
- name: Create Pre-Release ${{ env.APP_VERSION }}
104+
- name: Create Pre-Release
88105
uses: "marvinpinto/action-automatic-releases@latest"
89106
if: "!contains(github.ref, 'tags/v')"
90107
with:
91108
repo_token: "${{ secrets.GITHUB_TOKEN }}"
92109
automatic_release_tag: "latest"
93110
prerelease: true
94-
title: "Development Build ${{ env.APP_VERSION }}"
111+
title: "Development Build"
95112
files: |
96113
*.tar
97114
${{ env.HASH_FILENAME }}
98115
99116
- name: Create GitHub release archives
100117
if: "contains(github.ref, 'tags/v')"
101118
run: |
102-
tar cvf ${{ env.APP_NAME }}-v${{ env.APP_VERSION }}-${{ env.APP_ARCHITECTURE }}-release.tar -C release .
119+
for D in *; do if [ -d "${D}" ]; then tar cvf $D.tar -C $D .; fi; done;
103120
for filename in *.tar; do echo "sha256 `sha256sum $filename`" >> ${{ env.HASH_FILENAME }}; done;
104121
105-
- name: Create Release ${{ env.APP_VERSION }}
122+
- name: Create Release
106123
uses: "marvinpinto/action-automatic-releases@latest"
107124
if: "contains(github.ref, 'tags/v')"
108125
with:
109126
repo_token: "${{ secrets.GITHUB_TOKEN }}"
110127
prerelease: false
111128
files: |
112-
*.tar
113-
${{ env.HASH_FILENAME }}
129+
*.tar
130+
${{ env.HASH_FILENAME }}
131+

0 commit comments

Comments
 (0)