Skip to content

Commit

Permalink
Merge branch 'main' into fix-fedora-nmcli
Browse files Browse the repository at this point in the history
  • Loading branch information
tcamise-gpsw authored Apr 10, 2024
2 parents 75b5578 + 8a80eca commit 4d35b1a
Show file tree
Hide file tree
Showing 271 changed files with 47,403 additions and 35,265 deletions.
4 changes: 4 additions & 0 deletions .admin/proto_build/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**

!entrypoint.sh
!requirements.txt
15 changes: 15 additions & 0 deletions .admin/proto_build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Dockerfile/Open GoPro, Version 2.0 (C) Copyright 2021 GoPro, Inc. (http://gopro.com/OpenGoPro).
# This copyright was auto-generated on Wed Mar 27 22:05:54 UTC 2024

FROM python:3.11-bookworm

RUN apt-get update && apt-get install -y \
protobuf-compiler \
bash

COPY . /workdir
RUN pip install -r /workdir/requirements.txt

RUN chmod +x /workdir/entrypoint.sh

ENTRYPOINT [ "/workdir/entrypoint.sh" ]
22 changes: 22 additions & 0 deletions .admin/proto_build/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Protobuf Builder

This is a Docker image to build the [Protobuf](../../protobuf/) files in this repo. It currently only build Python
output but should be used in the future for other languages.

## Usage

It is intended to be used via the [docker compose configuration](../../docker-compose.yml).

First build:

```shell
docker compose build proto-build
```

Then build the protobuf files with:

```shell
docker compose run --rm proto-build
```

The output files will be placed in the [build directory](../../.build/protobuf).
27 changes: 27 additions & 0 deletions .admin/proto_build/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
# entrypoint.sh/Open GoPro, Version 2.0 (C) Copyright 2021 GoPro, Inc. (http://gopro.com/OpenGoPro).
# This copyright was auto-generated on Wed Mar 27 22:05:54 UTC 2024


PROTO_SRC_DIR=/proto_in
PROTO_PYTHON_OUT_DIR=/proto_python_out

rm -rf $PROTO_PYTHON_OUT_DIR && mkdir -p $PROTO_PYTHON_OUT_DIR

echo
echo "Building protobuf python files and stubs from .proto source files..."
pushd $PROTO_SRC_DIR
protoc --include_imports --descriptor_set_out=$PROTO_PYTHON_OUT_DIR/descriptors --python_out=$PROTO_PYTHON_OUT_DIR --mypy_out=$PROTO_PYTHON_OUT_DIR *
popd

pushd $PROTO_PYTHON_OUT_DIR
echo
echo "Converting relative imports to absolute..."
protol -o . --in-place raw descriptors
rm descriptors

# Format generated files
echo
echo "Formatting..."
black .
popd
3 changes: 3 additions & 0 deletions .admin/proto_build/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mypy-protobuf==3.5.0
protoletariat==3.2.19
black
33 changes: 29 additions & 4 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,32 @@ on:
workflow_dispatch:

jobs:
copyright:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.PUSH_FROM_WORKFLOW_TO_RETRIGGER }}

- name: Check for (and add) missing copyrights
shell: bash
run: |
make copyright
echo "NUM_MODIFIED=$(git diff --numstat | wc -l)" >> $GITHUB_ENV
- name: Push changes
if: env.NUM_MODIFIED != 0
shell: bash
run: |
git config core.fileMode false
git config user.name github-actions
git config user.email [email protected]
git add .
git commit -m "updating copyrights from pre merge check in github action"
git push
check:
needs: copyright
name: Check modified files for Python SDK changes
runs-on: ubuntu-latest
outputs:
Expand All @@ -29,16 +54,16 @@ jobs:
git diff --name-only HEAD^ HEAD >files.txt
while IFS= read -r file; do
if [[ $file != demos/python/sdk_wireless_camera_control* ]]; then
echo "::set-output name=run_job::false"
echo "{run_job}={false}" >> $GITHUB_OUTPUT
else
echo "Found a Python SDK modified file"
echo "::set-output name=run_job::true"
echo "{run_job}={true}" >> $GITHUB_OUTPUT
break
fi
done <files.txt
python_sdk:
name: Build and Deploy Python SDK
name: Build and Deploy Python SDK Documentation
needs: check
if: needs.check.outputs.run_job == 'true'
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -104,7 +129,7 @@ jobs:
jekyll:
name: Build and Deploy Jekyll Site
needs: [check, python_sdk]
needs: [copyright, check, python_sdk]
if: always()
runs-on: ubuntu-latest
steps:
Expand Down
36 changes: 2 additions & 34 deletions .github/workflows/pre_merge_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# This copyright was auto-generated on Wed, Sep 1, 2021 5:05:35 PM

