[Build] Add workflow files to API7 branch (#2031)
authorWonYoung Choi <wy80.choi@samsung.com>
Fri, 18 Sep 2020 08:15:22 +0000 (17:15 +0900)
committerGitHub <noreply@github.com>
Fri, 18 Sep 2020 08:15:22 +0000 (17:15 +0900)
.github/workflows/build-branches.yml [new file with mode: 0644]
.github/workflows/build-pull-request.yml [new file with mode: 0644]
.github/workflows/check-api-level.yml [new file with mode: 0644]

diff --git a/.github/workflows/build-branches.yml b/.github/workflows/build-branches.yml
new file mode 100644 (file)
index 0000000..302afff
--- /dev/null
@@ -0,0 +1,50 @@
+name: Build Branches
+
+on:
+  push:
+    branches:
+    - master
+    - API*
+
+    paths:
+    - 'build/**'
+    - 'internals/**'
+    - 'src/**'
+    - 'tools/**'
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+
+    - name: Setup .NET Core
+      uses: actions/setup-dotnet@v1
+      with:
+        dotnet-version: 3.1.x
+
+    - name: Build
+      run: ./build.sh full
+
+    - name: Checkout APITool
+      uses: actions/checkout@v2
+      with:
+        repository: TizenAPI/APITool
+        path: .apitool
+
+    - name: Extract API
+      run: |
+        dotnet run -p .apitool/ \
+            -- print --format=json --include-hidden \
+            -o Artifacts/api.json Artifacts/bin/public/
+
+    - name: Upload API Spec to S3
+      uses: TizenAPI/tizenfx-build-actions/s3-upload@master
+      env:
+        AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
+        AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
+      with:
+        file: Artifacts/api.json
+        region: ap-northeast-2
+        bucket: tizenfx-api-specs
+        key: ${{ github.sha }}.json
diff --git a/.github/workflows/build-pull-request.yml b/.github/workflows/build-pull-request.yml
new file mode 100644 (file)
index 0000000..c98b20c
--- /dev/null
@@ -0,0 +1,125 @@
+name: "Build Pull Request"
+
+on:
+  pull_request:
+    branches:
+    - master
+    - API*
+
+jobs:
+
+  build:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+
+    - name: Setup .NET Core
+      uses: actions/setup-dotnet@v1
+      with:
+        dotnet-version: 3.1.x
+
+    - name: Get Changed Files
+      uses: lots0logs/gh-action-get-changed-files@2.1.4
+      id: getChangedFiles
+      with:
+        token: ${{ secrets.GITHUB_TOKEN }}
+
+    - name: Build
+      id: build
+      uses: TizenAPI/tizenfx-build-actions/problem-filter@master
+      with:
+        run: ./build.sh full /p:BuildWithAnalyzer=True -consoleloggerparameters:NoSummary
+        files: ${{ steps.getChangedFiles.outputs.all }}
+
+    - name: Save Error Report
+      if: ${{ failure() && steps.build.outputs.errors }}
+      env:
+        BUILD_ERRORS: ${{ steps.build.outputs.errors }}
+      run: |
+        mkdir Artifacts
+        echo $BUILD_ERRORS > Artifacts/errors.json
+
+    - name: Pack
+      run: ./build.sh pack
+
+    - name: Checkout APITool
+      uses: actions/checkout@v2
+      with:
+        repository: TizenAPI/APITool
+        path: .apitool
+
+    - name: Extract API Spec
+      run: |
+        dotnet run -p .apitool/ \
+            -- print --format=json --include-hidden \
+            -o Artifacts/api.json Artifacts/bin/public/
+
+    - uses: actions/upload-artifact@v2
+      if: ${{ always() }}
+      with:
+        name: reports
+        if-no-files-found: ignore
+        path: Artifacts/*.json
+
+  check-api:
+    needs: [build]
+    runs-on: ubuntu-latest
+    steps:
+    - name: Setup .NET Core
+      uses: actions/setup-dotnet@v1
+      with:
+        dotnet-version: 3.1.x
+
+    - name: Download Artifacts
+      uses: actions/download-artifact@v2
+      with:
+        name: reports
+        path: Artifacts
+
+    - name: Download Base API Spec
+      id: base-spec
+      uses: TizenAPI/tizenfx-build-actions/s3-download-public@master
+      with:
+        region: ap-northeast-2
+        bucket: tizenfx-api-specs
+        key: ${{ github.event.pull_request.base.sha }}.json
+        path: Artifacts/base-api.json
+
+    - uses: actions/checkout@v2
+      if: ${{ steps.base-spec.outputs.code != 200 }}
+      with:
+        ref: ${{ github.event.pull_request.base.sha }}
+        path: base
+
+    - name: Build Base Branch
+      if: ${{ steps.base-spec.outputs.code != 200 }}
+      uses: TizenAPI/tizenfx-build-actions/problem-filter@master
+      with:
+        run: ./build.sh full
+        working-directory: base
+
+    - name: Checkout APITool
+      if: ${{ steps.base-spec.outputs.code != 200 }}
+      uses: actions/checkout@v2
+      with:
+        repository: TizenAPI/APITool
+        path: .apitool
+
+    - name: Extract Base API
+      if: ${{ steps.base-spec.outputs.code != 200 }}
+      run: |
+        dotnet run -p .apitool/ \
+            -- print --format=json --include-hidden \
+            -o Artifacts/base-api.json base/Artifacts/bin/public/
+
+    - name: Check API Compatibilities
+      uses: TizenAPI/tizenfx-build-actions/apidb-compare@master
+      with:
+        file: Artifacts/api.json
+        base-file: Artifacts/base-api.json
+        output: Artifacts/api-comp.json
+
+    - uses: actions/upload-artifact@v2
+      with:
+        name: reports
+        path: Artifacts/api-comp.json
diff --git a/.github/workflows/check-api-level.yml b/.github/workflows/check-api-level.yml
new file mode 100644 (file)
index 0000000..7232766
--- /dev/null
@@ -0,0 +1,33 @@
+name: "Check API Level"
+
+on:
+  pull_request_target:
+    branches:
+    - master
+    - API*
+
+jobs:
+  add-labels:
+    runs-on: ubuntu-latest
+    steps:
+
+    - name: Get Branch Metadata
+      uses: TizenAPI/tizenfx-build-actions/branch-metadata@master
+      id: metadata
+      with:
+        ref: ${{ github.base_ref }}
+
+    - name: Add Labels
+      if: ${{ steps.metadata.outputs.data }}
+      uses: actions/github-script@v2
+      env:
+        BRANCH_METADATA: ${{ steps.metadata.outputs.data }}
+      with:
+        script: |
+          var metadata = JSON.parse(process.env.BRANCH_METADATA)
+          github.issues.addLabels({
+            issue_number: context.issue.number,
+            owner: context.repo.owner,
+            repo: context.repo.repo,
+            labels: metadata.labels
+          })