Skip to content

Commit

Permalink
ci: support precheck and stylecheck for v15
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdrivingduck committed Sep 3, 2024
1 parent d344201 commit 3977f89
Show file tree
Hide file tree
Showing 5 changed files with 208 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Bug report
about: Create a report to help us improve
title: "[Bug]"
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. xxx
2. xxx
3. xxx

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Environment (please complete the following information):**
- OS: [e.g. CentOS 7]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: Question
about: Ask question about anything here.
title: "[Question]"
labels: question
assignees: ''

---

**Describe the problem**

...
66 changes: 66 additions & 0 deletions .github/workflows/precheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: precheck

on:
push:
branches: [ POLARDB_15_STABLE ]
paths:
- '.github/workflows/precheck.yml'
- 'config/**'
- 'contrib/**'
- 'external/**'
- 'src/**'
- 'configure*'
- 'build.sh'
pull_request:
branches: [ POLARDB_15_STABLE ]
paths:
- '.github/workflows/precheck.yml'
- 'config/**'
- 'contrib/**'
- 'external/**'
- 'src/**'
- 'configure*'
- 'build.sh'
# trigger testing manually
workflow_dispatch:

jobs:
build_normal:
runs-on: ubuntu-latest
strategy:
matrix:
container_image: [ ubuntu20.04, ubuntu22.04, ubuntu24.04, anolis8, rocky8, rocky9 ]
debug_mode: [ on, off ]
steps:
- name: fetch source code
uses: actions/checkout@v4

- name: create and start the container
run: |
docker create \
-t \
--name polardb_${{ matrix.container_image }} \
-v `pwd`:/home/postgres/PolarDB-for-PostgreSQL \
polardb/polardb_pg_devel:${{ matrix.container_image }} \
bash && \
docker start polardb_${{ matrix.container_image }}
- name: change ownership of the source code
run: |
docker exec \
polardb_${{ matrix.container_image }} \
bash -c "cd /home/postgres/PolarDB-for-PostgreSQL && \
sudo chown -R postgres:postgres ./"
- name: build and run precheck
run: |
docker exec \
polardb_${{ matrix.container_image }} \
bash -c "cd /home/postgres/PolarDB-for-PostgreSQL && \
if [ -f /etc/bashrc ]; then source /etc/bashrc; fi && \
./build.sh --ws=1 --wr=2 --debug=${{ matrix.debug_mode }} --jobs=$jobs --ec='--enable-tap-tests' && \
make precheck -j$jobs"
- name: change ownership of the source code back
run: |
sudo chown -R runner:runner `pwd`
58 changes: 58 additions & 0 deletions .github/workflows/stylecheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: stylecheck

on:
push:
branches: [ POLARDB_15_STABLE ]
pull_request:
branches: [ POLARDB_15_STABLE ]
# trigger testing manually
workflow_dispatch:

jobs:
build_normal:
runs-on: ubuntu-latest
strategy:
matrix:
container_image: [ ubuntu24.04 ]
steps:
- name: fetch PolarDB source code
uses: actions/checkout@v4
# for copyright check
with:
fetch-depth: 2

- name: create and start the container
run: |
docker create \
-t \
--name polardb_${{ matrix.container_image }} \
-v `pwd`:/home/postgres/PolarDB-for-PostgreSQL \
polardb/polardb_pg_devel:${{ matrix.container_image }} \
bash && \
docker start polardb_${{ matrix.container_image }}
- name: change ownership of the source code
run: |
docker exec \
polardb_${{ matrix.container_image }} \
bash -c "cd /home/postgres/PolarDB-for-PostgreSQL && \
sudo chown -R postgres:postgres ./"
- name: stylecheck
run: |
docker exec \
polardb_${{ matrix.container_image }} \
bash -c "cd /home/postgres/PolarDB-for-PostgreSQL && \
./configure && make stylecheck"
- name: change ownership of the source code
run: |
sudo chown -R runner:runner `pwd`
- name: check diff
run: |
if [[ $(git diff --stat) != '' ]]; then \
git diff >> style.diff; \
cat style.diff; \
exit 1; \
fi
42 changes: 42 additions & 0 deletions .github/workflows/sync-postgres.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: sync with postgres upstream

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"

jobs:
repo-sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: repo-sync-master
uses: repo-sync/github-sync@v2
with:
source_repo: https://github.com/postgres/postgres.git
source_branch: master
destination_branch: master
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: repo-sync-17
uses: repo-sync/github-sync@v2
with:
source_repo: https://github.com/postgres/postgres.git
source_branch: REL_17_STABLE
destination_branch: REL_17_STABLE
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: repo-sync-16
uses: repo-sync/github-sync@v2
with:
source_repo: https://github.com/postgres/postgres.git
source_branch: REL_16_STABLE
destination_branch: REL_16_STABLE
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: repo-sync-15
uses: repo-sync/github-sync@v2
with:
source_repo: https://github.com/postgres/postgres.git
source_branch: REL_15_STABLE
destination_branch: REL_15_STABLE
github_token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 3977f89

Please sign in to comment.