浏览代码

ci: test with openlibm-test (#327)

* make: add new target `gen-cov-report`

* ci: test with openlibm-test

* ci: checkout openlibm first

* ci: set OPENLIBM_HOME

* ci: update repo name
Chengyu Han 5 月之前
父节点
当前提交
d463259eaa
共有 3 个文件被更改,包括 38 次插入2 次删除
  1. 33 1
      .github/workflows/ci.yml
  2. 1 0
      .gitignore
  3. 4 1
      Makefile

+ 33 - 1
.github/workflows/ci.yml

@@ -42,7 +42,7 @@ jobs:
           install: base-devel mingw-w64-${{matrix.env}}-toolchain
       - run: make
       - run: make test
-  code-coverage:
+  code-coverage-old:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v4
@@ -50,6 +50,38 @@ jobs:
         uses: hrishikesh-kadam/setup-lcov@v1
       - name: Build and Run tests
         run: make coverage -j
+      # - name: Upload coverage to Codecov
+      #   uses: codecov/codecov-action@v5
+      #   with:
+      #     files: ./cov-html/libopenlibm.info
+      #     token: ${{ secrets.CODECOV_TOKEN }}
+      - uses: actions/upload-artifact@v4
+        with:
+          name: code-coverage-report-old
+          path: ./cov-html/
+  code-coverage:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout Openlibm
+        uses: actions/checkout@v4 
+      - name: Checkout Openlibm-test
+        uses: actions/checkout@v4
+        with:
+          repository: 'JuliaMath/openlibm-test'
+          path: 'openlibm-test'
+      - name: Setup LCOV
+        uses: hrishikesh-kadam/setup-lcov@v1
+      - name: Build Openlibm
+        run: make -j`nproc` CODE_COVERAGE=1
+      - name: Run Test
+        run: |
+          make -j`nproc` -C openlibm-test \
+            USE_OPENLIBM=1 OPENLIBM_HOME="$(pwd)" \
+            SKIP_FP_EXCEPT_TEST=1 \
+      - name: Show Test Result
+        run: cat openlibm-test/src/REPORT
+      - name: Gen Coverage Report
+        run: make gen-cov-report
       - name: Upload coverage to Codecov
         uses: codecov/codecov-action@v5
         with:

+ 1 - 0
.gitignore

@@ -7,6 +7,7 @@
 *.pc
 
 # code coverage
+openlibm-test
 cov-html/
 *.gcda
 *.gcno

+ 4 - 1
Makefile

@@ -84,8 +84,11 @@ COVERAGE_DIR:=cov-html
 COVERAGE_FILE:=$(COVERAGE_DIR)/libopenlibm.info
 # Gen cov report with:  make clean && make coverage -j
 coverage: clean-coverage
-	mkdir $(COVERAGE_DIR)
 	$(MAKE) test  CODE_COVERAGE=1
+	$(MAKE) gen-cov-report
+
+gen-cov-report:
+	-mkdir $(COVERAGE_DIR)
 	lcov -d amd64 -d bsdsrc -d ld80 -d src \
 		--rc lcov_branch_coverage=1 --capture --output-file $(COVERAGE_FILE)
 	genhtml --legend --branch-coverage \