~aleteoryx/muditaos

ref: e9d2aaf28bbf17585163f2c0c4eaf7c7df8f5ff4 muditaos/.github/workflows/main.yml -rw-r--r-- 4.9 KiB
e9d2aaf2 — Radoslaw Wicik [EGD-5665] Switch CI to ninja 5 years ago
                                                                                
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: CI

on:
  pull_request:
    types:
      - opened
      - synchronize
      - reopened
      - ready_for_review

jobs:
  check_commit_messages:
    name: check commit messages
    if: github.event.pull_request.draft == false
    runs-on: self-hosted
    steps:
      - name: clone repository
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: check commit messages
        run: ./tools/check_commit_messages.py
  check_copyright_and_style:
    name: check copyright and style
    if: github.event.pull_request.draft == false
    runs-on: self-hosted
    steps:
      - name: clone repository
        uses: actions/checkout@v2
        with:
          token: ${{ secrets.GitHub_PAT }}
          fetch-depth: 0
          submodules: recursive
      - name: Copyright notice check
        run: config/license_header_check.sh --ci --check-only
      - name: Style checking
        run: ./config/style_check_hook.sh --last

  build_rt1051_binary:
    name: build rt1051 binary
    if: github.event.pull_request.draft == false
    needs:
      - check_copyright_and_style
    runs-on: self-hosted
    steps:
      - name: clone repository
        uses: actions/checkout@v2
        with:
          token: ${{ secrets.GitHub_PAT }}
          submodules: recursive
      - name: Build for RT1051
        run: |
          export JOBS=${JOBS:-$(nproc)} && \
          echo "JOBS=${JOBS}" &&  \
          ./configure.sh rt1051 Release -G Ninja && \
          pushd build-rt1051-Release && \
          ninja -j ${JOBS} && \
          popd 

  build_linux_binary_and_run_tests:
    name: build linux binary and run tests
    if: github.event.pull_request.draft == false
    needs:
      - check_copyright_and_style
    runs-on: self-hosted
    steps:
      - name: clone repository
        uses: actions/checkout@v2
        with:
          token: ${{ secrets.GitHub_PAT }}
          submodules: recursive
      - name: build linux binary
        run: |
          export JOBS=${JOBS:-$(nproc)} && \
          echo "JOBS=${JOBS}" &&  \
          ./configure.sh linux Debug -G Ninja && \
          pushd build-linux-Debug && \
          ninja -j ${JOBS} && \
          popd
      - name: Check for statics
        run: ./tools/find_global_data.py build-linux-Debug/PurePhone.elf
      - name: build unit tests
        run: |
          export JOBS=${JOBS:-$(nproc)} && \
          echo "JOBS=${JOBS}" &&  \
          pushd build-linux-Debug && \
          ninja -j ${JOBS} unittests && \
          popd
      - name: run unit tests
        run: |
          ./tools/run_unittests.sh enabled_unittests
      - name: store build artefact
        run: |
          tar -S -cf /artefacts/build-$(git rev-parse --short HEAD).tar build-linux-Debug
      - name: start emulator
        run: |
          ./run_emulator_on_filesystem_image.sh 2>&1 > emulator.log &
          echo $! > emulator.pid
      - name: run tests
        run: pytest ./pytest -rP --port=simulator --timeout=20 -m 'not rt1051'
        working-directory: test
      - name: kill emulator
        run: |
          kill $(cat emulator.pid)
          rm emulator.pid
        if: always()
      - name: print emulator logs
        run: cat emulator.log
        if: always()

  #emulator_on_off_test:
  #Enable this test in "Clean artefacts"
  #  name: emulator on-off test
  #  if: github.event.pull_request.draft == false
  #  runs-on: self-hosted
  #  needs:
  #    - build_linux_binary_and_run_tests
  #  steps:
  #    - name: clone repository
  #      uses: actions/checkout@v2
  #      with:
  #        token: ${{ secrets.GitHub_PAT }}
  #        submodules: recursive
  #    - name: get artefacts
  #      run: |
  #        tar xf /artefacts/build-$(git rev-parse --short HEAD).tar
  #    - name: start emulator on-off test
  #      run: ./phone_on_off_test.sh
  #      working-directory: test
  #    - name: print emulator logs
  #      run: cat emulator.log
  #      if: always()

  check_run_unit_tests:
    name: Check run unit tests
    needs:
      - build_linux_binary_and_run_tests
    runs-on: self-hosted
    steps:
      - name: clone repository
        uses: actions/checkout@v2
        with:
          token: ${{ secrets.GitHub_PAT }}
          submodules: recursive
      - name: get artefacts
        run: |
          tar xf /artefacts/build-$(git rev-parse --short HEAD).tar
      - name: check if all Unit Tests where run
        run: |
          ./tools/check_unittests.sh enabled_unit_tests

  clean_artefacts:
    name: Clean Artefacts
    if: always()
    #needs: [ build_linux_binary_and_run_tests, emulator_on_off_test, check_run_unit_tests ]
    needs: [ build_linux_binary_and_run_tests, check_run_unit_tests ]
    runs-on: self-hosted
    steps:
      - name: clone repository
        uses: actions/checkout@v2
        with:
          token: ${{ secrets.GitHub_PAT }}
          submodules: recursive
      - name: Delete Artefact
        run: |
          rm -f /artefacts/build-$(git rev-parse --short HEAD).tar