浏览代码

Add github workflow

Bobholamovic 2 年之前
父节点
当前提交
cef8aa2607
共有 1 个文件被更改,包括 78 次插入0 次删除
  1. 78 0
      .github/workflows/build_and_test.yaml

+ 78 - 0
.github/workflows/build_and_test.yaml

@@ -0,0 +1,78 @@
+name: build and test
+
+on:
+  pull_request:
+    branches:
+      - develop
+    paths-ignore:
+      - ".github/**"
+      - "docs/**"
+      - "README.md"
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+
+jobs:
+  build_and_test_cpu:
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        os: [ubuntu-latest, windows-latest]
+        python-version: ["3.7", "3.8"]
+    steps:
+      - uses: actions/checkout@v3
+      - name: Set up Python ${{ matrix.python-version }}
+        uses: actions/setup-python@v4
+        with:
+          python-version: ${{ matrix.python-version }}
+      - name: Upgrade pip
+        run: python -m pip install pip --upgrade --user
+      - name: Install PaddlePaddle
+        run: python -m pip install paddlepaddle==2.3.1 -i https://mirror.baidu.com/pypi/simple
+      - name: Install PaddleRS
+        run: |
+          pip install -r requirements.txt
+          pip install -e .
+      - name: Install pre-commit hooks
+        run: |
+          pip install pre-commit
+          pre-commit install
+      - name: Lint
+        run: pre-commit run --all-files
+      - name: Run unittests
+        run: |
+          cd tests
+          bash check_coverage.sh
+        shell: bash
+
+  build_and_test_cuda102:
+    runs-on: ubuntu-latest
+    container:
+      image: registry.baidubce.com/paddlepaddle/paddle:2.3.1-gpu-cuda10.2-cudnn7
+    strategy:
+      matrix:
+        python-version: ["3.7", "3.8"]
+    steps:
+      - uses: actions/checkout@v3
+      - name: Set up Python ${{ matrix.python-version }}
+        uses: actions/setup-python@v4
+        with:
+          python-version: ${{ matrix.python-version }}
+      - name: Upgrade pip
+        run: python -m pip install pip --upgrade --user
+      - name: Install PaddleRS
+        run: |
+          pip install -r requirements.txt
+          pip install -e .
+      - name: Install pre-commit hooks
+        run: |
+          pip install pre-commit
+          pre-commit install
+      - name: Lint
+        run: pre-commit run --all-files
+      - name: Run unittests
+        run: |
+          cd tests
+          bash check_coverage.sh
+        shell: bash