diff --git a/.github/workflows/R-CMD-check-build.yml b/.github/workflows/R-CMD-check-build-rClr.yml similarity index 100% rename from .github/workflows/R-CMD-check-build.yml rename to .github/workflows/R-CMD-check-build-rClr.yml diff --git a/.github/workflows/R-CMD-check-build.yaml b/.github/workflows/R-CMD-check-build.yaml new file mode 100644 index 0000000..3762c5c --- /dev/null +++ b/.github/workflows/R-CMD-check-build.yaml @@ -0,0 +1,68 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples + +on: + workflow_call: + +name: R-CMD-check + +permissions: read-all + +jobs: + R-CMD-check: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + config: + - {os: windows-latest, r: 'release'} + - {os: ubuntu-latest, r: 'release'} + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + needs: check + + - uses: r-lib/actions/check-r-package@v2 + with: + upload-snapshots: true + build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' + error-on: 'c("error")' + + - name: Build package + if: ${{ success() }} + run: | + output_dir <- file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "built_package") + dir.create(output_dir) + devtools::build(binary = TRUE, path = output_dir) + shell: Rscript {0} + + - name: Get package package and R versions and store in environment + run: | + echo "PKG_VERSION=$(Rscript -e 'desc::desc_get_version()')" >> $GITHUB_ENV + echo "R_VERSION=$(Rscript -e 'cat(R.version$major, R.version$minor, sep = ".")')" >> $GITHUB_ENV + shell: bash + + - name: Upload built package + if: ${{ success() }} + uses: actions/upload-artifact@v4 + with: + name: ospsuite-v${{ env.PKG_VERSION }}-${{runner.os}}-r_${{ env.R_VERSION }} + path: ${{ runner.temp }}/built_package/* diff --git a/.github/workflows/bump_dev_version_tag_branch.yaml b/.github/workflows/bump_dev_version_tag_branch.yaml new file mode 100644 index 0000000..d47e919 --- /dev/null +++ b/.github/workflows/bump_dev_version_tag_branch.yaml @@ -0,0 +1,64 @@ +# This reusable workflow will, if triggered by a merge: +# - Bump version if the current version is development (x.y.z.9000+) +# - Tag the target branch with version number +name: bump-dev-version + +on: + workflow_call: + inputs: + app-id: + type: string + required: true + secrets: + private-key: + required: true + +jobs: + bump-dev-version: + if: github.event_name != 'pull_request' + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: write-all + steps: + + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ inputs.app-id }} + private-key: ${{ secrets.private-key }} + + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ steps.app-token.outputs.token }} + + - name: Setup R + uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - name: Install packages + run: | + install.packages("usethis") + shell: Rscript {0} + + - name: Change DESCRIPTION file + run: | + if(usethis:::is_dev_version()){ + desc::desc_set_version(version = usethis:::bump_version()[["dev"]]) + } + shell: Rscript {0} + + - name: Get package version from DESCRIPTION file and set as environment variable + run: | + echo "PKG_VERSION=$(Rscript -e 'desc::desc_get_version()')" >> $GITHUB_ENV + shell: bash + + - uses: EndBug/add-and-commit@v9 + if: ${{ success() }} + with: + message: '🤖 Bump version. [skip actions]' + default_author: github_actions + add: 'DESCRIPTION' + tag: 'v${{ env.PKG_VERSION }}' diff --git a/.github/workflows/pkgdown.yml b/.github/workflows/pkgdown-rClr.yml similarity index 100% rename from .github/workflows/pkgdown.yml rename to .github/workflows/pkgdown-rClr.yml diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml new file mode 100644 index 0000000..96323df --- /dev/null +++ b/.github/workflows/pkgdown.yaml @@ -0,0 +1,44 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples + +on: + workflow_call: + +name: pkgdown + +permissions: read-all + +jobs: + pkgdown: + runs-on: ubuntu-latest + # Only restrict concurrency for non-PR jobs + concurrency: + group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::pkgdown, local::. + needs: website + + - name: Build site + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) + shell: Rscript {0} + + - name: Deploy to GitHub pages 🚀 + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@v4.5.0 + with: + clean: false + branch: gh-pages + folder: docs diff --git a/.github/workflows/test-pkg-and-coverage.yml b/.github/workflows/test-coverage-rClr.yml similarity index 91% rename from .github/workflows/test-pkg-and-coverage.yml rename to .github/workflows/test-coverage-rClr.yml index 533e2f3..b758932 100644 --- a/.github/workflows/test-pkg-and-coverage.yml +++ b/.github/workflows/test-coverage-rClr.yml @@ -18,10 +18,6 @@ on: default: '0.9.2' extra-packages: type: string - secrets: - CODECOV_TOKEN: - description: 'Token for codecov.io' - required: false name: test-pkg-and-coverage @@ -52,8 +48,6 @@ jobs: install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") ) shell: Rscript {0} - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - name: Show testthat output if: always() diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml new file mode 100644 index 0000000..78250f4 --- /dev/null +++ b/.github/workflows/test-coverage.yaml @@ -0,0 +1,58 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples + +on: + workflow_call: + +name: test-coverage + +permissions: read-all + +jobs: + test-coverage: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + 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} + + - uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }} + file: ./cobertura.xml + plugin: noop + disable_search: true + token: ${{ secrets.CODECOV_TOKEN }} + + - 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