Skip to content

Commit

Permalink
ci: support stylecheck on GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdrivingduck authored and polardb-bot[bot] committed Sep 3, 2024
1 parent d344201 commit 0c658df
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/stylecheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: stylecheck

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

jobs:
stylecheck:
runs-on: ubuntu-latest
strategy:
matrix:
container_image: [ anolis8 ]
steps:
- name: fetch source code
uses: actions/checkout@v4
# for copyright check
with:
fetch-depth: 0

- 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 -q && 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

0 comments on commit 0c658df

Please sign in to comment.