Skip to content

Commit a80caa7

Browse files
author
Victor Paleologue
committed
github.workflow: Adds continuous and release GitHub workflows.
1 parent 175dba0 commit a80caa7

File tree

3 files changed

+138
-0
lines changed

3 files changed

+138
-0
lines changed

.github/workflows/continuous.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Build and Test
2+
3+
on:
4+
push:
5+
branches: [ master, release-2.9, team/platform/dev ]
6+
pull_request:
7+
branches: [ master, release-2.9, team/platform/dev ]
8+
9+
env:
10+
FEED: https://github.com/victorpaleologue/qisdk-toolchain/releases/download/v1.0.0/feed.xml
11+
12+
jobs:
13+
build:
14+
# The CMake configure and build commands are platform agnostic and should work equally
15+
# well on Windows or Mac. You can convert this to a matrix build if you need
16+
# cross-platform coverage.
17+
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
18+
runs-on: ubuntu-20.04
19+
20+
steps:
21+
22+
- name: Install Build Tools
23+
run: pip install qibuild
24+
25+
- name: Install Dependencies
26+
# TODO move these dependencies in the toolchain
27+
run: sudo apt install libgtest-dev libgmock-dev
28+
29+
- uses: actions/checkout@v2
30+
31+
- name: Prepare QiBuild Toolchain
32+
run: qitoolchain create qisdk $FEED
33+
34+
- name: Prepare QiBuild Config
35+
run: |
36+
qibuild init
37+
qibuild add-config qisdk -t qisdk
38+
39+
- name: Configure
40+
run: qibuild configure -c qisdk --debug -DQI_WITH_TESTS=ON -DCMAKE_CXX_FLAGS=-pthread
41+
42+
- name: Build
43+
run: qibuild make -c qisdk
44+
45+
- name: Test
46+
run: qitest run -c qisdk

.github/workflows/make_feed.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
# Retrieves the latest release output to generate a QiToolchain XML feed.
3+
set -e
4+
echo "Getting packages from current release at ${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/latest"
5+
ASSETS_URL=$(curl --silent "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/latest" |
6+
jq -r '.assets_url')
7+
PACKAGES_URLS=$(curl --silent ${ASSETS_URL} |
8+
jq '.[] | .browser_download_url' |
9+
grep .zip | xargs -L 1 echo) # echo removes the extra quotes
10+
11+
echo "Making a toolchain referencing the following packages: ${PACKAGES_URLS}"
12+
echo "<toolchain>" > feed.xml
13+
for URL in $PACKAGES_URLS; do
14+
ZIP=package.zip
15+
wget -q $URL -O $ZIP;
16+
NAME=$(unzip -p $ZIP package.xml | xmllint --xpath "string(/package/@name)" -)
17+
VERSION=$(unzip -p $ZIP package.xml | xmllint --xpath "string(/package/@version)" -)
18+
echo " <package name=\"${NAME}\" version=\"${VERSION}\" url=\"${URL}\" />" >> feed.xml
19+
rm $ZIP
20+
done
21+
22+
echo "Adding sub-toolchain from ${FEED}"
23+
echo " <feed url=\"${FEED}\" />" >> feed.xml
24+
echo "</toolchain>" >> feed.xml
25+
26+
realpath feed.xml

.github/workflows/release.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Release with Toolchain
2+
3+
on:
4+
push:
5+
tags: "v*"
6+
7+
env:
8+
FEED: https://github.com/victorpaleologue/libqi/releases/download/v1.8.8-actions/feed.xml
9+
10+
jobs:
11+
gh_tagged_release:
12+
# The CMake configure and build commands are platform agnostic and should work equally
13+
# well on Windows or Mac. You can convert this to a matrix build if you need
14+
# cross-platform coverage.
15+
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
16+
runs-on: ubuntu-20.04
17+
18+
steps:
19+
20+
- name: Install Utilities
21+
run: sudo apt install apt-utils ca-certificates locales curl wget jq libxml2-utils xmlstarlet
22+
23+
- name: Install Build Tools
24+
run: pip install qibuild
25+
26+
- name: Install Dependencies
27+
# TODO move these dependencies in the toolchain
28+
run: sudo apt install libgtest-dev libgmock-dev
29+
30+
- uses: actions/checkout@v2
31+
32+
- name: Prepare QiBuild Toolchain
33+
run: qitoolchain create qisdk $FEED
34+
35+
- name: Prepare QiBuild Config
36+
run: |
37+
qibuild init
38+
qibuild add-config qisdk -t qisdk
39+
40+
- name: Set Version
41+
run: xmlstarlet ed --inplace -i '/project/qibuild' -t attr -n version -v `git describe --tags` qiproject.xml
42+
43+
- name: Build QiToolchain Package # Outputs the package as a .zip in ./package/
44+
run: qibuild package -c qisdk --release -DQI_WITH_TESTS=OFF -DCMAKE_CXX_FLAGS=-pthread
45+
46+
- name: Release Package
47+
uses: "marvinpinto/action-automatic-releases@latest"
48+
with:
49+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
50+
prerelease: false
51+
files: |
52+
package/*.zip
53+
id: "release"
54+
55+
- name: Make Feed # Outputs feed.xml
56+
run: .github/workflows/make_feed.sh
57+
58+
- name: Release Feed
59+
uses: actions/upload-release-asset@v1
60+
env:
61+
GITHUB_TOKEN: ${{ github.token }}
62+
with:
63+
upload_url: ${{ steps.release.outputs.upload_url }}
64+
asset_path: feed.xml
65+
asset_name: feed.xml
66+
asset_content_type: application/xml

0 commit comments

Comments
 (0)