-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #649 from DyfanJones/main
pre-built binaries github action
- Loading branch information
Showing
4 changed files
with
150 additions
and
7 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] |