-
Notifications
You must be signed in to change notification settings - Fork 4
executable file
·151 lines (127 loc) · 5.36 KB
/
build_package.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Build package and update Code and website
on:
push:
branches:
- master
paths:
- build-package/**
- tests/**
- .github/workflows/build_package.yaml
- pkgdown/**
- DESCRIPTION
schedule:
- cron: "0 0 1 * *"
jobs:
build-package:
runs-on: ubuntu-22.04
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest"
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
DEBIAN_FRONTEND: "noninteractive"
QT_QPA_PLATFORM: "offscreen"
XDG_RUNTIME_DIR: "/tmp"
PYTHONPATH: "/usr/share/qgis/python/plugins:/usr/share/qgis/python"
SAGANGV: 0.0.7
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Prepare Ubuntu for installing QGIS (common code)
run: |
# Prepare Ubuntu for installing QGIS (common code)
echo "::group::Dynamically set QGIS_PLUGINPATH environment var (available to next steps)"
mkdir ../extra_plugins
echo "QGIS_PLUGINPATH=$(pwd)/../extra_plugins" >> $GITHUB_ENV
echo "::endgroup::"
echo "::group::Install the QGIS Signing Key"
sudo wget -qO /etc/apt/keyrings/qgis-archive-keyring.gpg https://download.qgis.org/downloads/qgis-archive-keyring.gpg
echo "::endgroup::"
- name: Add repo to install latest QGIS release for Ubuntu
run: |
# Add repo to install latest QGIS release for Ubuntu (using an often outdated GRASS release from Ubuntu repo)
sudo sh -c 'echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/qgis-archive-keyring.gpg] https://qgis.org/ubuntu `lsb_release -c -s` main" > /etc/apt/sources.list.d/qgis.list'
- name: Install QGIS
run: |
sudo apt-get update
sudo apt-get install -y qgis qgis-plugin-grass saga
wget -qO ../sagang_plugin.zip https://plugins.qgis.org/plugins/processing_saga_nextgen/version/$SAGANGV/download/
unzip -q ../sagang_plugin.zip -d ../extra_plugins
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-r@v2
- name: Query R dependencies and report available versions
id: query
run: |
# Query R dependencies and report available versions
cat("::group::Install pak\n")
install.packages("pak", repos = "https://r-lib.github.io/p/pak/stable/")
cat("::endgroup::\n")
cat("::group::Create minimal data frame with pkg deps and store them\n")
depends <- rbind(
pak::pkg_deps("deps::.", dependencies = c("Config/Needs/check", "all")),
pak::pkg_deps("any::sessioninfo", dependencies = c("Config/Needs/check", "all")),
pak::pkg_deps("any::rcmdcheck", dependencies = c("Config/Needs/check", "all")),
pak::pkg_deps("any::remotes", dependencies = TRUE),
pak::pkg_deps("any::progress", dependencies = TRUE),
pak::pkg_deps("any::devtools", dependencies = TRUE)
)[, c("ref", "version")]
depends <- depends[depends$ref != "deps::.", ]
saveRDS(depends, ".github/depends.Rds")
cat("::endgroup::\n")
cat("::group::Store R-version\n")
cat("r-version=", sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE)
cat("::endgroup::\n")
cat("::group::Print results\n")
cat("R version:", sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), "\n")
print(as.data.frame(depends), row.names = FALSE)
cat("::endgroup::\n")
shell: Rscript {0}
- name: Install missing package dependencies
run: |
pak::pkg_install(c("deps::.", "any::sessioninfo", "any::rcmdcheck", "any::remotes", "any::progress", "any::devtools"), upgrade = FALSE, dependencies = c("Config/Needs/check", "all"))
shell: Rscript {0}
- name: Print QGIS info
run: |
print("Has QGIS:")
print(qgisprocess::has_qgis())
qgisprocess::qgis_configure()
# cat(qgisprocess::qgis_run("plugins")$stdout)
shell: Rscript {0}
- name: Delete all files in R
run: |
rm -f ./R/*.R
rm -f ./man/*.Rd
- name: Build Package functions in folder R and document them
run: source("./build-package/build_QGIS_functions.R")
shell: Rscript {0}
- name: Add QGIS version to description
run: source("./build-package/update_Description.R")
shell: Rscript {0}
- name: Package tests
run: |
devtools::test()
shell: Rscript {0}
- name: Check and install
run: |
devtools::build_vignettes()
devtools::check()
devtools::install()
shell: Rscript {0}
- name: Render README
run: source("./build-package/render_README.R")
shell: Rscript {0}
- uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: "current update"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build package website
run: |
pkgdown::build_site()
shell: Rscript {0}
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
publish_dir: ./docs