Skip to content

Commit 1853467

Browse files
committed
(CI) Adding workflows that need work
1 parent e026e1d commit 1853467

File tree

3 files changed

+315
-0
lines changed

3 files changed

+315
-0
lines changed

.github/workflows/macos.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Build for macOS
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- '.github/workflows/macos.yml'
8+
- 'sql/**'
9+
- 'pgtap/**'
10+
- 'tools/testers/**'
11+
- 'CMakeLists.txt'
12+
13+
branches-ignore:
14+
- 'gh-pages'
15+
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: true
19+
20+
permissions:
21+
contents: read
22+
23+
jobs:
24+
build:
25+
# disbale action, TODO install plpython3u.control
26+
if: ${{ false }}
27+
name: macos
28+
runs-on: ${{ matrix.os }}
29+
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
release: [Debug, Release]
34+
os: [macos-latest, macos-14]
35+
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- name: Install python
40+
uses: actions/setup-python@v5
41+
with:
42+
python-version: '3.12'
43+
44+
- name: Install dependencies
45+
run: |
46+
brew install postgresql@14 asio glpk rapidjson
47+
48+
- name: Configure
49+
run: |
50+
mkdir build
51+
cd build
52+
cmake -DCMAKE_BUILD_TYPE=${{ matrix.release }} -DWITH_DOC=OFF ..
53+
54+
- name: Build
55+
run: |
56+
cd build
57+
make -j
58+
make install
59+
60+
- name: Install pgTAP
61+
run: |
62+
git clone https://github.com/theory/pgtap.git pgTapExtension
63+
cd pgTapExtension
64+
make -j
65+
make install
66+
cpan TAP::Parser::SourceHandler::pgTAP
67+
ln -s $(find `brew --prefix` -name pg_prove) symlink it into $(brew --prefix)/bin
68+
69+
- name: Test
70+
run: |
71+
export PATH=$(brew --prefix)/Cellar/perl/$(perl -e 'print substr($^V, 1)')/bin:$PATH
72+
pg_ctl -D $(brew --prefix)/var/postgresql@14 start
73+
createuser -s postgres
74+
bash ./tools/testers/pg_prove_tests.sh -U postgres -p 5432

