-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:/viamrobotics/rplidar into v0.1.16-…
…release
- Loading branch information
Showing
14 changed files
with
1,039 additions
and
143 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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: 'Comment on PR' | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Pull Request Update"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
comment: | ||
name: 'Post Comment on PR' | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.event == 'pull_request_target' && github.event.workflow_run.conclusion == 'success' }} | ||
steps: | ||
- name: Download PR Variables | ||
uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
run_id: ${{ github.event.workflow_run.id }} | ||
name: pr-variables | ||
|
||
- name: Restore Environment | ||
run: cat pr.env >> "${GITHUB_ENV}" | ||
|
||
- name: Add AppImage Links | ||
if: ${{ env.APPIMAGE }} | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
with: | ||
header: AppImage | ||
number: ${{ env.PR_NUMBER }} | ||
recreate: true | ||
message: | | ||
AppImages ready! | ||
<https://storage.googleapis.com/packages.viam.com/apps/rplidar/rplidar-module-pr-${{ env.PR_NUMBER }}-aarch64.AppImage> | ||
<https://storage.googleapis.com/packages.viam.com/apps/rplidar/rplidar-module-pr-${{ env.PR_NUMBER }}-x86_64.AppImage> | ||
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,41 @@ | ||
name: PR Test Label Manager | ||
|
||
on: | ||
pull_request_target: | ||
branches: [ 'main' ] | ||
types: [ opened, synchronize, reopened ] | ||
|
||
jobs: | ||
pr_test_label_manager: | ||
name: PR Test Label Manager | ||
runs-on: ubuntu-latest | ||
if: | | ||
github.event_name == 'pull_request_target' && | ||
contains(fromJson('["opened", "synchronize", "reopened"]'), github.event.action) | ||
steps: | ||
- name: "Check Membership and Label PR" | ||
uses: actions/github-script@v6 | ||
id: check-membership | ||
with: | ||
github-token: ${{ secrets.PR_TOKEN }} | ||
script: | | ||
let prNumber = context.payload.pull_request && context.payload.pull_request.number; | ||
try { | ||
await github.rest.issues.removeLabel({owner: "viamrobotics", repo: "rplidar", issue_number: prNumber, name: "safe to test"}); | ||
} catch (err) { | ||
core.info(`Non-fatal error ${err}, while trying to remove 'safe to test' label.`); | ||
} | ||
let orgResp = await github.rest.orgs.checkMembershipForUser({org: "viamrobotics", username: context.payload.sender.login}); | ||
if (orgResp.status === 204) { | ||
// order of labeling events must be preserved, so two seperate calls | ||
await github.rest.issues.addLabels({owner: "viamrobotics", repo: "rplidar", issue_number: prNumber, labels: ["safe to test"]}); | ||
return true; | ||
} | ||
return false; | ||
- name: Add Unsafe PR Comment | ||
if: steps.check-membership.outputs.result != 'true' | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
with: | ||
recreate: true | ||
message: For security reasons, this PR must be labeled with `safe to test` in order for tests to 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
name: Pull Request Update | ||
|
||
concurrency: | ||
group: pullrequest-${{ github.head_ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
pull_request_target: | ||
branches: [ 'main' ] | ||
types: [ 'labeled' ] | ||
|
||
# To test workflow updates you need to work in a branch directly on viamrobotics/rplidar | ||
# and tag your working branch instead of @main in any viamrobotics/rplidar "uses" below. | ||
# Don't forget to tag back to @main before merge. | ||
|
||
jobs: | ||
test: | ||
if: github.event.label.name == 'safe to test' || | ||
contains(github.event.pull_request.labels.*.name, 'appimage') || | ||
contains(github.event.pull_request.labels.*.name, 'appimage-ignore-tests') | ||
uses: viamrobotics/rplidar/.github/workflows/test.yml@main | ||
|
||
# This lets people add an "appimage" tag to have appimages built for the PR | ||
appimage: | ||
needs: [test] | ||
if: | | ||
always() && !cancelled() && contains(github.event.pull_request.labels.*.name, 'safe to test') && | ||
!contains(github.event.pull_request.labels.*.name, 'appimage-ignore-tests') && | ||
contains(github.event.pull_request.labels.*.name, 'appimage') && needs.test.result == 'success' | ||
uses: viamrobotics/rplidar/.github/workflows/appimage.yml@main | ||
with: | ||
release_type: 'pr' | ||
secrets: | ||
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} | ||
|
||
appimage-ignore-tests: | ||
if: | | ||
always() && !cancelled() && contains(github.event.pull_request.labels.*.name, 'safe to test') && | ||
contains(github.event.pull_request.labels.*.name, 'appimage-ignore-tests') | ||
uses: viamrobotics/rplidar/.github/workflows/appimage.yml@main | ||
with: | ||
release_type: 'pr' | ||
secrets: | ||
GCP_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} |
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,28 @@ | ||
name: Pull Request Close | ||
|
||
concurrency: | ||
group: pullrequest-${{ github.head_ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
pull_request_target: | ||
branches: [ 'main' ] | ||
types: [ 'closed' ] | ||
|
||
jobs: | ||
appimage_clean: | ||
name: Remove PR AppImages | ||
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: Delete Files | ||
run: | | ||
gsutil rm "gs://packages.viam.com/apps/rplidar-module/rplidar-module-pr-${{ github.event.pull_request.number }}-*" || true |
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,83 @@ | ||
name: Test | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
|
||
jobs: | ||
build_and_test: | ||
name: Build and Test RPLiDAR | ||
strategy: | ||
matrix: | ||
include: | ||
- arch: buildjet-8vcpu-ubuntu-2204 | ||
image: ghcr.io/viamrobotics/canon:amd64-cache | ||
platform: linux/amd64 | ||
- arch: buildjet-8vcpu-ubuntu-2204-arm | ||
image: ghcr.io/viamrobotics/canon:arm64-cache | ||
platform: linux/arm64 | ||
runs-on: ${{ matrix.arch }} | ||
container: | ||
image: ${{ matrix.image }} | ||
options: --platform ${{ matrix.platform }} | ||
timeout-minutes: 45 | ||
steps: | ||
# Can't directly comment without token having full read/write access | ||
# appimage-comment.yml will trigger separately and post the actual comments | ||
|
||
- name: Set PR Number variable | ||
run: | | ||
echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> pr.env | ||
- name: Set appimage variable | ||
if: contains(github.event.pull_request.labels.*.name, 'appimage') || contains(github.event.pull_request.labels.*.name, 'appimage-ignore-tests') | ||
run: | | ||
echo "APPIMAGE=true" >> pr.env | ||
- name: Upload PR variables | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: pr-variables | ||
path: | | ||
pr.env | ||
retention-days: 1 | ||
|
||
- name: Check out main branch code | ||
if: github.event_name != 'pull_request_target' | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: Check out PR branch code | ||
if: github.event_name == 'pull_request_target' | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
fetch-depth: 2 | ||
|
||
- name: Clean and Fix Permissions | ||
run: | | ||
chown testbot:testbot -R . | ||
sudo -Hu testbot bash -lc 'make clean' | ||
- name: make setup | ||
run: | | ||
sudo -u testbot bash -lc 'make setup' | ||
- name: make test | ||
run: | | ||
sudo -u testbot bash -lc 'make test' | ||
- name: Verify no uncommitted changes from make lint | ||
run: | | ||
git init | ||
git add . | ||
chown -R testbot:testbot . | ||
sudo -u testbot bash -lc 'sudo apt-get install -y clang-format && make lint' | ||
GEN_DIFF=$(git status -s --ignore-submodules) | ||
if [ -n "$GEN_DIFF" ]; then | ||
echo '"make lint" resulted in changes not in git' 1>&2 | ||
git status | ||
exit 1 | ||
fi |
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
Oops, something went wrong.