diff --git a/.github/workflows/packaging.yaml b/.github/workflows/packaging.yaml new file mode 100644 index 000000000..b12626d71 --- /dev/null +++ b/.github/workflows/packaging.yaml @@ -0,0 +1,115 @@ +name: Packaging + +on: + schedule: + # At 12:00, on day 10 of the month, every 4 months + # Giving 10 days for paws regen to be approved + - cron: "0 12 10 */4 *" + workflow_dispatch: + inputs: + text_to_print: + description: "Manual re-build" + +jobs: + binaries: + runs-on: ${{ matrix.config.runner }} + strategy: + fail-fast: false + matrix: + + config: + - {r_version: 'release', os: macOS, version: cpu-intel, runner: macOS-latest} + - {r_version: 'release', os: ubuntu, runner: ubuntu-latest} + - {r_version: 'release', os: windows, runner: windows-latest} + - {r_version: 'oldrel-1', os: macOS, version: cpu-intel, runner: macOS-latest} + - {r_version: 'oldrel-1', os: windows, runner: windows-latest} + + include: + - config: {os: ubuntu} + type: 'source' + r_install_tar: "tar" + + - config: {os: windows} + type: 'win.binary' + r_install_tar: "" + + - config: {os: macOS} + type: 'mac.binary' + r_install_tar: "" + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: ${{ secrets.AWS_REGION }} + R_INSTALL_TAR: ${{ matrix.r_install_tar }} + + outputs: + pkg_version: ${{ steps.build.outputs.pkg_version }} + + steps: + + - uses: actions/checkout@v3 + + - name: Install R + uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r_version }} + + - uses: r-lib/actions/setup-pandoc@v2 + with: + pandoc-version: "2.17.1" + + - name: Install System Dependencies + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev libgit2-dev + sudo apt-get install -y libharfbuzz-dev libfribidi-dev + + - name: Install Paws Dependencies + run: | + install.packages('pkgbuild') + shell: Rscript {0} + + - name: Install Paws + run: | + install.packages('paws', repos = c(pawsr = 'https://paws-r.r-universe.dev', CRAN = 'https://cloud.r-project.org')) + shell: Rscript {0} + + - name: Build binary package + id: build + run: | + lines <- readLines(file.path("cran", "paws", "DESCRIPTION")) + pkgs <- lines[grepl("paws\\.[a-z\\.]", lines, perl = T)] + pkgs <- file.path("cran", c("paws", trimws(gsub("\\([^)]*\\).*", "", pkgs)))) + dest_path <- contrib.url("../binaries", type="binary") + dir.create(dest_path, recursive = TRUE) + + for (pkg in pkgs) { + binary_path <- pkgbuild::build(path = pkg, binary = TRUE, dest_path=dest_path) + tools::write_PACKAGES(dest_path, type = "${{ matrix.type }}", addFiles = TRUE) + } + paws_version <- gsub("Version:[ ]+", "", readLines("cran/paws/DESCRIPTION", n = 3)[3]) + cat("pkg_version=", paws_version, "\n", sep="", file = Sys.getenv("GITHUB_OUTPUT")) + + shell: Rscript {0} + + - name: 'upload-file' + run: + aws s3 sync "../binaries" "s3://paws-r-builds/packages/${{ steps.build.outputs.pkg_version }}/" --acl public-read --quiet + + latest-binaries: + runs-on: ubuntu-latest + needs: binaries + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: ${{ secrets.AWS_REGION }} + + steps: + - name: Update Latest Binaries + run: | + aws s3 rm s3://paws-r-builds/packages/latest/ --recursive --quiet + aws s3 cp s3://paws-r-builds/packages/${{ needs.binaries.outputs.pkg_version }}/ s3://paws-r-builds/packages/latest/ --acl public-read --recursive --quiet diff --git a/README.md b/README.md index c6c614f81..557c6f4ea 100644 --- a/README.md +++ b/README.md @@ -33,14 +33,20 @@ If you are using Linux, you will need to install the following OS packages: Or install the development version from [r-universe](https://paws-r.r-universe.dev/ui#builds): ``` r -# Enable repository from paws-r -options(repos = c( - pawsr = 'https://paws-r.r-universe.dev', - CRAN = 'https://cloud.r-project.org') -) +install.packages('paws', repos = c(pawsr = 'https://paws-r.r-universe.dev', CRAN = 'https://cloud.r-project.org')) +``` + +As of `paws v0.3.0` it's possible to install paws from pre-build binaries from a CRAN like repository host on AWS S3. We currently provide +pre-built binaries for Linux as Mac and Windows binaries are supported on the CRAN. The main focus of this is to provide linux with some pre-built binaries so that the install time is spead up. + +To get the latest pre-built binaries you can use the following: +```r +install.packages('paws', repos = c(pawsr = 'https://paws-r-builds.s3.amazonaws.com/packages/latest/', CRAN = 'https://cloud.r-project.org')) +``` -# Download and install paws in R -install.packages('paws') +You can also get a specific version of paws by setting the version: +```r +install.packages('paws', repos = c(pawsr = 'https://paws-r-builds.s3.amazonaws.com/packages/0.3.0/', CRAN = 'https://cloud.r-project.org')) ``` ## Credentials diff --git a/docker/rocker-r-base/dockerfile b/docker/rocker-r-base/dockerfile new file mode 100644 index 000000000..d0ffc53d6 --- /dev/null +++ b/docker/rocker-r-base/dockerfile @@ -0,0 +1,11 @@ +FROM rocker/r-base + +RUN apt-get update +RUN apt-get install -y --no-install-recommends \ + libcurl4-openssl-dev \ + libssl-dev \ + libxml2-dev + +RUN Rscript -e "install.packages('paws', repos = c(pawsr = 'https://paws-r-builds.s3.amazonaws.com/packages/latest/', CRAN = 'https://cloud.r-project.org'))" + +CMD ["R"] \ No newline at end of file diff --git a/docker/rocker-r2u/dockerfile b/docker/rocker-r2u/dockerfile new file mode 100644 index 000000000..ec5a1e57c --- /dev/null +++ b/docker/rocker-r2u/dockerfile @@ -0,0 +1,11 @@ +FROM rocker/r2u:jammy + +RUN apt-get update +RUN apt-get install -y --no-install-recommends \ + libcurl4-openssl-dev \ + libssl-dev \ + libxml2-dev + +RUN Rscript -e "install.packages('paws')" + +CMD ["R"] \ No newline at end of file