Skip to content

Commit d92540f

Browse files
authored
Merge pull request #17 from MarinerQ/feature/check_semver
Add gitlab CI for checking semver is bumped.
2 parents 4d699bf + 5168fed commit d92540f

File tree

5 files changed

+52
-13
lines changed

5 files changed

+52
-13
lines changed

.github/workflows/check-semver.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: check-semver
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main, dev]
7+
8+
jobs:
9+
check-semver:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
- name: Check diff
17+
run: |
18+
SEMVER_CHANGED=$(git diff origin/$GITHUB_BASE_REF...HEAD setup.py | grep "version=")
19+
if [ -z "$SEMVER_CHANGED" ]; then exit 1; else exit 0; fi

.gitlab-ci.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
image: docker:20.10.14
1+
image: python:3.10.2-slim-bullseye
22

3-
pre-commit:
4-
image: python:3.10.2-slim-bullseye
5-
before_script:
6-
- apt update && apt install -y --no-install-recommends git
7-
- /usr/local/bin/python -m pip install --upgrade pip
8-
- pip install pre-commit
9-
script:
10-
- pre-commit run --all-files
11-
rules:
12-
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
13-
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH == "dev")
3+
stages:
4+
- lint
5+
- build
6+
- deploy
7+
8+
include:
9+
- local: '/.gitlab/ci/check-semver.yaml'

.gitlab/ci/check-semver.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
check-semver:
2+
stage: lint
3+
image:
4+
name: alpine/git
5+
entrypoint: [""]
6+
script:
7+
- git fetch
8+
- SEMVER_CHANGED=$(git diff $CI_MERGE_REQUEST_DIFF_BASE_SHA...HEAD setup.py | grep "version=")
9+
- if [ -z "$SEMVER_CHANGED" ]; then exit 1; else exit 0; fi
10+
rules:
11+
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && ($CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "dev")

.gitlab/ci/pre-commit.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
image: python:3.10.2-slim-bullseye
2+
3+
pre-commit:
4+
stage: lint
5+
before_script:
6+
- apt update && apt install -y --no-install-recommends git
7+
- /usr/local/bin/python -m pip install --upgrade pip
8+
- pip install pre-commit
9+
script:
10+
- pre-commit run --all-files
11+
rules:
12+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
13+
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH == "dev")

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
setup(
3030
name='sealgw',
31-
version="0.0.1",
31+
version="0.0.2",
3232
description='SealGW: SEmi-Analytical Localization for Gravitational Waves',
3333
author='Qian Hu',
3434
author_email='[email protected]',

0 commit comments

Comments
 (0)