ci: keep up with mysql driver updates #829
Workflow file for this run
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: | |
branches: | |
- master | |
- main | |
pull_request: | |
branches: | |
- master | |
- main | |
name: DBs (Linux) | |
jobs: | |
database: | |
runs-on: ubuntu-latest | |
services: | |
oracle: | |
image: gvenzl/oracle-xe:21.3.0 | |
ports: | |
- 1521:1521 | |
env: | |
ORACLE_RANDOM_PASSWORD: true | |
ORACLE_DATABASE: test | |
APP_USER: RodbcR | |
APP_USER_PASSWORD: Password12 | |
options: >- | |
--health-cmd healthcheck.sh | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 10 | |
postgres: | |
image: postgres | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: password | |
POSTGRES_DB: test | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
sqlserver: | |
image: mcr.microsoft.com/mssql/server:2017-latest-ubuntu | |
ports: | |
- 1433:1433 | |
env: | |
ACCEPT_EULA: Y | |
SA_PASSWORD: Password12 | |
env: | |
CRAN: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest" | |
ODBCSYSINI: ${{ github.workspace }}/.github/odbc | |
TNS_ADMIN: ${{ github.workspace }}/.github/odbc | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: r-lib/actions/setup-r@v2 | |
- name: Install MySQL Driver | |
run: | | |
sudo systemctl start mysql.service | |
mysql -uroot -h127.0.0.1 -proot -e 'CREATE DATABASE `test`;' | |
.github/odbc/install-mariadb-driver.sh | |
echo "ODBC_CS_MYSQL=dsn=MySQL" >> $GITHUB_ENV | |
- name: Install SQLite Driver | |
run: | | |
sudo apt-get install -y libsqliteodbc | |
echo "ODBC_CS_SQLITE=dsn=SQLite" >> $GITHUB_ENV | |
- name: Install PostgreSQL Driver | |
run: | | |
sudo apt-get install -y unixodbc-dev odbc-postgresql devscripts | |
echo "ODBC_CS_POSTGRES=dsn=PostgreSQL" >> $GITHUB_ENV | |
- name: Install SQL Server Driver | |
run: | | |
echo "ODBC_CS_SQLSERVER=dsn=MicrosoftSQLServer;UID=SA;PWD=Password12" >> $GITHUB_ENV | |
sudo bash -c " | |
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ | |
&& curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list \ | |
&& apt-get update \ | |
&& ACCEPT_EULA=Y apt-get install -y msodbcsql17 \ | |
&& ln -s /opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.*.so.* /opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.so" | |
- name: Install Oracle Driver | |
run: | | |
.github/odbc/install-oracle-driver.sh | |
echo "LD_LIBRARY_PATH=/opt/oracle/instantclient_21_12:$LD_LIBRARY_PATH" >> $GITHUB_ENV | |
echo "ODBC_CS_ORACLE=dsn=Oracle;UID=RodbcR;PWD=Password12;DBQ=test" >> $GITHUB_ENV | |
- name: Install Snowflake Driver | |
run: | | |
echo "ODBC_CS_SNOWFLAKE=dsn=Snowflake" >> $GITHUB_ENV | |
curl https://sfc-repo.snowflakecomputing.com/odbc/linux/3.2.0/snowflake_linux_x8664_odbc-3.2.0.tgz --output snowflake_linux_x8664_odbc-3.2.0.tgz | |
gunzip snowflake_linux_x8664_odbc-3.2.0.tgz | |
tar -xvf snowflake_linux_x8664_odbc-3.2.0.tar | |
mv snowflake_odbc $ODBCSYSINI | |
rm snowflake_linux_x8664_odbc-3.2.0.tar | |
cp .github/odbc/simba.snowflake.ini .github/odbc/snowflake_odbc/lib/simba.snowflake.ini | |
echo "CABundleFile=$ODBCSYSINI/snowflake_odbc/lib/cacert.pem" >> .github/odbc/snowflake_odbc/lib/simba.snowflake.ini | |
echo "ErrorMessagesPath=$ODBCSYSINI/snowflake_odbc/ErrorMessages/" >> .github/odbc/snowflake_odbc/lib/simba.snowflake.ini | |
echo "Driver=SnowflakeDSIIDriver" | tee -a $ODBCSYSINI/odbc.ini | |
# note that this assumes Snowflake is the last odbc.ini entry | |
- name: Prepare Snowflake private key | |
run: | | |
echo "${{ secrets.SNOWFLAKE_PRIVATE_KEY }}" > $ODBCSYSINI/private_key.pem | |
echo "PRIV_KEY_FILE=$ODBCSYSINI/private_key.pem" | tee -a $ODBCSYSINI/odbc.ini | |
export SNOWFLAKE_PRIVATE_KEY_EXISTS=TRUE | |
- name: Install dependencies | |
uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
needs: check | |
- name: Install locally to avoid error with test_local() | |
run: | | |
R CMD INSTALL . | |
env: | |
LIB_DIR: /usr/lib/x86_64-linux-gnu/ | |
INCLUDE_DIR: /usr/include | |
- name: Test | |
run: | | |
options("odbc.interruptible"=TRUE);testthat::test_local(reporter = testthat::ProgressReporter$new(max_failures = Inf, update_interval = Inf)) | |
shell: Rscript {0} |