Skip to content

Commit e026e1d

Browse files
committed
(CI) Adding workflows that pass
1 parent 79fa317 commit e026e1d

File tree

5 files changed

+553
-0
lines changed

5 files changed

+553
-0
lines changed
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
name: Check Documentation
2+
3+
# This action runs:
4+
# - When this file changes
5+
# - When changes on documentation (doc)
6+
# - When changes on translation (locale)
7+
# - When the way the documentation build changes (CMakeLists.txt, doc/CMakeLists.txt, doc/conf.py.in)
8+
#
9+
# documentation is tested only on:
10+
# - ubuntu-latest
11+
# - default postgres installed on ubuntu-latest
12+
13+
on:
14+
workflow_dispatch:
15+
push:
16+
paths:
17+
- '.github/workflows/documentation.yml'
18+
- 'doc/**'
19+
- 'locale/**'
20+
- 'CMakeLists.txt'
21+
22+
branches-ignore:
23+
- 'gh-pages'
24+
25+
tags: []
26+
27+
pull_request:
28+
paths:
29+
- '.github/workflows/documentation.yml'
30+
- 'doc/**'
31+
- 'locale/**'
32+
- 'CMakeLists.txt'
33+
34+
concurrency:
35+
group: ${{ github.workflow }}-${{ github.ref }}
36+
cancel-in-progress: true
37+
38+
permissions:
39+
contents: read
40+
41+
env:
42+
release: Release
43+
os: ubuntu-latest
44+
45+
jobs:
46+
check-documentation:
47+
name: documentation
48+
runs-on: ubuntu-latest
49+
50+
strategy:
51+
fail-fast: false
52+
matrix:
53+
language: [en]
54+
os: [ubuntu-latest]
55+
56+
steps:
57+
- uses: actions/checkout@v4
58+
with:
59+
fetch-depth: 2
60+
61+
- name: check modified files
62+
id: check_files
63+
run: |
64+
# allways processing english, no matter what the change was
65+
if [[ "${{ matrix.language }}" == "en" ]]; then echo "PROCESS=true" >> $GITHUB_ENV; echo "CHK_LINK=true" >> $GITHUB_ENV; exit 0; fi
66+
67+
if [[ "${{ matrix.language }}" == "zh_Hans" && "${{ github.repository_owner }}" != "pgRouting" ]]; then echo "PROCESS=false" >> $GITHUB_ENV; exit 0; fi
68+
69+
# when this file changes all languages are tested
70+
if git diff --name-only HEAD^ HEAD | grep -q '.github/workflows/documentation.yml' ; then echo "PROCESS=true" >> $GITHUB_ENV; exit 0; fi
71+
72+
# when there is a change on the way the build is done all languages are tested
73+
if git diff --name-only HEAD^ HEAD | grep -q '^CMakeLists.txt' ; then echo "PROCESS=true" >> $GITHUB_ENV; exit 0; fi
74+
if git diff --name-only HEAD^ HEAD | grep -q '^doc/CMakeLists.txt' ; then echo "PROCESS=true" >> $GITHUB_ENV; exit 0; fi
75+
if git diff --name-only HEAD^ HEAD | grep -q '^doc/conf.py.in' ; then echo "PROCESS=true" >> $GITHUB_ENV; exit 0; fi
76+
77+
# if there is a change on the translation
78+
if git diff --name-only HEAD^ HEAD | grep -q "^locale/${{ matrix.language }}" ; then echo "PROCESS=true" >> $GITHUB_ENV; echo "CHK_LINK=true" >> $GITHUB_ENV; exit 0; fi
79+
80+
- name: Get postgres version
81+
if: env.PROCESS == 'true'
82+
run: |
83+
sudo service postgresql start
84+
PGVER=$(psql --version | grep -Po '(?<=psql \(PostgreSQL\) )[^;]+(?=\.\d+ \()')
85+
echo "PGVER=${PGVER}" >> $GITHUB_ENV
86+
echo "PGPORT=5432" >> $GITHUB_ENV
87+
88+
- name: Install python
89+
if: env.PROCESS == 'true'
90+
uses: actions/setup-python@v5
91+
with:
92+
python-version: '3.12'
93+
94+
- name: Install dependencies
95+
if: env.PROCESS == 'true'
96+
run: |
97+
sudo apt-get update
98+
99+
# Basic dependencies
100+
sudo apt-get install -y \
101+
postgresql-${PGVER} \
102+
postgresql-server-dev-${PGVER}
103+
104+
# documentation dependencies
105+
sudo apt-get install -y \
106+
graphviz \
107+
python3-sphinx \
108+
python3-sphinx-bootstrap-theme \
109+
sphinx-intl
110+
111+
- name: Install Google OR-Tools
112+
if: env.PROCESS == 'true'
113+
run: |
114+
sudo pip install --root=/ ortools==9.10.4067
115+
116+
- name: Configure
117+
if: env.PROCESS == 'true'
118+
run: |
119+
mkdir build
120+
cd build
121+
cmake -DCMAKE_BUILD_TYPE=${{ env.release }} \
122+
-DSPHINX_LINKCHECK=ON ..
123+
124+
- name: Build Documentation
125+
if: env.PROCESS == 'true'
126+
run: |
127+
cd build
128+
make html-${{ matrix.language }}
129+
130+
- name: Check Links
131+
if: env.CHK_LINK == 'true'
132+
run: |
133+
cd build
134+
make linkcheck-${{ matrix.language }}

