R (extended) #27
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
# Licensed to the Apache Software Foundation (ASF) under one | |
# or more contributor license agreements. See the NOTICE file | |
# distributed with this work for additional information | |
# regarding copyright ownership. The ASF licenses this file | |
# to you under the Apache License, Version 2.0 (the | |
# "License"); you may not use this file except in compliance | |
# with the License. You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, | |
# software distributed under the License is distributed on an | |
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
# KIND, either express or implied. See the License for the | |
# specific language governing permissions and limitations | |
# under the License. | |
name: R (extended) | |
# Runs weekly. This catches changes that happen because of | |
# dependency updates and catches some of the more infrequent/obscure | |
# changes that affect the R package. | |
on: | |
# Also can trigger manually (e.g., if release is upcoming, etc.) | |
workflow_dispatch: | |
schedule: | |
- cron: '5 0 * * 0' | |
pull_request: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/r-extended.yml" | |
permissions: | |
contents: read | |
jobs: | |
# Runs R CMD check on the same platforms/R versions CRAN does | |
cran: | |
strategy: | |
matrix: | |
rversion: [oldrel, release, devel] | |
os: [macOS, windows, ubuntu] | |
pkg: [adbcdrivermanager, adbcsqlite, adbcpostgresql, adbcflightsql, adbcsnowflake, adbcbigquery] | |
fail-fast: false | |
uses: ./.github/workflows/r-check.yml | |
with: | |
os: ${{ matrix.os }} | |
pkg: ${{ matrix.pkg }} | |
rversion: ${{ matrix.rversion }} | |
secrets: | |
SNOWFLAKE_URI: ${{ secrets.SNOWFLAKE_URI }} | |
# Check older versions of R on Linux. This catches accidental use of newer R functions. | |
rversions: | |
strategy: | |
matrix: | |
rversion: ["3.6", "4.0", "4.1"] | |
os: [ubuntu] | |
pkg: [adbcdrivermanager, adbcsqlite, adbcpostgresql, adbcflightsql, adbcsnowflake, adbcbigquery] | |
fail-fast: false | |
uses: ./.github/workflows/r-check.yml | |
with: | |
os: ${{ matrix.os }} | |
pkg: ${{ matrix.pkg }} | |
rversion: ${{ matrix.rversion }} | |
secrets: | |
SNOWFLAKE_URI: ${{ secrets.SNOWFLAKE_URI }} | |
# Checks on older verions of R on Windows. The Windows build system changed | |
# several times so we need to check packages on every version. Go-based | |
# drivers aren't supported before 4.2, so we don't check them here. | |
# We don't need to check R 4.1 because the build system for R 4.0 and R 4.1 | |
# are the same. | |
winrversions: | |
strategy: | |
matrix: | |
rversion: ["3.6", "4.0"] | |
os: [windows] | |
pkg: [adbcdrivermanager, adbcsqlite, adbcpostgresql] | |
fail-fast: false | |
uses: ./.github/workflows/r-check.yml | |
with: | |
os: ${{ matrix.os }} | |
pkg: ${{ matrix.pkg }} | |
rversion: ${{ matrix.rversion }} | |
secrets: | |
SNOWFLAKE_URI: ${{ secrets.SNOWFLAKE_URI }} | |
# Runs tests with valgrind. Go does not support valgrind, so we don't run | |
# those tests here. | |
valgrind: | |
name: "valgrind (${{ matrix.pkg }})" | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
matrix: | |
rversion: [release] | |
os: [ubuntu] | |
pkg: [adbcdrivermanager, adbcsqlite, adbcpostgresql] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
rversion: ${{ matrix.rversion }} | |
use-public-rspm: true | |
- name: Install valgrind | |
run: | | |
sudo apt-get install -y valgrind | |
# Usually, pak::pkg_install() will run bootstrap.R if it is included and is declared; | |
# however, this doesn't work for local:: for some reason (which is what | |
# setup-r-dependencies uses under the hood) | |
- name: Bootstrap R Package | |
run: | | |
pushd r/adbcdrivermanager | |
R -e 'if (!requireNamespace("nanoarrow", quietly = TRUE)) install.packages("nanoarrow", repos = "https://cloud.r-project.org/")' | |
R CMD INSTALL . --preclean | |
popd | |
pushd "r/${{ matrix.pkg }}" | |
Rscript bootstrap.R | |
popd | |
shell: bash | |
- uses: r-lib/actions/setup-r-dependencies@f4937e0dc26f9b99c969cd3e4ca943b576e7f991 | |
with: | |
working-directory: r/${{ matrix.pkg }} | |
- name: Start postgres test database | |
if: matrix.pkg == 'adbcpostgresql' | |
run: | | |
cd r/adbcpostgresql | |
docker compose up --detach postgres-test | |
ADBC_POSTGRESQL_TEST_URI="postgresql://localhost:5432/postgres?user=postgres&password=password" | |
echo "ADBC_POSTGRESQL_TEST_URI=${ADBC_POSTGRESQL_TEST_URI}" >> $GITHUB_ENV | |
- name: Run devtools::test() with valgrind | |
run: | | |
cd r/${{ matrix.pkg }} | |
R -d "valgrind --tool=memcheck --leak-check=full --suppressions=../valgrind.supp --error-exitcode=1" -e "testthat::test_local()" > valgrind.out 2>&1 | |
- name: Show output | |
if: always() | |
run: | | |
cd r/${{ matrix.pkg }} | |
cat valgrind.out | |
- name: Shutdown docker compose services | |
if: always() | |
run: | | |
docker compose down |