summaryrefslogtreecommitdiff
path: root/.github/workflows/main.yml
blob: 0f0686b6b558a15a9401bf34181ff70fb9410b0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# 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

on:
  push:
    branches: [ master, develop ]
    paths-ignore:
      - 'doc/**'
      - 'images/**'
      - '**.md'
  pull_request:
    branches: [ develop ]
    paths-ignore:
      - 'doc/**'
      - 'images/**'
      - '**.md'
  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    container:
      image: infinitime/infinitime-build
    steps:
      # This workaround fixes the error "unsafe repository (REPO is owned by someone else)".
      # See https://github.com/actions/checkout/issues/760 and https://github.com/actions/checkout/issues/766
      # The fix in "actions/checkout@v2" was not sufficient as the build process also uses git (to get the current
      # commit hash, for example).
      - name: Workaround permission issues
        run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
      - name: Checkout source files
        uses: actions/checkout@v2
        with:
          submodules: recursive
      - name: Build
        shell: bash
        env:
          SOURCES_DIR: .
        run: /opt/build.sh all
      # Unzip the package because Upload Artifact will zip up the files
      - name: Unzip DFU package
        run: unzip ./build/output/pinetime-mcuboot-app-dfu-*.zip -d ./build/output/pinetime-mcuboot-app-dfu
      - name: Upload DFU artifacts
        uses: actions/upload-artifact@v3
        with:
          name: InfiniTime DFU ${{ github.head_ref }}
          path: ./build/output/pinetime-mcuboot-app-dfu/*
      - name: Upload MCUBoot image artifacts
        uses: actions/upload-artifact@v3
        with:
          name: InfiniTime MCUBoot image ${{ github.head_ref }}
          path: ./build/output/pinetime-mcuboot-app-image-*.bin