[Build] Update workflows for pr build (#1938)
[platform/core/csapi/tizenfx.git] / .github / workflows / build-pull-request.yml
1 name: "Build Pull Request"
2
3 on:
4   pull_request:
5     branches:
6     - master
7     - API*
8
9 jobs:
10
11   build:
12     runs-on: ubuntu-latest
13     steps:
14     - uses: actions/checkout@v2
15
16     - name: Setup .NET Core
17       uses: actions/setup-dotnet@v1
18       with:
19         dotnet-version: 3.1.x
20
21     - name: Get Changed Files
22       uses: lots0logs/gh-action-get-changed-files@2.1.4
23       id: getChangedFiles
24       with:
25         token: ${{ secrets.GITHUB_TOKEN }}
26
27     - name: Build
28       id: build
29       uses: TizenAPI/tizenfx-build-actions/problem-filter@master
30       with:
31         run: ./build.sh full /p:BuildWithAnalyzer=True -consoleloggerparameters:NoSummary
32         files: ${{ steps.getChangedFiles.outputs.all }}
33
34     - name: Save Error Report
35       if: ${{ failure() && steps.build.outputs.errors }}
36       env:
37         BUILD_ERRORS: ${{ steps.build.outputs.errors }}
38       run: |
39         mkdir Artifacts
40         echo $BUILD_ERRORS > Artifacts/errors.json
41
42     - name: Pack
43       run: ./build.sh pack
44
45     - name: Checkout APITool
46       uses: actions/checkout@v2
47       with:
48         repository: TizenAPI/APITool
49         path: .apitool
50
51     - name: Extract API
52       run: |
53         dotnet run -p .apitool/ \
54             -- print --format=json --include-hidden \
55             -o Artifacts/api.json Artifacts/bin/public/
56
57     - uses: actions/upload-artifact@v2
58       if: ${{ always() }}
59       with:
60         name: reports
61         if-no-files-found: ignore
62         path: Artifacts/*.json
63
64   check-api:
65     needs: [build]
66     runs-on: ubuntu-latest
67     steps:
68     - uses: actions/checkout@v2
69       with:
70         ref: ${{ github.base_ref }}
71
72     - name: Setup .NET Core
73       uses: actions/setup-dotnet@v1
74       with:
75         dotnet-version: 3.1.x
76
77     - name: Build Base Branch
78       uses: TizenAPI/tizenfx-build-actions/problem-filter@master
79       with:
80         run: ./build.sh full
81
82     - name: Checkout APITool
83       uses: actions/checkout@v2
84       with:
85         repository: TizenAPI/APITool
86         path: .apitool
87
88     - name: Extract Base API
89       run: |
90         dotnet run -p .apitool/ \
91             -- print --format=json --include-hidden \
92             -o Artifacts/base-api.json Artifacts/bin/public/
93
94     - name: Download Artifacts
95       uses: actions/download-artifact@v2
96       with:
97         name: reports
98         path: Artifacts
99
100     - name: Check API Compatibilities
101       uses: TizenAPI/tizenfx-build-actions/apidb-compare@master
102       with:
103         file: Artifacts/api.json
104         base-file: Artifacts/base-api.json
105         output: Artifacts/api-comp.json
106
107     - uses: actions/upload-artifact@v2
108       with:
109         name: reports
110         path: Artifacts/api-comp.json