trace env to make sure this approach works #155
Workflow file for this run
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: Build AppImage | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release_type: | ||
required: true | ||
type: string | ||
workflow_call: | ||
inputs: | ||
release_type: | ||
required: true | ||
type: string | ||
secrets: | ||
GCP_CREDENTIALS: | ||
required: true | ||
jobs: | ||
appimage: | ||
name: AppImage Build | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- arch: [ubuntu-latest] | ||
image: ghcr.io/viamrobotics/rdk-devenv:amd64-beta-81a6398-cache | ||
platform: linux/amd64 | ||
label: amd64 | ||
- arch: [buildjet-2vcpu-ubuntu-2204-arm] | ||
image: ghcr.io/viamrobotics/rdk-devenv:arm64-beta-81a6398-cache | ||
platform: linux/arm64 | ||
label: arm64 | ||
runs-on: ${{ matrix.arch }} | ||
container: | ||
image: ${{ matrix.image }} | ||
options: --platform ${{ matrix.platform }} | ||
timeout-minutes: 15 | ||
outputs: | ||
date: ${{ steps.build_date.outputs.date }} | ||
steps: | ||
- name: Check out code | ||
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' | ||
uses: actions/checkout@v3 | ||
- name: Check out PR branch code | ||
if: github.event_name == 'pull_request_target' || github.event_name == 'pull_request' | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: Clean and Fix Permissions | ||
run: | | ||
chown testbot:testbot -R . | ||
sudo -Hu testbot bash -lc 'make clean-all' | ||
- name: Authorize GCP Upload | ||
uses: google-github-actions/auth@v1 | ||
with: | ||
credentials_json: '${{ secrets.GCP_CREDENTIALS }}' | ||
- name: Build and Package (PR) | ||
if: contains(github.event.pull_request.labels.*.name, 'appimage') || contains(github.event.pull_request.labels.*.name, 'appimage-ignore-tests') | ||
run: | | ||
sudo -Hu testbot bash -lc 'make BUILD_CHANNEL="pr-${{ github.event.pull_request.number }}" appimage' | ||
- name: Upload Files (PR) | ||
if: contains(github.event.pull_request.labels.*.name, 'appimage') || contains(github.event.pull_request.labels.*.name, 'appimage-ignore-tests') | ||
uses: google-github-actions/[email protected] | ||
with: | ||
headers: "cache-control: no-cache" | ||
path: 'etc/packaging/appimages/deploy/' | ||
destination: 'packages.viam.com/apps/viam-server/' | ||
glob: '*' | ||
parent: false | ||
gzip: false | ||
- name: Build and Package (Latest) | ||
if: inputs.release_type == 'latest' | ||
run: | | ||
sudo -Hu testbot bash -lc 'make BUILD_CHANNEL="latest" appimage' | ||
- name: Build and Package (Tagged) | ||
if: inputs.release_type == 'stable' || inputs.release_type == 'rc' | ||
run: | | ||
sudo -Hu testbot bash -lc 'make RELEASE_TYPE="${{ inputs.release_type }}" BUILD_CHANNEL="${{ github.ref_name }}" appimage' | ||
- name: Set Date | ||
id: build_date | ||
run: echo "date=`date +%F`" >> $GITHUB_OUTPUT | ||
- name: Upload Files (Testing) | ||
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' | ||
uses: google-github-actions/[email protected] | ||
with: | ||
headers: "cache-control: no-cache" | ||
path: 'etc/packaging/appimages/deploy/' | ||
destination: 'packages.viam.com/apps/viam-server/testing/appimage/${{ steps.build_date.outputs.date }}/${{ github.sha }}/' | ||
glob: '*' | ||
parent: false | ||
gzip: false | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: appimage-${{ matrix.label }} | ||
path: etc/packaging/appimages/deploy | ||
appimage-static-32bit: | ||
name: static 32-bit for appimage | ||
runs-on: buildjet-2vcpu-ubuntu-2204-arm | ||
container: | ||
image: ghcr.io/viamrobotics/rdk-devenv:armhf-beta-81a6398-cache | ||
options: --platform linux/arm/v7 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
# todo: github.ref may be right even in target case | ||
ref: ${{ github.event == 'pull_request_target' ? github.event.pull_request.head.sha : github.ref }} | ||
- name: inspect | ||
run: echo head-sha ${{ github.event.pull_request.head.sha }} ref ${{ github.ref }} | ||
- name: build | ||
run: make server-static | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: appimage-static-32bit | ||
path: bin/*/viam-server | ||
appimage-32bit: | ||
# this exists because appimage-builder is complex to build for 32-bit | ||
name: appimage bundler for 32-bit | ||
runs-on: ubuntu-latest | ||
needs: appimage-static-32bit | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: appimage-static-32bit | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
# - name: Clean and Fix Permissions | ||
# run: | | ||
# chown testbot:testbot -R . | ||
# sudo -Hu testbot bash -lc 'make clean-all' | ||
- name: deps | ||
run: pip install appimage-builder git+https://github.com/AppImageCrafters/appimage-builder.git@42d32f11496de43a9f6a9ada7882a11296e357ca | ||
- name: build | ||
env: | ||
BUILD_CHANNEL: ${{ inputs.release_type }} | ||
UNAME_M: armv7l | ||
DPKG_ARCH: armhf | ||
APPIMAGE_ARCH: armhf | ||
run: make appimage-arch | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: appimage-32bit | ||
path: etc/packaging/appimages/deploy | ||
output_summary: | ||
name: Output Summary | ||
runs-on: ubuntu-latest | ||
needs: appimage | ||
if: contains(github.event.pull_request.labels.*.name, 'appimage') || contains(github.event.pull_request.labels.*.name, 'appimage-ignore-tests') | ||
steps: | ||
- name: Display Download Links | ||
run: | | ||
channel="pr-${{ github.event.pull_request.number }}" | ||
echo "### Built AppImages for ${channel}" >> $GITHUB_STEP_SUMMARY | ||
echo "- arm64: https://storage.googleapis.com/packages.viam.com/apps/viam-server/viam-server-${channel}-aarch64.AppImage" >> $GITHUB_STEP_SUMMARY | ||
echo "- x86_64: https://storage.googleapis.com/packages.viam.com/apps/viam-server/viam-server-${channel}-x86_64.AppImage" >> $GITHUB_STEP_SUMMARY | ||
echo "" >> $GITHUB_STEP_SUMMARY | ||
appimage_test: | ||
name: AppImage Test | ||
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
arch: [[ubuntu-latest], [buildjet-2vcpu-ubuntu-2204-arm], [arm64, pi4]] | ||
needs: appimage | ||
runs-on: ${{ matrix.arch }} | ||
timeout-minutes: 15 | ||
outputs: | ||
date: ${{ needs.appimage.outputs.date }} | ||
steps: | ||
- name: Clean Workspace | ||
run: | | ||
shopt -s dotglob | ||
sudo chown -R `whoami` ./ | ||
rm -rf ./* | ||
- name: Test AppImage | ||
run: | | ||
if echo "${{ matrix.arch[0] }}" | grep -q ubuntu; then | ||
sudo apt-get install -y libfuse2 | ||
fi | ||
channel="${{ github.ref_name }}" | ||
# we call our main branch releases "latest" | ||
if [ "$channel" = "main" ]; then | ||
channel="latest" | ||
fi | ||
export TEST_DIR=`mktemp -d -t test-viam-server-XXXXXX` | ||
cd $TEST_DIR | ||
curl -o viam-server https://storage.googleapis.com/packages.viam.com/apps/viam-server/testing/appimage/${{ needs.appimage.outputs.date }}/${{ github.sha }}/viam-server-${channel}-`uname -m`.AppImage | ||
chmod 755 viam-server | ||
export RAND_PORT=$((30000 + $RANDOM)) | ||
echo "{\"network\": {\"bind_address\":\"localhost:${RAND_PORT}\"}}" > test.json | ||
./viam-server -config test.json & | ||
curl --retry 5 --retry-delay 5 --retry-connrefused localhost:$RAND_PORT | ||
export RET1=$? | ||
kill %% | ||
wait $! | ||
export RET2=$? | ||
cd - && rm -rf $TEST_DIR | ||
[ $RET1 == 0 ] && [ $RET1 == 0 ] | ||
appimage_deploy: | ||
name: AppImage Deploy | ||
needs: appimage_test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Authorize GCP | ||
uses: google-github-actions/auth@v1 | ||
with: | ||
credentials_json: '${{ secrets.GCP_CREDENTIALS }}' | ||
- name: Set up Cloud SDK | ||
uses: google-github-actions/setup-gcloud@v1 | ||
- name: Publish AppImage | ||
run: | | ||
gsutil mv "gs://packages.viam.com/apps/viam-server/testing/appimage/${{ needs.appimage_test.outputs.date }}/${{ github.sha }}/*" "gs://packages.viam.com/apps/viam-server/" | ||
- name: Output Summary | ||
run: | | ||
channel="${{ github.ref_name }}" | ||
# we call our main branch releases "latest" | ||
if [ "$channel" == "main" ]; then | ||
channel="latest" | ||
fi | ||
echo "### Built AppImages for ${channel}" >> $GITHUB_STEP_SUMMARY | ||
echo "- arm64: https://storage.googleapis.com/packages.viam.com/apps/viam-server/viam-server-${channel}-aarch64.AppImage" >> $GITHUB_STEP_SUMMARY | ||
echo "- x86_64: https://storage.googleapis.com/packages.viam.com/apps/viam-server/viam-server-${channel}-x86_64.AppImage" >> $GITHUB_STEP_SUMMARY | ||
echo "" >> $GITHUB_STEP_SUMMARY |