diff --git a/.github/workflows/continuous.yml b/.github/workflows/continuous.yml new file mode 100644 index 0000000..c8272b8 --- /dev/null +++ b/.github/workflows/continuous.yml @@ -0,0 +1,46 @@ +name: Build and Test + +on: + push: + branches: [ master, release-2.9, team/platform/dev ] + pull_request: + branches: [ master, release-2.9, team/platform/dev ] + +env: + FEED: https://github.com/victorpaleologue/libqi/releases/download/v1.8.8-actions/feed.xml + +jobs: + build: + # The CMake configure and build commands are platform agnostic and should work equally + # well on Windows or Mac. You can convert this to a matrix build if you need + # cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-20.04 + + steps: + + - name: Install Build Tools + run: pip install qibuild + + - name: Install Dependencies + # TODO move these dependencies in the toolchain + run: sudo apt install libgtest-dev libgmock-dev + + - uses: actions/checkout@v2 + + - name: Prepare QiBuild Toolchain + run: qitoolchain create qisdk $FEED + + - name: Prepare QiBuild Config + run: | + qibuild init + qibuild add-config qisdk -t qisdk + + - name: Configure + run: qibuild configure -c qisdk --debug -DQI_WITH_TESTS=ON -DCMAKE_CXX_FLAGS=-pthread + + - name: Build + run: qibuild make -c qisdk + + - name: Test + run: qitest run -c qisdk diff --git a/.github/workflows/make_feed.sh b/.github/workflows/make_feed.sh new file mode 100644 index 0000000..f946d81 --- /dev/null +++ b/.github/workflows/make_feed.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Retrieves the latest release output to generate a QiToolchain XML feed. +set -e +echo "Getting packages from current release at ${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/latest" +ASSETS_URL=$(curl --silent "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/latest" | + jq -r '.assets_url') +PACKAGES_URLS=$(curl --silent ${ASSETS_URL} | + jq '.[] | .browser_download_url' | + grep .zip | xargs -L 1 echo) # echo removes the extra quotes + +echo "Making a toolchain referencing the following packages: ${PACKAGES_URLS}" +echo "" > feed.xml +for URL in $PACKAGES_URLS; do + ZIP=package.zip + wget -q $URL -O $ZIP; + NAME=$(unzip -p $ZIP package.xml | xmllint --xpath "string(/package/@name)" -) + VERSION=$(unzip -p $ZIP package.xml | xmllint --xpath "string(/package/@version)" -) + echo " " >> feed.xml + rm $ZIP +done + +echo "Adding sub-toolchain from ${FEED}" +echo " " >> feed.xml +echo "" >> feed.xml + +realpath feed.xml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1b23bae --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,66 @@ +name: Release with Toolchain + +on: + push: + tags: "v*" + +env: + FEED: https://github.com/victorpaleologue/libqi/releases/download/v1.8.8-actions/feed.xml + +jobs: + gh_tagged_release: + # The CMake configure and build commands are platform agnostic and should work equally + # well on Windows or Mac. You can convert this to a matrix build if you need + # cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-20.04 + + steps: + + - name: Install Utilities + run: sudo apt install apt-utils ca-certificates locales curl wget jq libxml2-utils xmlstarlet + + - name: Install Build Tools + run: pip install qibuild + + - name: Install Dependencies + # TODO move these dependencies in the toolchain + run: sudo apt install libgtest-dev libgmock-dev + + - uses: actions/checkout@v2 + + - name: Prepare QiBuild Toolchain + run: qitoolchain create qisdk $FEED + + - name: Prepare QiBuild Config + run: | + qibuild init + qibuild add-config qisdk -t qisdk + + - name: Set Version + run: xmlstarlet ed --inplace -i '/project/qibuild' -t attr -n version -v `git describe --tags` qiproject.xml + + - name: Build QiToolchain Package # Outputs the package as a .zip in ./package/ + run: qibuild package -c qisdk --release -DQI_WITH_TESTS=OFF -DCMAKE_CXX_FLAGS=-pthread + + - name: Release Package + uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + prerelease: false + files: | + package/*.zip + id: "release" + + - name: Make Feed # Outputs feed.xml + run: .github/workflows/make_feed.sh + + - name: Release Feed + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ steps.release.outputs.upload_url }} + asset_path: feed.xml + asset_name: feed.xml + asset_content_type: application/xml