1name: CI
2
3on:
4  push:
5  pull_request:
6  workflow_dispatch:
7  release:
8    types: [published]
9
10jobs:
11  build_mac:
12    name: Build on macOS
13    runs-on: macos-10.15
14    steps:
15      - uses: actions/checkout@v2
16      - run: ./unixbuild.sh
17      - name: Upload to artifacts
18        uses: actions/upload-artifact@v2
19        with:
20          name: macOS builds
21          path: dist/*.zip
22      - name: Upload to releases
23        if: github.event_name == 'release'
24        uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
25        with:
26          repo_token: ${{ secrets.GITHUB_TOKEN }}
27          file: dist/*.zip
28          tag: ${{ github.ref }}
29          file_glob: true
30
31  build_linux:
32    name: Build on Linux
33    runs-on: ubuntu-20.04
34    steps:
35      - uses: actions/checkout@v2
36      - name: Get Qt
37        run: sudo apt-get install -qq qt5-default qt5-qmake qtbase5-dev-tools cmake
38      - run: ./unixbuild.sh
39      - name: Upload to artifacts
40        uses: actions/upload-artifact@v2
41        with:
42          name: Linux builds
43          path: dist/*.zip
44      - name: Upload to releases
45        if: github.event_name == 'release'
46        uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
47        with:
48          repo_token: ${{ secrets.GITHUB_TOKEN }}
49          file: dist/*.zip
50          tag: ${{ github.ref }}
51          file_glob: true
52
53  build_win_extract:
54    name: Build on Windows
55    runs-on: windows-2016
56    steps:
57      - uses: actions/checkout@v2
58
59      - name: Get Qt
60        uses: actions/checkout@v2
61        with:
62          repository: LongSoft/qt-5.6.3-static-x86-msvc2017
63          path: qt
64          lfs: true
65      - name: Unpack Qt
66        shell: bash
67        working-directory: qt
68        run: 7z x qt-5.6.3-static-x86-msvc2017.7z -o../..
69      - name: Create dist directory
70        shell: bash
71        run: mkdir dist
72
73      - name: Create UEFIExtract build directory
74        run: cmake -E make_directory ${{runner.workspace}}/build/UEFIExtract
75      - name: Configure UEFIExtract
76        shell: bash
77        working-directory: ${{runner.workspace}}/build/UEFIExtract
78        run: cmake -G "Visual Studio 15 2017" -T "v141_xp" -DU_STATIC_RT=YES ../../UEFITool/UEFIExtract/
79      - name: Build UEFIExtract
80        working-directory: ${{runner.workspace}}/build/UEFIExtract
81        shell: bash
82        run: cmake --build . --config Release
83      - name: Archive UEFIExtract
84        working-directory: ${{runner.workspace}}/build/UEFIExtract/Release
85        shell: bash
86        run: |
87          UEFITOOL_VER=$(cat ../../../UEFITool/version.h | grep PROGRAM_VERSION | cut -d'"' -f2 | sed 's/NE alpha /A/') ; \
88          7z a ../../../UEFITool/dist/UEFIExtract_NE_${UEFITOOL_VER}_win32.zip UEFIExtract.exe
89
90      - name: Create UEFIFind build directory
91        run: cmake -E make_directory ${{runner.workspace}}/build/UEFIFind
92      - name: Configure UEFIFind
93        shell: bash
94        working-directory: ${{runner.workspace}}/build/UEFIFind
95        run: cmake -G "Visual Studio 15 2017" -T "v141_xp" -DU_STATIC_RT=YES ../../UEFITool/UEFIFind/
96      - name: Build UEFIFind
97        working-directory: ${{runner.workspace}}/build/UEFIFind
98        shell: bash
99        run: cmake --build . --config Release
100      - name: Archive UEFIFind
101        working-directory: ${{runner.workspace}}/build/UEFIFind/Release
102        shell: bash
103        run: |
104          UEFITOOL_VER=$(cat ../../../UEFITool/version.h | grep PROGRAM_VERSION | cut -d'"' -f2 | sed 's/NE alpha /A/') ; \
105          7z a ../../../UEFITool/dist/UEFIFind_NE_${UEFITOOL_VER}_win32.zip UEFIFind.exe
106
107      - name: Create UEFITool build directory
108        run: cmake -E make_directory ${{runner.workspace}}/build/UEFITool
109      - name: Configure UEFITool
110        shell: bash
111        working-directory: ${{runner.workspace}}/build/UEFITool
112        run: ../../qt-5.6.3-static-x86-msvc2017/bin/qmake.exe ../../UEFITool/UEFITool/
113      - name: Build UEFITool
114        working-directory: ${{runner.workspace}}/build/UEFITool
115        shell: cmd
116        run: |
117            call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars32.bat"
118            nmake release
119      - name: Archive UEFITool
120        working-directory: ${{runner.workspace}}/build/UEFITool/release
121        shell: bash
122        run: |
123          UEFITOOL_VER=$(cat ../../../UEFITool/version.h | grep PROGRAM_VERSION | cut -d'"' -f2 | sed 's/NE alpha /A/') ; \
124          7z a ../../../UEFITool/dist/UEFITool_NE_${UEFITOOL_VER}_win32.zip UEFITool.exe
125
126      - name: Upload to artifacts
127        uses: actions/upload-artifact@v2
128        with:
129          name: Windows builds
130          path: dist/*.zip
131      - name: Windows to releases
132        if: github.event_name == 'release'
133        uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
134        with:
135          repo_token: ${{ secrets.GITHUB_TOKEN }}
136          file: dist/*.zip
137          tag: ${{ github.ref }}
138          file_glob: true
139
140  analyze_coverity:
141    env:
142      PROJECT_TYPE: TOOL
143      JOB_TYPE: COVERITY
144    if: github.repository_owner == 'LongSoft' && github.event_name != 'pull_request'
145    name: Analyze Coverity
146    runs-on: macos-10.15
147    steps:
148      - name: CI Bootstrap
149        run: |
150          src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/ocbuild/master/ci-bootstrap.sh) && eval "$src" || exit 1
151      - uses: actions/checkout@v2
152      - run: ./unixbuild.sh --configure
153      - name: Run Coverity
154        run: |
155          src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/ocbuild/master/coverity/covstrap.sh) && eval "$src" || exit 1
156        env:
157          COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
158          COVERITY_SCAN_EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }}
159          COVERITY_BUILD_COMMAND: ./unixbuild.sh --build
160