Merge remote-tracking branch 'origin/API8' into tizen_6.0
[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     - DevelNUI
8     - API*
9
10 jobs:
11
12   build:
13     runs-on: ubuntu-latest
14     steps:
15     - uses: actions/checkout@v2
16
17     - name: Setup .NET Core
18       uses: actions/setup-dotnet@v1
19       with:
20         dotnet-version: 3.1.402
21
22     - name: Get Changed Files
23       uses: lots0logs/gh-action-get-changed-files@2.1.4
24       id: getChangedFiles
25       with:
26         token: ${{ secrets.GITHUB_TOKEN }}
27
28     - name: Build
29       id: build
30       uses: TizenAPI/tizenfx-build-actions/problem-filter@master
31       with:
32         run: ./build.sh full /p:BuildWithAnalyzer=True -consoleloggerparameters:NoSummary
33         files: ${{ steps.getChangedFiles.outputs.all }}
34
35     - name: Save Error Report
36       if: ${{ failure() && steps.build.outputs.errors }}
37       env:
38         BUILD_ERRORS: ${{ steps.build.outputs.errors }}
39       run: |
40         mkdir Artifacts
41         echo $BUILD_ERRORS > Artifacts/errors.json
42
43     - name: Pack
44       run: ./build.sh pack
45
46     - name: Checkout APITool
47       uses: actions/checkout@v2
48       with:
49         repository: TizenAPI/APITool
50         path: .apitool
51
52     - name: Extract API Spec
53       run: |
54         dotnet run -p .apitool/ \
55             -- print --format=json --include-hidden \
56             -o Artifacts/api.json Artifacts/bin/public/
57
58     - uses: actions/upload-artifact@v2
59       if: ${{ always() }}
60       with:
61         name: reports
62         if-no-files-found: ignore
63         path: Artifacts/*.json
64
65   check-api:
66     needs: [build]
67     runs-on: ubuntu-latest
68     steps:
69     - name: Setup .NET Core
70       uses: actions/setup-dotnet@v1
71       with:
72         dotnet-version: 3.1.x
73
74     - name: Download Artifacts
75       uses: actions/download-artifact@v2
76       with:
77         name: reports
78         path: Artifacts
79
80     - name: Download Base API Spec
81       id: base-spec
82       uses: TizenAPI/tizenfx-build-actions/s3-download-public@master
83       with:
84         region: ap-northeast-2
85         bucket: tizenfx-api-specs
86         key: ${{ github.event.pull_request.base.sha }}.json
87         path: Artifacts/base-api.json
88
89     - uses: actions/checkout@v2
90       if: ${{ steps.base-spec.outputs.code != 200 }}
91       with:
92         ref: ${{ github.event.pull_request.base.sha }}
93         path: base
94
95     - name: Build Base Branch
96       if: ${{ steps.base-spec.outputs.code != 200 }}
97       uses: TizenAPI/tizenfx-build-actions/problem-filter@master
98       with:
99         run: ./build.sh full
100         working-directory: base
101
102     - name: Checkout APITool
103       if: ${{ steps.base-spec.outputs.code != 200 }}
104       uses: actions/checkout@v2
105       with:
106         repository: TizenAPI/APITool
107         path: .apitool
108
109     - name: Extract Base API
110       if: ${{ steps.base-spec.outputs.code != 200 }}
111       run: |
112         dotnet run -p .apitool/ \
113             -- print --format=json --include-hidden \
114             -o Artifacts/base-api.json base/Artifacts/bin/public/
115
116     - name: Check API Compatibilities
117       uses: TizenAPI/tizenfx-build-actions/apidb-compare@master
118       with:
119         file: Artifacts/api.json
120         base-file: Artifacts/base-api.json
121         output: Artifacts/api-comp.json
122
123     - uses: actions/upload-artifact@v2
124       with:
125         name: reports
126         path: Artifacts/api-comp.json