Merge branch 'apache:main' into main #10
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
| # 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 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - 'Cargo.toml' | |
| - 'Cargo.lock' | |
| - '.github/workflows/r.yml' | |
| - 'rust/**' | |
| - 'c/**' | |
| - 'r/**' | |
| jobs: | |
| format: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| # Run air format | |
| - run: curl -LsSf https://github.com/posit-dev/air/releases/latest/download/air-installer.sh | sh | |
| - run: cd r/sedonadb && air format . --check | |
| test: | |
| runs-on: ${{ matrix.config.os }} | |
| name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | |
| defaults: | |
| run: | |
| shell: bash | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| - {os: ubuntu-latest, r: 'release'} | |
| - {os: macos-latest, r: 'release'} | |
| - {os: windows-latest, r: 'release'} | |
| env: | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| R_KEEP_PKG_SOURCE: yes | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - 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 | |
| - name: Use stable Rust | |
| if: matrix.config.os != 'windows-latest' | |
| run: | | |
| rustup toolchain install stable --no-self-update | |
| rustup default stable | |
| # Set the default toolchain here so that rust-cache saves/restores | |
| # the correct target. (The R package will use this target regardless, | |
| # this just in theory helps the cache) | |
| - name: Use stable Rust (windows) | |
| if: matrix.config.os == 'windows-latest' | |
| run: | | |
| rustup toolchain install stable-x86_64-pc-windows-gnu --no-self-update | |
| rustup default stable-x86_64-pc-windows-gnu | |
| - name: Enable Long Paths support (Windows) | |
| if: matrix.config.os == 'windows-latest' | |
| shell: pwsh | |
| run: | | |
| git config --system core.longpaths true | |
| New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force | |
| - name: Install dependencies (Linux) | |
| if: matrix.config.os == 'ubuntu-latest' | |
| run: sudo apt-get update && sudo apt-get install -y libgeos-dev | |
| - name: Install dependencies (MacOS) | |
| if: matrix.config.os == 'macos-latest' | |
| run: brew install geos | |
| # Dynamically set a short target directory on Windows to bypass 260-char MinGW limits, | |
| # while keeping paths standard on Mac/Linux. | |
| - name: Configure Target Directory | |
| shell: bash | |
| run: | | |
| if [ "$RUNNER_OS" == "Windows" ]; then | |
| echo "SEDONADB_TARGET_DIR=D:/a/t" >> $GITHUB_ENV | |
| echo "CACHE_WORKSPACE=. -> D:/a/t" >> $GITHUB_ENV | |
| else | |
| echo "SEDONADB_TARGET_DIR=$(pwd)/r/sedonadb/src/rust/target" >> $GITHUB_ENV | |
| echo "CACHE_WORKSPACE=. -> r/sedonadb/src/rust/target" >> $GITHUB_ENV | |
| fi | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| prefix-key: "r-v4" | |
| workspaces: ${{ env.CACHE_WORKSPACE }} | |
| - uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| needs: check | |
| working-directory: r/sedonadb | |
| cache: false | |
| - name: Install R Package | |
| run: | | |
| R CMD INSTALL r/sedonadb --preclean | |
| - name: Test R Package | |
| run: | | |
| R -e 'library(testthat); test_local("r/sedonadb", MultiReporter$new(list(CheckReporter$new(), LocationReporter$new())))' |