trigger-workflow #322
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
name: "Build tree" | |
on: | |
repository_dispatch: | |
types: [trigger-workflow] | |
jobs: | |
build-tree: | |
runs-on: ${{ matrix.os }} | |
permissions: | |
id-token: "write" | |
contents: "read" | |
strategy: | |
matrix: | |
os: ${{ github.event.client_payload.platforms }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@main | |
- uses: DeterminateSystems/magic-nix-cache-action@main | |
- name: Access Payload Data | |
run: | | |
echo "Branch: ${{ github.event.client_payload.ref_name }}" | |
echo "Branch: ${{ github.event.client_payload.platforms }}" | |
- name: Determine Nix file to use | |
id: determine-file | |
run: | | |
year=$(echo "${{ github.event.client_payload.ref_name }}" | cut -c1-4) | |
if [ "$year" -le 2020 ]; then | |
echo "nix_file=default_2020.nix" >> $GITHUB_ENV | |
else | |
echo "nix_file=default.nix" >> $GITHUB_ENV | |
fi | |
- run: | | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
sed -i 's/REPLACE_DATE/${{ github.event.client_payload.ref_name }}/g' ${{ env.nix_file }} | |
else | |
sed -i '' 's/REPLACE_DATE/${{ github.event.client_payload.ref_name }}/g' ${{ env.nix_file }} | |
fi | |
- uses: cachix/cachix-action@v15 | |
with: | |
name: rstats-on-nix | |
authToken: '${{ secrets.CACHIX_AUTH }}' | |
- name: Build on date ${{ github.event.client_payload.ref_name }} | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
nix-build --max-jobs 1 --cores 2 --argstr system x86_64-linux ${{ env.nix_file }} | |
nix-build --max-jobs 1 --cores 2 --argstr system aarch64-linux ${{ env.nix_file }} | |
else | |
nix-build --max-jobs 1 --cores 2 ${{ env.nix_file }} | |
fi | |
- name: Test tidyverse | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"tidyverse\", glimpse(mtcars))'" | |
- name: Test arrow | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"arrow\", { write_feather(mtcars, \"mtcars.feather\"); read_feather(\"mtcars.feather\") })'" | |
- name: Test duckdb | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"duckdb\", { con <- dbConnect(duckdb()); dbWriteTable(con, \"mtcars\", mtcars); dbDisconnect(con) })'" | |
- name: Test collapse | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"collapse\", fmean(mtcars$mpg))'" | |
- name: Test kit | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"kit\", countNA(mtcars))'" | |
- name: Test icosa | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"icosa\", { grid <- trigrid(5); print(grid) })'" | |
- name: Test sf | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"sf\", { nc <- st_read(system.file(\"shape/nc.shp\", package=\"sf\")); st_bbox(nc) })'" | |
- name: Test terra | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"terra\", { r <- rast(system.file(\"ex/logo.tif\", package=\"terra\")); summary(r) })'" | |
- name: Test stars | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"stars\", { s <- read_stars(system.file(\"tif/L7_ETMs.tif\", package=\"stars\")); print(s) })'" | |
#- name: Test Rcpp | |
# run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"Rcpp\", { cppFunction(\"int add(int x, int y) { return x + y; }\"); add(1, 2) })'" | |
- name: Test data.table | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"data.table\", { dt <- as.data.table(mtcars); dt[, .(mean_mpg = mean(mpg))] })'" | |
- name: Test stringi | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"stringi\", stri_length(\"test\"))'" | |
- name: Test jsonlite | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"jsonlite\", toJSON(mtcars))'" | |
- name: Test devtools | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"devtools\", dev_sitrep())'" | |
- name: Test curl | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"curl\", { h <- curl::new_handle(); curl::handle_setopt(h, url = \"https://httpbin.org/get\"); curl::curl_fetch_memory(\"https://httpbin.org/get\", h) })'" | |
- name: Test openssl | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"openssl\", sha256(\"test\"))'" | |
- name: Test ragg | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"ragg\", { agg_png(\"test_plot.png\"); plot(1:10); dev.off() })'" | |
- name: Test shiny | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"shiny\", cat(\"Shiny package loaded. Run `runExample()` to see examples.\\n\"))'" | |
- name: Test dbplyr | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"dbplyr\", tbl_lazy(mtcars))'" | |
- name: Test RcppEigen | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"RcppEigen\", { fastLm( log(Volume) ~ log(Girth), data=trees) })'" | |
- name: Test nloptr | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"nloptr\", { res <- nloptr(x0 = 1, eval_f = function(x) x^3, eval_grad_f = function(x) 2*x^2, lb = -5, ub = 5, opts = list(\"algorithm\"=\"NLOPT_LD_LBFGS\", \"maxeval\"=10)); res$solution })'" | |
- name: Test igraph | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"igraph\", { g <- make_ring(10); plot(g) })'" | |
- name: Test rJava | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"rJava\", J(\"java.lang.Double\"))'" | |
- name: Test RCurl | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"RCurl\", getURL(\"https://httpbin.org/get\"))'" | |
- name: Test RSQLite | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"RSQLite\", { con <- dbConnect(RSQLite::SQLite(), \":memory:\"); dbWriteTable(con, \"mtcars\", mtcars); dbDisconnect(con) })'" | |
- name: Test rstan | |
run: nix-shell ${{ env.nix_file }} --run "Rscript -e 'withr::with_package(\"rstan\", cat(\"rstan package loaded.\\n\"))'" | |
- run: nix-store -qR --include-outputs $(nix-instantiate ${{ env.nix_file }}) | cachix push rstats-on-nix | |
- run: nix-shell --run "echo OK" |