# This workflow will run pre-merge checks to verify a PR before it is merged:
# - copyright: Checks to see if there are any missing copyrights

name: Pre Merge Checks

Expand All @@ -11,39 +10,7 @@ on:
branches: [main, develop, release]

jobs:
copyright:
runs-on: ubuntu-latest
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_HEAD_REF#refs/heads/})"
id: extract_branch

- name: Checkout PR branch
uses: actions/checkout@v3
with:
ref: ${{ steps.extract_branch.outputs.branch }}
ssh-key: ${{ secrets.PUSH_FROM_WORKFLOW_TO_RETRIGGER }}

- name: Check for (and add) missing copyrights
shell: bash
run: |
make copyright
echo "NUM_MODIFIED=$(git diff --numstat | wc -l)" >> $GITHUB_ENV
- name: Push changes
if: env.NUM_MODIFIED != 0
shell: bash
run: |
git config core.fileMode false
git config user.name github-actions
git config user.email [email protected]
git add .
git commit -m "updating copyrights from pre merge check in github action"
git push -f origin HEAD:${{ steps.extract_branch.outputs.branch }}
test_github_pages:
needs: copyright
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
Expand All @@ -60,6 +27,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@v3

- name: Test Jekyll Build and Check Links
run: make tests

Expand All @@ -71,7 +39,7 @@ jobs:
uses: actions/checkout@v3
with:
ref: release
ssh-key: ${{ secrets.PUSH_FROM_WORKFLOW_TO_RETRIGGER }}

- name: Verify synchronized if release
shell: bash
run: |
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/publish_python_sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# publish_python_sdk.yml/Open GoPro, Version 2.0 (C) Copyright 2021 GoPro, Inc. (http://gopro.com/OpenGoPro).
# This copyright was auto-generated on Wed, Sep 1, 2021 5:05:35 PM

name: Publish the Python SDK to PyPi

on:
workflow_dispatch:

