1name: Build binary packages
2
3on:
4  workflow_dispatch:
5  workflow_call:
6  push:
7    branches:
8        - 'master'
9    tags:
10        - '*'
11
12jobs:
13  build_linux:
14    name: Build binary on Ubuntu 20.04
15    runs-on: ubuntu-20.04
16
17    steps:
18      - name: Check out code from GitHub
19        uses: actions/checkout@v2
20        with:
21          path: nanopb
22          fetch-depth: "0"
23
24      - name: Install dependencies
25        run: |
26          python3 -m pip install --user --upgrade scons protobuf grpcio-tools pyinstaller
27          python3 -c 'import google.protobuf; print(google.protobuf.__file__)'
28
29      - name: Build binary package
30        run: |
31          cd nanopb
32          git clean -dxf
33          tools/make_linux_package.sh
34
35      - name: Fingerprint binary
36        run: |
37          openssl sha256 nanopb/dist/*.tar.gz
38
39      - name: Upload binary
40        uses: actions/upload-artifact@v2
41        with:
42          path: nanopb/dist/*.tar.gz
43          name: nanopb-binary-linux
44
45      - name: Test binary package
46        run: |
47          tar xzf nanopb/dist/*.tar.gz
48          cd nanopb-*/tests
49          python3 -m SCons
50
51      - name: Test examples
52        run: |
53          cd nanopb-*/examples
54          (cd simple; make; ./simple)
55          (cd network_server; make)
56          (cd using_union_messages; make)
57          (cd cmake_simple; mkdir build; cd build; cmake ..; make)
58          (cd cmake_relpath; mkdir build; cd build; cmake ..; make)
59
60  build_windows:
61    name: Build binary on Windows 2019
62    runs-on: windows-2019
63
64    steps:
65      - name: Check out code from GitHub
66        uses: actions/checkout@v2
67        with:
68          path: nanopb
69          fetch-depth: "0"
70
71      - name: Install dependencies
72        shell: bash
73        run: |
74          python3 -m pip install --user --upgrade scons protobuf grpcio-tools pyinstaller
75          python3 -c 'import google.protobuf; print(google.protobuf.__file__)'
76
77      - name: Build binary package
78        shell: bash
79        run: |
80          cd nanopb
81          git clean -dxf
82          tools/make_windows_package.sh
83
84      - name: Fingerprint binary
85        run: |
86          openssl sha256 nanopb/dist/*.zip
87
88      - name: Upload binary
89        uses: actions/upload-artifact@v2
90        with:
91          path: nanopb/dist/*.zip
92          name: nanopb-binary-windows
93
94      - name: Test binary package
95        shell: bash
96        run: |
97          powershell "Expand-Archive nanopb/dist/*.zip"
98          ls
99          cd nanopb-*/nanopb-*/tests
100          python3 -m SCons
101
102  build_macos:
103    name: Build binary on Mac OS X Big Sur 11
104    runs-on: macos-11
105
106    steps:
107      - name: Check out code from GitHub
108        uses: actions/checkout@v2
109        with:
110          path: nanopb
111          fetch-depth: "0"
112
113      - name: Install dependencies
114        run: |
115          python3 -m pip install --user --upgrade scons protobuf grpcio-tools pyinstaller
116          python3 -c 'import google.protobuf; print(google.protobuf.__file__)'
117
118      - name: Build binary package
119        run: |
120          cd nanopb
121          git clean -dxf
122          tools/make_mac_package.sh
123
124      - name: Fingerprint binary
125        run: |
126          openssl sha256 nanopb/dist/*.tar.gz
127
128      - name: Upload binary
129        uses: actions/upload-artifact@v2
130        with:
131          path: nanopb/dist/*.tar.gz
132          name: nanopb-binary-macos
133
134      - name: Test binary package
135        run: |
136          tar xzf nanopb/dist/*.tar.gz
137          cd nanopb-*/tests
138          python3 -m SCons
139          cd ../examples/simple
140          make
141          ./simple
142
143
144