.github/workflows/release.yml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
release: Release
8+
os: ubuntu-latest
9+
vroom: 1.12.0
10+
11+
jobs:
12+
release:
13+
name: Release
14+
# disbale action, we need discussions on https://github.com/pgRouting/pgorpy/
15+
if: ${{ false }}
16+
runs-on: ubuntu-latest
17+
18+
strategy:
19+
fail-fast: false
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Initialize mandatory git config
27+
run: |
28+
git config user.name "github-actions[bot]"
29+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
30+
31+
- name: Get postgres version
32+
run: |
33+
sudo service postgresql start
34+
PGVER=$(psql --version | grep -Po '(?<=psql \(PostgreSQL\) )[^;]+(?=\.\d+ \()')
35+
echo "PGVER=${PGVER}" >> $GITHUB_ENV
36+
echo "PGPORT=5432" >> $GITHUB_ENV
37+
PROJECT_VERSION=$(grep -Po '(?<=project\(pgORpy VERSION )[^;]+' CMakeLists.txt)
38+
echo "PROJECT_VERSION=${PROJECT_VERSION}" >> $GITHUB_ENV
39+
echo "TAG_NAME=v${PROJECT_VERSION}" >> $GITHUB_ENV
40+
41+
- name: Create and Push Tag
42+
run: |
43+
git tag -a "${TAG_NAME}" -m "Release version ${TAG_NAME}"
44+
git push origin "${TAG_NAME}"
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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+
68+
- name: Install Google OR-Tools
69+
run: |
70+
sudo pip install --root=/ ortools==9.10.4067
71+
72+
- name: Configure
73+
run: |
74+
mkdir build
75+
cd build
76+
cmake -DCMAKE_BUILD_TYPE=${{ env.release }} ..
77+
78+
- name: Build
79+
run: |
80+
cd build
81+
make doc
82+
83+
- name: Update Users Documentation
84+
run: |
85+
git checkout origin/gh-pages
86+
git checkout -b gh-pages
87+
PROJECT_MAJOR="v${PROJECT_VERSION%%.*}"
88+
rm -rf ${PROJECT_MAJOR}
89+
cp -r build/doc/_build ${PROJECT_MAJOR}
90+
git add ${PROJECT_MAJOR}
91+
git diff-index --quiet HEAD || git commit -m "Update users documentation for ${PROJECT_VERSION} (tag ${TAG_NAME})"
92+
git fetch origin
93+
git rebase origin/gh-pages
94+
git push origin gh-pages
95+
git checkout @{-2}
96+
97+
- name: Download Assets
98+
run: |
99+
wget -c https://github.com/${{ github.repository }}/archive/${TAG_NAME}.zip
100+
wget -c https://github.com/${{ github.repository }}/archive/${TAG_NAME}.tar.gz
101+
mv ${TAG_NAME}.zip ${{ github.event.repository.name }}-${PROJECT_VERSION}.zip
102+
mv ${TAG_NAME}.tar.gz ${{ github.event.repository.name }}-${PROJECT_VERSION}.tar.gz
103+
104+
- name: Make Attachments
105+
run: |
106+
cd build/doc/_build
107+
108+
cp -r html doc-v${PROJECT_VERSION}-en
109+
rm -rf doc-v${PROJECT_VERSION}-en/es
110+
tar -zcvf doc-v${PROJECT_VERSION}-en.tar.gz doc-v${PROJECT_VERSION}-en
111+
112+
cd ../..
113+
cat NEWS.md | tr '\0' '\n' > release_body.txt
114+
115+
# Only executed during the first release
116+
grep -q '[^[:space:]]' < release_body.txt || cp NEWS.md release_body.txt
117+
118+
echo >> release_body.txt
119+
echo "**Attachments**" >> release_body.txt
120+
echo "File | Contents" >> release_body.txt
121+
echo "| --- | --- |" >> release_body.txt
122+
echo "| \`doc-v${PROJECT_VERSION}-en.tar.gz\` | English documentation. Redirection to English" >> release_body.txt
123+
echo "| \`pgorpy-${PROJECT_VERSION}.tar.gz\` | tar.gz of the release" >> release_body.txt
124+
echo "| \`pgorpy-${PROJECT_VERSION}.zip\` | zip of the release" >> release_body.txt
125+
cat release_body.txt
126+
127+
- name: Create Draft Release
128+
uses: softprops/action-gh-release@v1
129+
with:
130+
body_path: release_body.txt
131+
name: ${{ env.TAG_NAME }}
132+
draft: true
133+
prerelease: false
134+
files: |
135+
build/doc/doc-v${{ env.PROJECT_VERSION }}-en.tar.gz
136+
${{ github.event.repository.name }}-${{ env.PROJECT_VERSION }}.zip
137+
${{ github.event.repository.name }}-${{ env.PROJECT_VERSION }}.tar.gz
138+
139+
env:
140+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/website.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Website
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
release: Release
8+
os: ubuntu-latest
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
update-website:
15+
name: Update Website
16+
runs-on: ubuntu-latest
17+
# disbale action, we need a: pgorpy.pgrouting.org
18+
if: ${{ false }}
19+
#if: ${{ github.repository_owner == 'pgRouting' }}
20+
strategy:
21+
fail-fast: false
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Extract branch name and commit hash
29+
run: |
30+
branch=${GITHUB_REF#refs/heads/}
31+
echo "BRANCH=$branch" >> $GITHUB_ENV
32+
git_hash=$(git rev-parse --short "$GITHUB_SHA")
33+
echo "GIT_HASH=$git_hash" >> $GITHUB_ENV
34+
35+
- name: Get postgres version
36+
run: |
37+
sudo service postgresql start
38+
PGVER=$(psql --version | grep -Po '(?<=psql \(PostgreSQL\) )[^;]+(?=\.\d+ \()')
39+
echo "PGVER=${PGVER}" >> $GITHUB_ENV
40+
echo "PGPORT=5432" >> $GITHUB_ENV
41+
42+
- name: Install python
43+
uses: actions/setup-python@v5
44+
with:
45+
python-version: '3.12'
46+
47+
- name: Install dependencies
48+
run: |
49+
sudo apt-get update
50+
51+
# Basic dependencies
52+
sudo apt-get install -y \
53+
postgresql-${PGVER} \
54+
postgresql-server-dev-${PGVER}
55+
56+
# documentation dependencies
57+
sudo apt-get install -y \
58+
graphviz \
59+
python3-sphinx \
60+
python3-sphinx-bootstrap-theme
61+
62+
- name: Install Google OR-Tools
63+
run: |
64+
sudo pip install --root=/ ortools==9.10.4067
65+
66+
- name: Configure
67+
run: |
68+
mkdir build
69+
cd build
70+
cmake -DCMAKE_BUILD_TYPE=${{ env.release }} \
71+
-DDOC_USE_BOOTSTRAP=ON -DWITH_DOC=ON ..
72+
73+
- name: Build
74+
run: |
75+
cd build
76+
make doc
77+
78+
- name: Initialize mandatory git config
79+
run: |
80+
git config user.name "github-actions[bot]"
81+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
82+
83+
- name: Update Users Documentation
84+
env:
85+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86+
run: |
87+
if [[ "${{ env.BRANCH }}" == "main" ]]; then
88+
FOLDER_NAME="main"
89+
elif [[ "${{ env.BRANCH }}" == "develop" ]]; then
90+
FOLDER_NAME="dev"
91+
fi
92+
git checkout origin/gh-pages
93+
git checkout -b gh-pages
94+
rm -rf ${FOLDER_NAME}
95+
cp -r build/doc/_build/html ${FOLDER_NAME}
96+
git add ${FOLDER_NAME}
97+
git diff-index --quiet HEAD || git commit -m "Update users documentation for ${PROJECT_VERSION} (${{ env.BRANCH }}): commit ${{ env.GIT_HASH }}"
98+
git fetch origin
99+
git rebase origin/gh-pages
100+
git push origin gh-pages
101+
git checkout @{-2}

0 commit comments

Comments
 (0)