diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..2012dc3 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,63 @@ +name: Deploy new version + +# Only deploy when a new tag is pushed +on: [push, pull_request] + +# Must match the project() name in CMakeLists.txt +env: + APP_NAME: Telemetrix4RpiPico + +# Allow this workflow to write back to the repository +permissions: + contents: write + +# Build binary and send to releases +jobs: + build-deploy: + runs-on: ubuntu-latest + name: Build and deploy + steps: + + - name: Check out this repository + uses: actions/checkout@v3 + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + + - name: Cache register + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile') }} + + - name: Build Docker image + uses: docker/build-push-action@v5 + with: + context: ./ + file: ./Dockerfile + builder: ${{ steps.buildx.outputs.name }} + load: true + tags: pico-builder-container:latest + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + + - name: Build + run: docker run -v ./:/project/src/ pico-builder-container + + - name: Copy uf2 file + run: cp ./build2/Telemetrix4RpiPico.uf2 ./ + + - name: Put environment variable into the env context + run: echo "app_name=$APP_NAME" >> $GITHUB_ENV + - name: Archive production artifacts + uses: actions/upload-artifact@v3 + with: + name: dist + path: | + Telemetrix4RpiPico.uf2 + + - name: Push to release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: Telemetrix4RpiPico.uf2 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c07ed18 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +# Fetch ubuntu image +FROM ubuntu:22.04 + +# Install prerequisites +RUN \ + apt update && \ + apt install -y git python3 && \ + apt install -y cmake gcc-arm-none-eabi libnewlib-arm-none-eabi build-essential + +# Install Pico SDK +RUN \ + mkdir -p /project/src/ && \ + cd /project/ && \ + git clone https://github.com/raspberrypi/pico-sdk.git --branch master && \ + cd pico-sdk/ && \ + git submodule update --init && \ + cd / + +# Set the Pico SDK environment variable +ENV PICO_SDK_PATH=/project/pico-sdk/ + +# Copy in our source files +COPY build.sh /root/ +RUN chmod +x /root/build.sh +# Build project +# RUN \ +# mkdir -p /project/src/build && \ +# cd /project/src/build && \ +# cmake .. && \ +# make + +# Command that will be invoked when the container starts +ENTRYPOINT ["/root/build.sh"] \ No newline at end of file diff --git a/README.md b/README.md index cf9b62c..80f8180 100644 --- a/README.md +++ b/README.md @@ -29,3 +29,5 @@ PC. A complete [User's Guide](https://mryslab.github.io/telemetrix-rpi-pico/) is install and use both the server and client. To install the server, follow these [installation instructions](https://mryslab.github.io/telemetrix-rpi-pico/install_pico_server/). + +Test push diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..cef9f3e --- /dev/null +++ b/build.sh @@ -0,0 +1,9 @@ +#!/bin/bash +cd /project/src/ +ls +ls .. +mkdir build2/ +ls +cd build2 +cmake -DCMAKE_BUILD_TYPE=Release .. +make \ No newline at end of file