forked from viamrobotics/rdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Workflows (viamrobotics#1028)
- Loading branch information
1 parent
8a8393d
commit f589a24
Showing
16 changed files
with
258 additions
and
113 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,17 +8,28 @@ on: | |
required: true | ||
REPO_READ_TOKEN: | ||
required: true | ||
GIT_ACCESS_TOKEN: | ||
required: true | ||
|
||
env: | ||
GOPRIVATE: "github.com/viamrobotics/*,go.viam.com/*" | ||
|
||
jobs: | ||
appimages_amd64: | ||
name: (x64) Viam Server AppImage | ||
runs-on: [x64, qemu-host] | ||
appimage: | ||
name: AppImage Build | ||
strategy: | ||
matrix: | ||
include: | ||
- arch: [x64, qemu-host] | ||
image: ghcr.io/viamrobotics/canon:amd64-cache | ||
platform: linux/amd64 | ||
- arch: [arm64, qemu-host] | ||
image: ghcr.io/viamrobotics/canon:arm64-cache | ||
platform: linux/arm64 | ||
runs-on: ${{ matrix.arch }} | ||
container: | ||
image: ghcr.io/viamrobotics/canon:amd64-cache | ||
options: --platform linux/amd64 | ||
image: ${{ matrix.image }} | ||
options: --platform ${{ matrix.platform }} | ||
timeout-minutes: 15 | ||
|
||
steps: | ||
|
@@ -27,17 +38,23 @@ jobs: | |
with: | ||
fetch-depth: 2 | ||
|
||
- name: Build and Package | ||
- name: Clean and configure git for private repos | ||
run: | | ||
echo "machine github.com login viambot password ${{ secrets.REPO_READ_TOKEN }}" > ~/.netrc | ||
make clean-all appimage | ||
make clean-all | ||
- name: Authorize GCP Upload | ||
uses: google-github-actions/[email protected] | ||
with: | ||
credentials_json: '${{ secrets.GCP_CREDENTIALS }}' | ||
|
||
- name: Upload Files | ||
- name: Build and Package (PR) | ||
if: contains(github.event.pull_request.labels.*.name, 'appimage') | ||
run: | | ||
make BUILD_CHANNEL="pr-${{ github.event.pull_request.number }}" appimage | ||
- name: Upload Files (PR) | ||
if: contains(github.event.pull_request.labels.*.name, 'appimage') | ||
uses: google-github-actions/[email protected] | ||
with: | ||
headers: "Cache-Control: no-cache" | ||
|
@@ -47,36 +64,88 @@ jobs: | |
parent: false | ||
gzip: false | ||
|
||
appimages_arm64: | ||
name: (arm64) Viam Server AppImage | ||
runs-on: [arm64, qemu-host] | ||
- name: Build and Package (Latest) | ||
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' | ||
run: | | ||
make BUILD_CHANNEL="latest" appimage | ||
- 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/${{ github.sha }}/' | ||
glob: '*' | ||
parent: false | ||
gzip: false | ||
|
||
appimage_comment: | ||
name: Add AppImage Links | ||
if: contains(github.event.pull_request.labels.*.name, 'appimage') | ||
needs: appimage | ||
runs-on: [x64, qemu-host] | ||
container: | ||
image: ghcr.io/viamrobotics/canon:arm64-cache | ||
options: --platform linux/arm64 | ||
image: ghcr.io/viamrobotics/canon:amd64-cache | ||
options: --platform linux/amd64 | ||
timeout-minutes: 5 | ||
|
||
steps: | ||
- name: Add links | ||
uses: marocchino/[email protected] | ||
with: | ||
recreate: true | ||
GITHUB_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }} | ||
message: | | ||
AppImages ready! | ||
<http://packages.viam.com/apps/viam-server/viam-server-pr-${{ github.event.pull_request.number }}-x86_64.AppImage> | ||
<http://packages.viam.com/apps/viam-server/viam-server-pr-${{ github.event.pull_request.number }}-aarch64.AppImage> | ||
appimage_test: | ||
name: AppImage Test & Deploy | ||
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' | ||
strategy: | ||
matrix: | ||
arch: [[x64, qemu-host], [arm64, qemu-host]] | ||
needs: appimage | ||
runs-on: ${{ matrix.arch }} | ||
timeout-minutes: 15 | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 2 | ||
- name: Clean Workspace | ||
run: | | ||
shopt -s dotglob | ||
sudo chown -R `whoami` ./ | ||
rm -rf ./* | ||
- name: Build and Package | ||
- name: Test AppImage | ||
run: | | ||
echo "machine github.com login viambot password ${{ secrets.REPO_READ_TOKEN }}" > ~/.netrc | ||
make clean-all appimage | ||
export TEST_DIR=`mktemp -d -t test-viam-server-XXXXXX` | ||
cd $TEST_DIR | ||
- name: Authorize GCP Upload | ||
curl -o viam-server http://packages.viam.com/apps/viam-server/testing/${{ github.sha }}/viam-server-latest-`uname -m`.AppImage | ||
chmod 755 viam-server | ||
export RAND_PORT=$((30000 + $RANDOM)) | ||
echo "{\"network\": {\"bind_address\":\"localhost:${RAND_PORT}\"}}" > test.json | ||
./viam-server 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 ] | ||
- name: Authorize GCP | ||
uses: google-github-actions/[email protected] | ||
with: | ||
credentials_json: '${{ secrets.GCP_CREDENTIALS }}' | ||
|
||
- name: Upload Files | ||
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: Set up Cloud SDK | ||
uses: 'google-github-actions/setup-gcloud@v0' | ||
|
||
- name: Publish AppImage | ||
run: | | ||
gsutil mv "gs://packages.viam.com/apps/viam-server/testing/${{ github.sha }}/*`uname -m`*" "gs://packages.viam.com/apps/viam-server/" |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Pull Request Close | ||
|
||
concurrency: | ||
group: pullrequest-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
pull_request: | ||
branches: [ 'main' ] | ||
types: [ 'closed' ] | ||
|
||
jobs: | ||
appimage_clean: | ||
name: Remove PR AppImages | ||
runs-on: [x64, qemu-host] | ||
container: | ||
image: ghcr.io/viamrobotics/canon:amd64-cache | ||
options: --platform linux/amd64 | ||
timeout-minutes: 15 | ||
|
||
steps: | ||
- name: Authorize GCP | ||
uses: google-github-actions/[email protected] | ||
with: | ||
credentials_json: '${{ secrets.GCP_CREDENTIALS }}' | ||
|
||
- name: Set up Cloud SDK | ||
uses: 'google-github-actions/setup-gcloud@v0' | ||
|
||
- name: Delete Files | ||
run: | | ||
gsutil rm "gs://packages.viam.com/apps/viam-server/viam-server-pr-${{ github.event.pull_request.number }}-*" || true |
Oops, something went wrong.