From 7ce404cdac37945aaff361b72c6c873bec86eee2 Mon Sep 17 00:00:00 2001 From: admin <1677953017@qq.com> Date: Fri, 17 Nov 2023 14:43:35 +0800 Subject: [PATCH] CI issue #22 --- .github/workflows/ci.yml | 48 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 34 +++++++++++++++++++++++++--- 2 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..263112f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,48 @@ +name: R CI +on: + push: + branches: [*] + pull_request: + branches: [*] + +jobs: + test-coverage: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up pdflatex + run: | + sudo apt-get update + sudo apt-get install -y texlive-latex-base + sudo apt-get install texlive-fonts-extra + + - name: Set up R + uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + # - name: Install covr package + # run: Rscript -e 'install.packages("covr")' + + - name: Install Dependencies + run: | + R -e 'install.packages(c("devtools", "covr", "ggplot2", "WriteXLS", "gridExtra", "Cairo"))' + + - name: Build and test + run: | + R CMD build . + R CMD check . + # R CMD check --as-cran *tar.gz + + - name: Run Tests and Generate Coverage + run: | + Rscript -e 'library(devtools); devtools::test()' + Rscript -e 'library(covr); covr::codecov()' + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.travis.yml b/.travis.yml index e92bd71..9b89498 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,36 @@ language: r +sudo: false cache: packages -r_github_packages: - - r-lib/covr +branches: + only: + - main + - master + - CI/CD + - test + +before_install: + - sudo apt-get update + - sudo apt-get install -y texlive-latex-base + - sudo apt-get install texlive-fonts-extra + +install: + - Rscript -e 'install.packages("covr")' + - R -e 'install.packages(c("devtools", "ggplot2", "WriteXLS", "gridExtra", "Cairo"))' + +script: + - R CMD build . + - R CMD check --as-cran *tar.gz + - Rscript -e 'library(devtools); devtools::test()' + - Rscript -e 'library(covr); covr::codecov()' after_success: - - Rscript -e 'covr::coveralls()' + - Rscript -e 'covr::codecov()' + +addons: + apt: + packages: + - libxml2-dev + +notifications: + email: false \ No newline at end of file