diff options
Diffstat (limited to '.github')
| -rw-r--r-- | .github/workflows/docker.yml | 70 | ||||
| -rw-r--r-- | .github/workflows/format.yml | 5 | ||||
| -rw-r--r-- | .github/workflows/lv_sim.yml | 66 | ||||
| -rw-r--r-- | .github/workflows/main.yml | 55 |
4 files changed, 119 insertions, 77 deletions
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..8d45fe08 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,70 @@ +name: Build and push Docker image + +on: + push: + branches: [ develop ] + paths: + - 'docker/**' + pull_request: + branches: [ develop ] + paths: + - 'docker/**' + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + env: + USERNAME: infinitime + steps: + - uses: actions/checkout@v3 + + - name: Log in to Docker Hub + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_HUB_LOGIN_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Set up Docker metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: | + ${{ secrets.DOCKER_HUB_IMAGE_USERNAME || env.USERNAME }}/infinitime-build + tags: | + type=sha + type=raw,value=latest + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + + - name: Build and push + if: github.event_name != 'pull_request' + uses: docker/build-push-action@v3 + with: + context: ./docker/ + file: ./docker/Dockerfile + platforms: linux/amd64,linux/arm64 + builder: ${{ steps.buildx.outputs.name }} + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_IMAGE_USERNAME || env.USERNAME }}/infinitime-build:buildcache + cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_IMAGE_USERNAME || env.USERNAME }}/infinitime-build:buildcache,mode=max + + - name: Build + if: github.event_name == 'pull_request' + uses: docker/build-push-action@v3 + with: + context: ./docker/ + file: ./docker/Dockerfile + platforms: linux/amd64,linux/arm64 + builder: ${{ steps.buildx.outputs.name }} + push: false + cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_IMAGE_USERNAME || env.USERNAME }}/infinitime-build:buildcache diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 9ebacc03..714c60bf 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -2,11 +2,12 @@ name: Code formatting on: pull_request: - branches: [ master, develop ] + branches: [ develop ] paths: - '**.cpp' - '**.h' - '!src/libs/**' + - '!src/FreeRTOS/**' jobs: test-format: @@ -18,8 +19,6 @@ jobs: - name: Configure git run: | - git config --global user.email "-" - git config --global user.name "Autoformatter" git fetch origin "$GITHUB_BASE_REF":"$GITHUB_BASE_REF" --depth=1000 - name: Install clang-format diff --git a/.github/workflows/lv_sim.yml b/.github/workflows/lv_sim.yml deleted file mode 100644 index aa71260f..00000000 --- a/.github/workflows/lv_sim.yml +++ /dev/null @@ -1,66 +0,0 @@ -# GitHub Actions Workflow to build Simulator for PineTime Smart Watch LVGL Interface - -name: Build PineTime LVGL Simulator - -on: - push: - branches: [ master, develop ] - pull_request: - branches: [ master, develop ] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - ######################################################################################### - # Download and Install Dependencies - - - name: Install cmake - uses: lukka/get-cmake@v3.18.3 - - - name: Install SDL2 development package - run: | - sudo apt-get update - sudo apt-get -y install libsdl2-dev - - - name: Install lv_font_conv - run: - npm i -g lv_font_conv@1.5.2 - - ######################################################################################### - # Checkout - - - name: Checkout source files - uses: actions/checkout@v2 - with: - submodules: recursive - - ######################################################################################### - # get InfiniSim repo - - - name: Get InfiniSim repo - run: | - git clone https://github.com/InfiniTimeOrg/InfiniSim.git --depth 1 --branch main - git -C InfiniSim submodule update --init lv_drivers libpng - - ######################################################################################### - # CMake - - - name: CMake - run: | - cmake -G Ninja -S InfiniSim -B build_lv_sim -DInfiniTime_DIR="${PWD}" - - ######################################################################################### - # Build and Upload simulator - - - name: Build simulator executable - run: | - cmake --build build_lv_sim - - - name: Upload simulator executable - uses: actions/upload-artifact@v3 - with: - name: infinisim-${{ github.head_ref }} - path: build_lv_sim/infinisim diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8d129726..b8a70b6e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,18 +1,18 @@ -# GitHub Actions Workflow to build FreeRTOS Firmware for PineTime Smart Watch -# See https://lupyuen.github.io/pinetime-rust-mynewt/articles/cloud -# Based on https://github.com/JF002/InfiniTime/blob/master/doc/buildAndProgram.md -# and https://github.com/JF002/InfiniTime/blob/master/bootloader/README.md - -name: Build PineTime Firmware +name: CI +# Run this workflow whenever the build may be affected on: push: branches: [ master, develop ] + paths-ignore: + - 'doc/**' pull_request: - branches: [ master, develop ] + branches: [ develop ] + paths-ignore: + - 'doc/**' jobs: - build: + build-firmware: runs-on: ubuntu-latest container: image: infinitime/infinitime-build @@ -45,3 +45,42 @@ jobs: with: name: InfiniTime MCUBoot image ${{ github.head_ref }} path: ./build/output/pinetime-mcuboot-app-image-*.bin + + build-simulator: + runs-on: ubuntu-latest + steps: + - name: Install cmake + uses: lukka/get-cmake@v3.18.3 + + - name: Install SDL2 development package + run: | + sudo apt-get update + sudo apt-get -y install libsdl2-dev + + - name: Install lv_font_conv + run: + npm i -g lv_font_conv@1.5.2 + + - name: Checkout source files + uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Get InfiniSim repo + run: | + git clone https://github.com/InfiniTimeOrg/InfiniSim.git --depth 1 --branch main + git -C InfiniSim submodule update --init lv_drivers libpng + + - name: CMake + run: | + cmake -G Ninja -S InfiniSim -B build_lv_sim -DInfiniTime_DIR="${PWD}" + + - name: Build simulator executable + run: | + cmake --build build_lv_sim + + - name: Upload simulator executable + uses: actions/upload-artifact@v3 + with: + name: infinisim-${{ github.head_ref }} + path: build_lv_sim/infinisim |
