Skip to content

second

second #41

# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
# on:
# workflow_run:
# workflows: ["CI"] # setup_ee.yml 的 name 字段
# types:
# - completed
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
name: test-coverage
permissions: read-all
jobs:
test-coverage:
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
EARTHENGINE_TOKEN: ${{ secrets.EARTHENGINE_TOKEN }}
steps:
- uses: actions/checkout@v4
## setup python
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.13'
- name: Install dependencies
run: |
uv pip install earthengine-api --system
## setup R
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
cache: true # 默认启用,设为 false 禁用
cache-version: 1 # 修改此数字强制刷新缓存
extra-packages: any::covr, any::xml2
needs: coverage
- name: Test coverage
run: |
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
covr::to_cobertura(cov)
shell: Rscript {0}
- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
# - uses: codecov/codecov-action@v5
# with:
# fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
# file: ./cobertura.xml
# plugin: noop
# disable_search: true
# token: ${{ secrets.CODECOV_TOKEN }}