From c45f8f829750822cc1bda904e632e02214c76c78 Mon Sep 17 00:00:00 2001 From: eitsupi Date: Wed, 3 Jan 2024 11:10:25 +0000 Subject: [PATCH] build: remove the Makefile in favor of the Taskfile.yml --- .github/actions/setup/action.yaml | 8 ++- .github/workflows/docs.yaml | 7 +-- DEVELOPMENT.md | 6 +- Makefile | 101 ------------------------------ Taskfile.yml | 2 - 5 files changed, 14 insertions(+), 110 deletions(-) delete mode 100644 Makefile diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml index 0fea5451a..d3002db7a 100644 --- a/.github/actions/setup/action.yaml +++ b/.github/actions/setup/action.yaml @@ -17,11 +17,17 @@ runs: run: | rustup update + - name: Install Task + uses: arduino/setup-task@v1 + with: + version: 3.x + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Set up Rust nightly toolchain if: inputs.rust-nightly == 'true' || env.RPOLARS_FULL_FEATURES == 'true' shell: bash run: | - make requirements-rs + task setup-rust-toolchain - name: Set up Rust target if: inputs.target != '' diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 500094549..19ed5492c 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -86,12 +86,11 @@ jobs: - name: Get requirements run: | - make requirements-r - make requirements-py + task setup-r-tools + task setup-python-tools - name: Build docs - run: make docs - shell: bash + run: task build-website - uses: webfactory/ssh-agent@v0.8.0 env: diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 0a4eb767c..ec2600396 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -16,9 +16,11 @@ install some tools outside of R. - macOS: Make sure [Xcode](https://developer.apple.com/support/xcode/) is installed. - Install [CMake](https://cmake.org/) and add it to your PATH. +- If generate the website locally, please + install [Quarto CLI](https://quarto.org/) and add it to your PATH. -Note that the `Makefile` in the root directory of the repository provides some -useful commands (e.g. `make requirements` to install the required version of +Note that the `Taskfile.yml` in the root directory of the repository provides some +useful commands (e.g. `task setup-dev` to install the required version of Rust toolchain and dependent R packages). About Rust code for R packages, see also diff --git a/Makefile b/Makefile deleted file mode 100644 index 3ad139e50..000000000 --- a/Makefile +++ /dev/null @@ -1,101 +0,0 @@ -.DEFAULT_GOAL := help - -SHELL := /bin/bash -VENV := .venv_altdoc - -RUST_TOOLCHAIN_VERSION := $(shell Rscript -e 'read.dcf("DESCRIPTION", fields = "Config/polars/RustToolchainVersion", all = TRUE)[1, 1] |> cat()') - -MANIFEST_PATH := src/rust/Cargo.toml - -ifeq ($(OS),Windows_NT) - VENV_BIN := $(VENV)/Scripts - RUST_TOOLCHAIN := $(RUST_TOOLCHAIN_VERSION)-gnu -else - VENV_BIN := $(VENV)/bin - RUST_TOOLCHAIN := $(RUST_TOOLCHAIN_VERSION) -endif - -.PHONY: help -help: ## Display this help screen - @echo -e "\033[1mAvailable commands:\033[0m\n" - @grep -E '^[a-z.A-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}' | sort - -.PHONY: requirements -requirements: requirements-r requirements-py requirements-rs ## Install all project requirements - -.PHONY: requirements-r -requirements-r: - Rscript -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/stable/%s/%s/%s", .Platform$$pkgType, R.Version()$$os, R.Version()$$arch))' - Rscript -e 'pak::local_install_deps(dependencies = c("all", "Config/Needs/dev", "Config/Needs/website"), upgrade = FALSE)' - -.venv: - python3 -m venv $(VENV) - -.PHONY: requirements-py -requirements-py: .venv - $(VENV_BIN)/python -m pip install --upgrade pip - $(VENV_BIN)/pip install --upgrade mkdocs - $(VENV_BIN)/pip install --upgrade mkdocs-material - -.PHONY: requirements-rs -requirements-rs: - rustup toolchain install $(RUST_TOOLCHAIN) - rustup default $(RUST_TOOLCHAIN) - rustup component add rustfmt - rustup component add clippy - if [[ -z "$(CI)" ]]; then \ - cargo install cargo-license; \ - fi - -.PHONY: build -build: ## Compile polars R package with all features and generate Rd files - export NOT_CRAN=true \ - && export LIBR_POLARS_BUILD=true \ - && export RPOLARS_FULL_FEATURES=true \ - && Rscript -e 'if (!(require(arrow) && require(nanoarrow) && require(knitr))) warning("could not load arrow/nanoarrow/knitr, ignore changes to nanoarrow.Rd or knit_print.Rd"); rextendr::document()' - -.PHONY: install -install: ## Install the R package - export NOT_CRAN=true \ - && export LIBR_POLARS_BUILD=true \ - && export RPOLARS_FULL_FEATURES=true \ - && R CMD INSTALL --no-multiarch --with-keep.source . - -.PHONY: all -all: fmt tools/lib-sums.tsv build test README.md LICENSE.note ## build -> test -> Update README.md, LICENSE.note - -.PHONY: docs -docs: build install README.md altdoc/reference_home.md ## Generate docs - Rscript -e 'future::plan(future::multicore); source("altdoc/altdoc_preprocessing.R"); altdoc::render_docs(freeze = FALSE, parallel = TRUE, verbose = TRUE);source("altdoc/altdoc_postprocessing.R")' - -.PHONY: docs-preview -docs-preview: ## Preview docs on local server. Needs `make docs` - Rscript -e 'altdoc::preview_docs()' - -README.md: README.Rmd build ## Update README.md - Rscript -e 'devtools::load_all(); rmarkdown::render("README.Rmd")' - -altdoc/reference_home.md: altdoc/reference_home.Rmd build ## Update the reference home page source - Rscript -e 'devtools::load_all(); rmarkdown::render("altdoc/reference_home.Rmd")' - -LICENSE.note: src/rust/Cargo.lock ## Update LICENSE.note - Rscript -e 'rextendr::write_license_note(force = TRUE)' - -.PHONY: tools/lib-sums.tsv -tools/lib-sums.tsv: ## Update the lib-sums.tsv file for pointing to the latest versions of the binary libraries - Rscript dev/generate-lib-sums.R - -.PHONY: test -test: build install ## Run fast unittests - Rscript -e 'devtools::test(); devtools::run_examples(document = FALSE)' - -.PHONY: fmt -fmt: fmt-rs fmt-r ## Format files - -.PHONY: fmt-r -fmt-r: ## Format R files, set envvar GIT_DIF_TARGET to git diff branch target. Default is "main". - Rscript -e 'source("./dev/styler_utils.R"); style_files()' - -.PHONY: fmt-rs -fmt-rs: ## Format Rust files - cargo fmt --manifest-path $(MANIFEST_PATH) diff --git a/Taskfile.yml b/Taskfile.yml index 5ce9dd29d..6391825c9 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -29,7 +29,6 @@ tasks: - setup-python-tools setup-r-tools: - internal: true env: PKG_SYSREQS: FALSE desc: Install R packages for development. @@ -74,7 +73,6 @@ tasks: - python3 -m venv {{.VENV_DIR}} setup-python-tools: - internal: true desc: Install Python tools for development. deps: - setup-venv