Merge pull request #125 from RoboSchmied/RoboSchmied-refactor_i2cdetect #16
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
name: ipctool-arm32 | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
jobs: | |
build-musl-static: | |
runs-on: ubuntu-latest | |
env: | |
ARCHIVE: arm-gcc13-musl-3_0 | |
PLATFORM: arm-openipc-linux-musleabi_sdk-buildroot | |
TOOLCHAIN: arm-openipc-linux-musleabi | |
steps: | |
- uses: pozetroninc/github-action-get-latest-release@master | |
id: ct-ng-release | |
with: | |
owner: widgetii | |
repo: ct-ng-builds | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Build sources | |
id: build | |
run: | | |
HEAD_TAG=$(git tag --points-at HEAD) | |
GIT_HASH=$(git rev-parse --short $GITHUB_SHA) | |
BRANCH_NAME=$(echo $GITHUB_REF | cut -d'/' -f 3) | |
if [ -z "$HEAD_TAG" ]; then | |
TAG_NAME="latest" | |
RELEASE_NAME="Development Build" | |
PRERELEASE=true | |
else | |
TAG_NAME=${{ github.ref }} | |
RELEASE_NAME="Release ${{ github.ref }}" | |
PRERELEASE=false | |
fi | |
echo "GIT_HASH=$GIT_HASH" >> $GITHUB_ENV | |
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV | |
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV | |
echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV | |
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | |
REL="${{ steps.ct-ng-release.outputs.release }}" | |
echo "Got release $REL" | |
wget -qO- https://github.com/OpenIPC/firmware/releases/download/latest/$ARCHIVE.tgz | \ | |
tar xfz - -C /opt | |
export PATH=/opt/$PLATFORM/bin:$PATH | |
sudo apt-get install -y cmake upx-ucl | |
cmake -H. -Bbuild -DCMAKE_C_COMPILER=${TOOLCHAIN}-gcc -DCMAKE_BUILD_TYPE=Release | |
cmake --build build | |
upx build/ipcinfo | |
upx build/ipctool | |
cp build/ipctool ipctool-$GIT_HASH | |
continue-on-error: true | |
- name: Send warning message to telegram channel | |
env: | |
TG_TOKEN: ${{ secrets.TELEGRAM_TOKEN_BOT_OPENIPC }} | |
TG_CHANNEL: ${{ secrets.TELEGRAM_CHANNEL_OPENIPC_DEV }} | |
if: steps.ct-ng-release.outcome != 'success' || steps.build.outcome != 'success' | |
run: | | |
TG_OPTIONS="-s --connect-timeout 5 --max-time 15" | |
TG_NOTIFY="Warning, ipctool build error..." | |
TG_HEADER=$(echo -e "\r\n$TG_NOTIFY \r\n\r\nCommit: $GIT_HASH \r\nBranch: $BRANCH_NAME \r\nTag: $TAG_NAME \r\n\r\n\xE2\x9A\xA0 GitHub Actions") | |
curl $TG_OPTIONS -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot$TG_TOKEN/sendMessage \ | |
-F chat_id=$TG_CHANNEL -F text="$TG_HEADER" | |
- name: Create release | |
uses: actions/create-release@v1 | |
continue-on-error: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.TAG_NAME }} | |
release_name: ${{ env.RELEASE_NAME }} | |
draft: false | |
prerelease: ${{ env.PRERELEASE }} | |
- name: Upload binaries to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: "build/ipctool" | |
asset_name: "ipctool" | |
tag: ${{ env.TAG_NAME }} | |
overwrite: true | |
- name: Upload ipcinfo to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: "build/ipcinfo" | |
asset_name: "ipcinfo" | |
tag: ${{ env.TAG_NAME }} | |
overwrite: true | |
- name: Publish file on S3 for HTTP access (to test dev versions) | |
if: env.HEAD_TAG == '' | |
uses: tpaschalis/s3-sync-action@master | |
with: | |
args: --acl public-read | |
env: | |
FILE: ./ipctool-${{ env.GIT_HASH }} | |
AWS_REGION: 'eu-north-1' | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
# - name: Trigger CI tests | |
# if: env.HEAD_TAG == '' | |
# uses: peter-evans/repository-dispatch@v1 | |
# with: | |
# token: ${{ secrets.REPO_ACCESS_TOKEN }} | |
# repository: OpenIPC/ipctool | |
# event-type: ci-tests | |
# client-payload: '{"sha": "${{ env.GIT_HASH }}"}' | |
- name: Send binary file to telegram channel | |
env: | |
TG_TOKEN: ${{ secrets.TELEGRAM_TOKEN_BOT_OPENIPC }} | |
TG_CHANNEL: ${{ secrets.TELEGRAM_CHANNEL_OPENIPC_DEV }} | |
run: | | |
TG_OPTIONS="-s --connect-timeout 5 --max-time 15" | |
TG_HEADER=$(echo -e "\r\nCommit: $GIT_HASH \r\nBranch: $BRANCH_NAME \r\nTag: $TAG_NAME \r\n\r\n\xE2\x9C\x85 GitHub Actions") | |
curl $TG_OPTIONS -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot$TG_TOKEN/sendDocument \ | |
-F chat_id=$TG_CHANNEL -F document="@build/ipctool" -F caption="$TG_HEADER" |