Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/ipeaGIT/geocodebr
Browse files Browse the repository at this point in the history
  • Loading branch information
rafapereirabr committed Dec 9, 2024
2 parents 3609542 + b926619 commit 929c475
Show file tree
Hide file tree
Showing 29 changed files with 854 additions and 453 deletions.
4 changes: 3 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@
.RData
^_pkgdown\.yml$
^pkgdown$

^\.pre-commit-config\.yaml$
^README\.Rmd$
^codemeta\.json$
44 changes: 8 additions & 36 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,30 @@ on:
push:
branches:
- main
tags:
-'*'

name: pkgdown

jobs:
pkgdown:
runs-on: ubuntu-22.04
runs-on: ubuntu-20.04
env:
RSPM: https://packagemanager.rstudio.com/cran/__linux__/jammy/latest
RSPM: https://packagemanager.rstudio.com/cran/__linux__/focal/latest
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v2
id: install-r

- uses: r-lib/actions/setup-pandoc@v2

- name: Install pak and query dependencies
run: |
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds")
shell: Rscript {0}
- uses: r-lib/actions/setup-r@v2

- name: Restore R package cache
uses: actions/cache@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: |
${{ env.R_LIBS_USER }}/*
!${{ env.R_LIBS_USER }}/pak
key: ubuntu-22.04-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
restore-keys: ubuntu-22.04-${{ steps.install-r.outputs.installed-r-version }}-1-

- name: Install system dependencies
run: |
pak::local_system_requirements(execute = TRUE)
pak::pkg_system_requirements("pkgdown", execute = TRUE)
shell: Rscript {0}

- name: Install dependencies
run: |
pak::local_install_dev_deps(upgrade = TRUE)
pak::pkg_install("pkgdown")
shell: Rscript {0}

- name: Install package
run: R CMD INSTALL .
extra-packages: any::pkgdown, local::.
needs: website

- name: Build and deploy pkgdown site
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected].github.com"
git config --local user.name "GitHub Actions"
git config --local user.email "actions@github.com"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
61 changes: 33 additions & 28 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,51 @@ on:

name: test-coverage

permissions: read-all

jobs:
test-coverage:
runs-on: ubuntu-22.04
env:
RSPM: https://packagemanager.rstudio.com/cran/__linux__/jammy/latest
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
id: install-r

- name: Install pak and query dependencies
run: |
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds")
shell: Rscript {0}

- name: Restore R package cache
uses: actions/cache@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: |
${{ env.R_LIBS_USER }}/*
!${{ env.R_LIBS_USER }}/pak
key: ubuntu-22.04-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
restore-keys: ubuntu-22.04-${{ steps.install-r.outputs.installed-r-version }}-1-
extra-packages: any::covr, any::xml2
needs: coverage

- name: Install system dependencies
- name: Test coverage
run: |
pak::local_system_requirements(execute = TRUE)
pak::pkg_system_requirements("covr", execute = TRUE)
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
covr::to_cobertura(cov)
shell: Rscript {0}

- name: Install dependencies
- uses: codecov/codecov-action@v4
with:
# Fail if error if not on PR, or if on PR and token is given
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
file: ./cobertura.xml
plugin: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Show testthat output
if: always()
run: |
pak::local_install_dev_deps(upgrade = TRUE)
pak::pkg_install("covr")
shell: Rscript {0}
## --------------------------------------------------------------------
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Test coverage
run: covr::codecov(quiet = FALSE)
shell: Rscript {0}
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
repos:
- repo: https://github.com/lorenzwalthert/precommit
rev: v0.4.3.9001
hooks:
- id: readme-rmd-rendered
- id: codemeta-description-updated
- id: pkgdown
48 changes: 25 additions & 23 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,53 +1,55 @@
Type: Package
Package: geocodebr
Title: Geocode Brazilian Addresses with CNEFE
Version: 0.0.2
Authors@R:
c(person(given = "Daniel",
family = "Herszenhut",
role = c("aut", "cre"),
email = "[email protected]",
comment = c(ORCID = "0000-0001-8066-1105")),
person(given = "Rafael H. M.",
family = "Pereira",
role = "aut",
comment = c(ORCID = "0000-0003-2125-7465")),
person(given = "Ipea - Institute for Applied Economic Research",
role = c("cph", "fnd")))
Description: Geocode Brazilian addresses based on a modified version of the
Cadastro Nacional de Endereços para Fins Estatísticos (CNEFE),
published by Brazil official statistics and geography office IBGE
<https://www.ibge.gov.br/estatisticas/sociais/populacao/38734-cadastro-nacional-de-enderecos-para-fins-estatisticos.html>.
Version: 0.0.0.9000
Authors@R: c(
person("Daniel", "Herszenhut", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-8066-1105")),
person("Rafael H. M.", "Pereira", role = "aut",
comment = c(ORCID = "0000-0003-2125-7465")),
person("Ipea - Institute for Applied Economic Research", role = c("cph", "fnd"))
)
Description: Enables one to geocode Brazilian addresses using the National
Registry of Addresses for Statistical Purposes (english for Cadastro
Nacional de Endereços para Fins Estatísticos, CNEFE). CNEFE is
published by the Brazilian official statistics and geography office,
IBGE
(<https://www.ibge.gov.br/estatisticas/sociais/populacao/38734-cadastro-nacional-de-enderecos-para-fins-estatisticos.html>).
License: MIT + file LICENSE
URL: https://github.com/ipeaGIT/geocodebr, https://ipeagit.github.io/geocodebr/
URL: https://github.com/ipeaGIT/geocodebr,
https://ipeagit.github.io/geocodebr/
BugReports: https://github.com/ipeaGIT/geocodebr/issues
Depends:
R (>= 4.1.0)
Imports:
archive,
arrow (>= 15.0.1),
checkmate,
curl (>= 5.0.0),
cli,
data.table,
dplyr,
enderecobr,
fs,
glue,
httr2,
parallel,
purrr,
tools,
utils
utils,
zip
Suggests:
covr,
DBI,
dbplyr,
duckdb,
geobr,
ggplot2 (>= 3.3.1),
rmarkdown,
knitr,
rmarkdown,
scales,
testthat
testthat (>= 3.0.0)
VignetteBuilder:
knitr
Config/testthat/edition: 3
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
3 changes: 2 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
export(download_cnefe)
export(geocode)
export(geocodebr_cache)
export(set_geocodebr_cache_dir)
export(get_cache_dir)
export(set_cache_dir)
importFrom(data.table,"%chin%")
importFrom(data.table,"%like%")
importFrom(data.table,":=")
Expand Down
Loading

0 comments on commit 929c475

Please sign in to comment.