.github/workflows/files.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Check files
2+
3+
4+
# Makes a general check on the files
5+
# Verifies:
6+
# - the signatures are up-to-date
7+
# - the release_notes and NEWS are consitent
8+
# - the files have a license
9+
# - the shell scripts are ok
10+
# Does not makes a compilation
11+
12+
on: [push, pull_request]
13+
14+
permissions:
15+
contents: read
16+
17+
defaults:
18+
run:
19+
shell: bash
20+
working-directory: .github/scripts
21+
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.ref }}
24+
cancel-in-progress: true
25+
26+
jobs:
27+
Signature_check:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v4
32+
- name: Signatures are not removed
33+
run: ./test_signatures.sh
34+
35+
News_check:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v4
40+
- name: News file up to date
41+
working-directory: ./
42+
run: |
43+
.github/scripts/notes2news.pl
44+
if git status | grep 'NEWS.md'; then echo "NEWS.md is not up to date"; exit 1; fi
45+
if ! grep -q $(grep -Po '(?<=project\(pgORpy VERSION )[^;]+' CMakeLists.txt) NEWS.md; then echo "Missing section in NEWS.md"; exit 1; fi
46+
47+
License_check:
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Checkout
51+
uses: actions/checkout@v4
52+
- name: Install Requirements
53+
run: sudo apt install -y licensecheck
54+
- name: Run License Check
55+
run: ./test_license.sh
56+
57+
Shell_check:
58+
runs-on: ubuntu-latest
59+
steps:
60+
- name: Checkout
61+
uses: actions/checkout@v4
62+
- name: Install Requirements
63+
run: sudo apt-get install -y shellcheck
64+
- name: Run Shell Check
65+
run: ./test_shell.sh

.github/workflows/locale.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Update Locale
2+
3+
# This action runs:
4+
# - When this file changes
5+
# - When changes on documentation (doc)
6+
# - When is triggered manually
7+
8+
on:
9+
workflow_dispatch:
10+
push:
11+
paths:
12+
- '.github/workflows/locale.yml'
13+
- 'doc/**'
14+
15+
branches-ignore:
16+
- 'gh-pages'
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
permissions:
23+
contents: write
24+
25+
env:
26+
release: Release
27+
os: ubuntu-latest
28+
29+
jobs:
30+
update-locale:
31+
name: Update Locale
32+
runs-on: ubuntu-latest
33+
strategy:
34+
fail-fast: false
35+
36+
steps:
37+
- uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 0
40+
41+
- name: Get postgres version
42+
run: |
43+
sudo service postgresql start
44+
PGVER=$(psql --version | grep -Po '(?<=psql \(PostgreSQL\) )[^;]+(?=\.\d+ \()')
45+
echo "PGVER=${PGVER}" >> $GITHUB_ENV
46+
echo "PGPORT=5432" >> $GITHUB_ENV
47+
48+
- name: Install python
49+
uses: actions/setup-python@v5
50+
with:
51+
python-version: '3.12'
52+
53+
- name: Install dependencies
54+
run: |
55+
sudo apt-get update
56+
57+
# Basic dependencies
58+
sudo apt-get install -y \
59+
postgresql-${PGVER} \
60+
postgresql-server-dev-${PGVER}
61+
62+
# documentation dependencies
63+
sudo apt-get install -y \
64+
graphviz \
65+
python3-sphinx \
66+
python3-sphinx-bootstrap-theme \
67+
sphinx-intl
68+
69+
- name: Install Google OR-Tools
70+
run: |
71+
sudo pip install --root=/ ortools==9.10.4067
72+
73+
- name: Configure
74+
run: |
75+
mkdir build
76+
cd build
77+
cmake -DCMAKE_BUILD_TYPE=${{ env.release }} \
78+
-DSPHINX_LOCALE=ON ..
79+
80+
- name: Build the locale files
81+
run: |
82+
cd build
83+
make locale
84+
85+
- name: Extract branch name and commit hash
86+
run: |
87+
branch=${GITHUB_REF#refs/heads/}
88+
git_hash=$(git rev-parse --short "$GITHUB_SHA")
89+
echo "GIT_HASH=$git_hash" >> $GITHUB_ENV
90+
91+
- name: Initialize mandatory git config
92+
run: |
93+
git config user.name "github-actions[bot]"
94+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
95+
96+
- name: Update locale
97+
run: |
98+
bash .github/scripts/update_locale.sh
99+
# Add the files, commit and push
100+
git diff --staged --quiet || git commit -m "Update locale: commit for hash ${{ env.GIT_HASH }}"
101+
git restore . # Remove the unstaged changes before rebasing
102+
git push

0 commit comments

Comments
 (0)