Remove environment variables for testing ckanr on Github actions #132
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: [push, pull_request] | |
name: R-check | |
jobs: | |
R-check: | |
runs-on: ${{ matrix.config.os }} | |
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) - CKAN ${{ matrix.config.ckan-version }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { os: windows-latest, r: 'release'} | |
- { os: macOS-latest, r: 'release'} | |
- { os: ubuntu-latest, r: 'release', ckan-version: 2.7} | |
- { os: ubuntu-latest, r: 'release', ckan-version: 2.8} | |
- { os: ubuntu-latest, r: 'release', ckan-version: 2.9} | |
- { os: ubuntu-latest, r: 'devel', ckan-version: 2.9} | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
CKANR_TEST_BEHAVIOUR: SKIP | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
R_KEEP_PKG_SOURCE: yes | |
CKAN_VERSION: ${{ matrix.config.ckan-version }} # for docker compose up | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Configure /etc/hosts | |
run: sudo echo "127.0.0.1 ckan" | sudo tee -a /etc/hosts | |
if: matrix.config.os == 'ubuntu-latest' | |
- name: Start CKAN | |
run: docker compose up -d | |
if: matrix.config.os == 'ubuntu-latest' | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ matrix.config.r }} | |
use-public-rspm: true | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: | | |
any::rcmdcheck | |
any::covr | |
needs: | | |
check | |
coverage | |
- name: Generate CKAN API token | |
run: | | |
echo "TEST_API_KEY=$(docker exec ckan ckan user token add ckan_admin dev_token | sed 's/API Token created://' | tr -d '\n\t')" >> $GITHUB_ENV | |
if: matrix.config.ckan-version == '2.9' && matrix.config.os == 'ubuntu-latest' | |
- name: Generate CKAN API key | |
run: | | |
echo "TEST_API_KEY"=$(docker exec ckan paster --plugin=ckan user ckan_admin | grep -o -P '(?<=apikey=).*(?= created)') >> $GITHUB_ENV | |
if: matrix.config.ckan-version != '2.9' && matrix.config.os == 'ubuntu-latest' | |
- name: Check | |
env: | |
_R_CHECK_CRAN_INCOMING_: false | |
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "error", check_dir = "check") | |
shell: Rscript {0} | |
- name: Test coverage | |
if: matrix.config.os == 'ubuntu-latest' && matrix.config.r == 'release' && matrix.config.ckan-version == '2.8' | |
run: | | |
covr::codecov( | |
quiet = FALSE, | |
clean = FALSE, | |
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package") | |
) | |
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() && matrix.config.os == 'ubuntu-latest' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-test-failures | |
path: ${{ runner.temp }}/package |