rhub workflow #305
This file contains hidden or 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 | |
| jobs: | |
| testthat: | |
| runs-on: ubuntu-16.04 | |
| services: | |
| 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 | |
| name: ${{ matrix.database }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| database: | |
| - SQLServer | |
| - MySQL | |
| - PostgreSQL | |
| - SQLite | |
| env: | |
| CRAN: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest" | |
| ODBCSYSINI: ${{ github.workspace }}/.github/odbc | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: r-lib/actions/setup-r@master | |
| - name: Query dependencies | |
| run: | | |
| install.packages('remotes') | |
| saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) | |
| writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") | |
| shell: Rscript {0} | |
| - name: Cache R packages | |
| uses: actions/cache@v1 | |
| with: | |
| path: ${{ env.R_LIBS_USER }} | |
| key: ubuntu-16.04-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} | |
| restore-keys: ubuntu-16.04-${{ hashFiles('.github/R-version') }}-1- | |
| - name: Install R system dependencies | |
| if: runner.os == 'Linux' | |
| env: | |
| RHUB_PLATFORM: linux-x86_64-ubuntu-gcc | |
| run: | | |
| Rscript -e "remotes::install_github('r-hub/sysreqs')" | |
| sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))") | |
| sudo -s eval "$sysreqs" | |
| - name: Setup MySQL | |
| if: matrix.database == 'MySQL' | |
| run: | | |
| sudo systemctl start mysql.service | |
| mysql -uroot -h127.0.0.1 -proot -e 'CREATE DATABASE `test`;' | |
| .github/odbc/install-mariadb-driver.sh | |
| - name: Install SQLite Driver | |
| if: matrix.database == 'SQLite' | |
| run: | | |
| sudo apt-get install -y libsqliteodbc | |
| - name: Install PostgreSQL Driver | |
| if: matrix.database == 'PostgreSQL' | |
| run: | | |
| sudo apt-get install -y unixodbc-dev odbc-postgresql devscripts | |
| - name: Install SQL Server Driver | |
| if: matrix.database == 'SQLServer' | |
| run: | | |
| 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 | |
| shell: sudo bash {0} | |
| - name: Install dependencies | |
| run: | | |
| remotes::install_deps(dependencies = TRUE) | |
| remotes::install_github('r-dbi/DBItest') | |
| shell: Rscript {0} | |
| - 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: | | |
| testthat::test_local(filter = "${{ matrix.database }}", reporter = testthat::ProgressReporter$new(max_failures = Inf, update_interval = Inf)) | |
| shell: Rscript {0} |