-
-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FOSS4G 2024 Belem workshop #244
Changes from all commits
ba74abc
5a0dc56
c718a80
ffd0eaf
5a8ef08
e0d18f7
bf5a3c4
f1c56f7
b0fde67
21b8b96
54b3109
b4a846a
b5bebd7
55139f4
605b5e4
d3a3753
fb50fcd
e361e96
9656d75
7686e7e
0664523
62b4b87
d02cdde
51125b2
2a5f81b
3df37ce
d7d2eb6
d40a129
0203fe0
edc5f63
12e97b6
31f55b4
c1172da
b772915
6ffdbd4
1efe9ed
ba82161
b193276
d71b78a
502d874
5c7a504
a421a43
e3a5303
d537064
cd26443
892de1e
47b87c9
bafdf48
575bf06
75eaadd
ce6638a
c941ea9
9c8680e
10a44c3
cd1c362
496aeeb
c65517f
b031b72
013f71d
d8d7ba7
4c1f712
6ae7452
0a34eff
2b2e9a1
26c3534
794548e
b2cfaa9
cbd8403
7811e0b
b2f3801
62b6a96
8c4dd88
a0a69fd
f9b462c
85f8812
6d869ad
3551f97
6d034f5
2f6b438
019265a
134a0cc
28d49ae
61a8297
d60cd81
5f0c4d6
8878899
8de687b
c962866
1b08a15
4e20d5f
22466c8
8af724e
263dcc2
2aeaed5
67d9bbe
dfc7f60
4b633b8
9f93c2e
002251e
371c5d8
4c9c105
cd27db0
8fa2355
5c43dfd
52ffce4
b37aaf7
d4c878b
5605150
310de96
f98a5ad
2cf087c
6e6ca33
6f44136
ee5b1b7
0c7e1ad
b57dd46
13ac402
c247f3f
e2fb745
1a42720
09df2c6
93a6f7c
08cc4bf
4944bc0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
# ------------------------------------------------------------------------------ | ||
# /*PGR-GNU***************************************************************** | ||
# File: update_locale.sh | ||
# Copyright (c) 2021 pgRouting developers | ||
# Mail: project@pgrouting.org | ||
# ------ | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
# ********************************************************************PGR-GNU*/ | ||
# ------------------------------------------------------------------------------ | ||
|
||
DIR=$(git rev-parse --show-toplevel) | ||
|
||
pushd "${DIR}" > /dev/null || exit 1 | ||
|
||
mkdir -p build | ||
pushd build > /dev/null || exit 1 | ||
cmake -DLOCALE=ON .. | ||
|
||
make locale | ||
popd > /dev/null || exit 1 | ||
|
||
# List all the files that needs to be committed in build/docs/locale_changes.txt | ||
awk '/^Update|^Create/{print $2}' build/docs/locale_changes.txt > build/docs/locale_changes_po.txt # .po files | ||
cp build/docs/locale_changes_po.txt build/docs/locale_changes_po_pot.txt | ||
perl -ne '/\/en\// && print' build/docs/locale_changes_po.txt | \ | ||
perl -pe 's/(.*)en\/LC_MESSAGES(.*)/$1pot$2t/' >> build/docs/locale_changes_po_pot.txt # .pot files | ||
|
||
# Do not create empty translation files | ||
git status locale/es --porcelain | awk 'match($1, "?"){print $2}' | xargs -r rm -rf | ||
git status locale/ja --porcelain | awk 'match($1, "?"){print $2}' | xargs -r rm -rf | ||
|
||
# Remove obsolete entries #~ from .po files | ||
bash .github/scripts/remove_obsolete_entries.sh | ||
|
||
cat build/docs/locale_changes_po_pot.txt | xargs -I {} sh -c "(ls {} >> /dev/null 2>&1 && git add {} )" | ||
|
||
popd > /dev/null || exit 1 |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,98 @@ | ||||||||||||||||||||||
name: Update Locale | ||||||||||||||||||||||
|
||||||||||||||||||||||
# This action runs: | ||||||||||||||||||||||
# - When this file changes | ||||||||||||||||||||||
# - When changes on documentation (doc) | ||||||||||||||||||||||
# - When is triggered manually | ||||||||||||||||||||||
|
||||||||||||||||||||||
on: | ||||||||||||||||||||||
workflow_dispatch: | ||||||||||||||||||||||
push: | ||||||||||||||||||||||
|
||||||||||||||||||||||
permissions: | ||||||||||||||||||||||
contents: write | ||||||||||||||||||||||
|
||||||||||||||||||||||
jobs: | ||||||||||||||||||||||
update-locale: | ||||||||||||||||||||||
name: Update Locale | ||||||||||||||||||||||
runs-on: ubuntu-latest | ||||||||||||||||||||||
|
||||||||||||||||||||||
strategy: | ||||||||||||||||||||||
fail-fast: false | ||||||||||||||||||||||
|
||||||||||||||||||||||
steps: | ||||||||||||||||||||||
- name: Checkout repository | ||||||||||||||||||||||
uses: actions/checkout@v4 | ||||||||||||||||||||||
with: | ||||||||||||||||||||||
fetch-depth: 0 | ||||||||||||||||||||||
|
||||||||||||||||||||||
- name: Get postgres version | ||||||||||||||||||||||
run: | | ||||||||||||||||||||||
sudo service postgresql start | ||||||||||||||||||||||
pgver=$(psql --version | grep -Po '(?<=psql \(PostgreSQL\) )[^;]+(?=\.\d+ \()') | ||||||||||||||||||||||
echo "PGVER=${pgver}" >> $GITHUB_ENV | ||||||||||||||||||||||
echo "PGIS=3" >> $GITHUB_ENV | ||||||||||||||||||||||
Comment on lines
+30
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Fix shell script quoting issues. The script has potential word splitting issues due to unquoted variables. Apply these fixes: - pgver=$(psql --version | grep -Po '(?<=psql \(PostgreSQL\) )[^;]+(?=\.\d+ \()')
- echo "PGVER=${pgver}" >> $GITHUB_ENV
+ pgver="$(psql --version | grep -Po '(?<=psql \(PostgreSQL\) )[^;]+(?=\.\d+ \()')"
+ echo "PGVER=${pgver}" >> "$GITHUB_ENV" 📝 Committable suggestion
Suggested change
🧰 Tools🪛 actionlint (1.7.4)30-30: shellcheck reported issue in this script: SC2086:info:3:26: Double quote to prevent globbing and word splitting (shellcheck) 30-30: shellcheck reported issue in this script: SC2086:info:4:18: Double quote to prevent globbing and word splitting (shellcheck) |
||||||||||||||||||||||
|
||||||||||||||||||||||
- name: Extract branch name and commit hash | ||||||||||||||||||||||
run: | | ||||||||||||||||||||||
branch=${GITHUB_REF#refs/heads/} | ||||||||||||||||||||||
git_hash=$(git rev-parse --short "$GITHUB_SHA") | ||||||||||||||||||||||
echo "GIT_HASH=$git_hash" >> $GITHUB_ENV | ||||||||||||||||||||||
|
||||||||||||||||||||||
- name: Add PostgreSQL APT repository | ||||||||||||||||||||||
run: | | ||||||||||||||||||||||
sudo apt-get install curl ca-certificates gnupg | ||||||||||||||||||||||
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | ||||||||||||||||||||||
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ \ | ||||||||||||||||||||||
$(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' | ||||||||||||||||||||||
|
||||||||||||||||||||||
- name: Install python | ||||||||||||||||||||||
uses: actions/setup-python@v5 | ||||||||||||||||||||||
with: | ||||||||||||||||||||||
python-version: '3.x' | ||||||||||||||||||||||
|
||||||||||||||||||||||
- name: Install dependencies | ||||||||||||||||||||||
run: | | ||||||||||||||||||||||
sudo apt-get update | ||||||||||||||||||||||
sudo apt-get install -y osm2pgrouting \ | ||||||||||||||||||||||
postgresql-${PGVER}-postgis-${PGIS} \ | ||||||||||||||||||||||
postgresql-${PGVER}-postgis-${PGIS}-scripts \ | ||||||||||||||||||||||
postgresql-${PGVER}-pgrouting | ||||||||||||||||||||||
|
||||||||||||||||||||||
python -m pip install --upgrade pip | ||||||||||||||||||||||
pip install -r REQUIREMENTS.txt | ||||||||||||||||||||||
pip list | ||||||||||||||||||||||
|
||||||||||||||||||||||
- name: Configure | ||||||||||||||||||||||
run: | | ||||||||||||||||||||||
service postgresql status | ||||||||||||||||||||||
sudo service postgresql start | ||||||||||||||||||||||
service postgresql status | ||||||||||||||||||||||
sudo -u postgres createdb -p ${POSTGRES_PORT} setup | ||||||||||||||||||||||
sudo -u postgres psql -c 'CREATE ROLE "runner" SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN PASSWORD $$runner$$;' -d setup | ||||||||||||||||||||||
echo :5432:*:runner:runner >> .pgpass | ||||||||||||||||||||||
sudo -u postgres psql -c 'CREATE ROLE "user" SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN PASSWORD $$user$$;' -d setup | ||||||||||||||||||||||
echo :5432:*:user:user >> .pgpass | ||||||||||||||||||||||
Comment on lines
+71
to
+75
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Enhance PostgreSQL security configuration. The PostgreSQL setup uses hardcoded passwords and superuser privileges, which is not recommended for security. Consider:
Example: - sudo -u postgres psql -c 'CREATE ROLE "runner" SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN PASSWORD $$runner$$;' -d setup
+ sudo -u postgres psql -c "CREATE ROLE \"runner\" LOGIN PASSWORD '${RUNNER_PASSWORD}' INHERIT;" -d setup
+ sudo -u postgres psql -c "GRANT CONNECT ON DATABASE setup TO runner;" -d setup
|
||||||||||||||||||||||
mkdir build | ||||||||||||||||||||||
cd build | ||||||||||||||||||||||
cmake -DLOCALE=ON .. | ||||||||||||||||||||||
env: | ||||||||||||||||||||||
POSTGRES_HOST: localhost | ||||||||||||||||||||||
POSTGRES_PORT: 5432 | ||||||||||||||||||||||
POSTGRES_USER: postgres | ||||||||||||||||||||||
POSTGRES_PASSWORD: postgres | ||||||||||||||||||||||
POSTGRES_DB: setup | ||||||||||||||||||||||
|
||||||||||||||||||||||
- name: Initialize mandatory git config | ||||||||||||||||||||||
run: | | ||||||||||||||||||||||
git config user.name "github-actions[bot]" | ||||||||||||||||||||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||||||||||||||||||||||
|
||||||||||||||||||||||
- name: Update locale | ||||||||||||||||||||||
run: | | ||||||||||||||||||||||
bash .github/scripts/update_locale.sh | ||||||||||||||||||||||
|
||||||||||||||||||||||
# Add the files, commit and push | ||||||||||||||||||||||
git diff --staged --quiet || git commit -m "Update locale: commit ${{ env.GIT_HASH }}" | ||||||||||||||||||||||
git restore . # Remove the unstaged changes before rebasing | ||||||||||||||||||||||
git push |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add error handling for CMake configuration and build steps.
The script should check the return status of critical operations.
📝 Committable suggestion