This repository was archived by the owner on Jan 28, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 20
136 lines (119 loc) Β· 5.09 KB
/
build.yml
File metadata and controls
136 lines (119 loc) Β· 5.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# GitHub Action to cross compile a YIO Remote Qt project for the YIO remote-os.
# Uses the pre-built Buildroot SDK from remote-os in a custom GitHub action.
# Creates a pre-release if pushed on master branch without a version tag.
# Creates a release if pushed on master branch with a version tag.
---
name: "Cross Compile & Release"
on:
push:
pull_request:
env:
APP_NAME: YIO-remote-software
PROJECT_NAME: remote-software
HASH_FILENAME: yio-remote-software.hash
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ubuntu-latest
strategy:
matrix:
config:
- {
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"
}
- {
name: "remote-os v2.0 Build", artifact: "RPi0-Qt5.15.2",
qmake-args: "CONFIG+=release",
build-image: "zehnm/yio-crosscompile-action:3.0.0"
}
steps:
- 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
# Unfortunately we can't use a dynamic Action as in "uses: ${{ matrix.config.build-image }}"
# - name: Cross compile
# id: cross-compile
# uses: zehnm/yio-crosscompile-action@2.0.0
# 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
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 "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
- name: Upload build artefacts
uses: actions/upload-artifact@v2
with:
path: binaries
name: ${{ env.APP_NAME }}-v${{ env.APP_VERSION }}-${{ matrix.config.artifact }}
if-no-files-found: error
release:
name: Create Release
if: github.ref == 'refs/heads/master' || contains(github.ref, 'tags/v')
runs-on: ubuntu-latest
needs: build
steps:
- name: Download build artifacts
uses: actions/download-artifact@v2
- name: Display structure of downloaded files
run: ls -R
- name: Get timestamp
run: |
echo "TIMESTAMP=$(date +"%Y%m%d_%H%M%S")" >> $GITHUB_ENV
- name: Create GitHub development build archives
if: "!contains(github.ref, 'tags/v')"
run: |
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
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"
files: |
*.tar
${{ env.HASH_FILENAME }}
- name: Create GitHub release archives
if: "contains(github.ref, 'tags/v')"
run: |
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
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 }}