jobs:
build-and-publish:
name: Build and Publish
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Build and publish to pypi
uses: JRubics/[email protected]
with:
package_directory: ./demos/python/sdk_wireless_camera_control/
python_version: 3.11.4
pypi_token: ${{ secrets.PYTHON_SDK_PYPI_TOKEN }}
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
**/*.crt
/.build

/.env
**.log

/docs/ble/_sources/
/docs/ble/.doctrees/
/docs/ble/.buildinfo
/docs/ble/objects.inv

/test.html
/link_results
.vscode
Expand Down
26 changes: 19 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,50 @@ help: ## Display this help which is generated from Make goal comments
# Docker images are currently not public. So we build if pull fails for the local use case.
.PHONY: docker-setup
docker-setup:
-@docker-compose pull || docker-compose build
-@docker compose pull jekyll plant-uml || docker compose build jekyll plant-uml

.PHONY: docker-kill
docker-kill:
-@docker kill jekyll plant_uml > /dev/null 2>&1
-@docker kill jekyll plant-uml > /dev/null 2>&1

.PHONY: clean
clean: ## Clean cached jekyll files
@echo "🧼 Cleaning jekyll artifacts..."
-@docker-compose down > /dev/null 2>&1
-@docker compose down > /dev/null 2>&1
@rm -rf docs/_site docs/.jekyll-cache docs/.jekyll-metadata

.PHONY: serve
serve: docker-kill docker-setup
serve: ## Serve site locally
@echo COMMAND="-u http://localhost:4998/ -b \"\" -p 4998 serve" > .env
@docker-compose up
@docker compose up
@rm -rf .env

.PHONY: build
build: docker-setup
build: ## Build site for deployment
@echo COMMAND=\"-u ${BUILD_HOST_URL} -b ${BUILD_BASE_URL} build\" > .env
@docker-compose up --abort-on-container-exit
@docker compose up --abort-on-container-exit
@rm -rf .env

PROTO_BUILD_DIR=.build/protobuf/python/*
PYTHON_TUTORIAL_PROTO_DIR=demos/python/tutorial/tutorial_modules/tutorial_5_ble_protobuf/proto
PYTHON_SDK_PROTO_DIR=demos/python/sdk_wireless_camera_control/open_gopro/proto

.PHONY: protos
protos: ## Build generated code from protobuf files
@docker compose run --build --rm proto-build
@rm -rf ${PYTHON_TUTORIAL_PROTO_DIR}/*pb2.py* && mkdir -p ${PYTHON_TUTORIAL_PROTO_DIR}
@cp ${PROTO_BUILD_DIR} ${PYTHON_TUTORIAL_PROTO_DIR}
@rm -rf ${PYTHON_SDK_PROTO_DIR}/*pb2.py* && mkdir -p ${PYTHON_SDK_PROTO_DIR}
@cp ${PROTO_BUILD_DIR} ${PYTHON_SDK_PROTO_DIR}

.PHONY: tests
tests: docker-setup clean
tests: ## Serve, then run link checker. Times out after 5 minutes.
-@docker-compose pull linkchecker || docker-compose build linkchecker
-@docker compose pull linkchecker || docker compose build linkchecker
@echo COMMAND="-u http://jekyll:4998/ -b \"\" -p 4998 serve" > .env
@docker-compose --profile test up --abort-on-container-exit
@docker compose --profile test up --abort-on-container-exit
@rm -rf .env

.PHONY: copyright
Expand Down
2 changes: 1 addition & 1 deletion demos/csharp/webcam/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CSharp Webcam Demo

This demo implements a simple GUI to interact with a GoPro camera that supports [Open GoPro 2.0](https://gopro.github.io/OpenGoPro/http_2_0).
This demo implements a simple GUI to interact with a GoPro camera that supports [Open GoPro 2.0](https://gopro.github.io/OpenGoPro/http).

# Requirements

Expand Down
1 change: 1 addition & 0 deletions demos/kotlin/tutorial/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.idea/
*.iml
.gradle
/local.properties
Expand Down
2 changes: 1 addition & 1 deletion demos/kotlin/tutorial/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions demos/kotlin/tutorial/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions demos/kotlin/tutorial/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Tutorial2SendBleCommands(number: Int, name: String, prerequisites: List<Pr

private fun checkStatus(data: UByteArray) =
if (data[2].toUInt() == 0U) Timber.i("Command sent successfully")
else Timber.i("Command Failed")
else Timber.e("Command Failed")

@OptIn(ExperimentalUnsignedTypes::class)
@RequiresPermission(allOf = ["android.permission.BLUETOOTH_SCAN", "android.permission.BLUETOOTH_CONNECT"])
Expand All @@ -68,6 +68,8 @@ class Tutorial2SendBleCommands(number: Int, name: String, prerequisites: List<Pr
// Wait to receive the notification response, then check its status
checkStatus(receivedData.receive())

delay(3000)

// Load Preset Group
Timber.i("Loading Video Preset Group")
val loadPreset = ubyteArrayOf(0x04U, 0x3EU, 0x02U, 0x03U, 0xE8U)
Expand Down
Loading

0 comments on commit 4d35b1a

Please sign in to comment.