Skip to content

Commit 0a7eced

Browse files
committed
improve sync
Signed-off-by: Vasiliy Tolstov <[email protected]>
1 parent 9bd73aa commit 0a7eced

File tree

11 files changed

+137
-24
lines changed

11 files changed

+137
-24
lines changed
File renamed without changes.

.gitea/ISSUE_TEMPLATE/feature-request---enhancement.md renamed to .github/ISSUE_TEMPLATE/feature-request---enhancement.md

File renamed without changes.
File renamed without changes.
File renamed without changes.

.github/workflows/job_coverage.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: coverage
2+
3+
on:
4+
push:
5+
branches: [ main, v3, v4 ]
6+
paths-ignore:
7+
- '.github/**'
8+
- '.gitea/**'
9+
pull_request:
10+
branches: [ main, v3, v4 ]
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
jobs:
15+
16+
build:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: checkout code
20+
uses: actions/checkout@v4
21+
with:
22+
filter: 'blob:none'
23+
24+
- name: setup go
25+
uses: actions/setup-go@v5
26+
with:
27+
cache-dependency-path: "**/*.sum"
28+
go-version: 'stable'
29+
30+
- name: test coverage
31+
run: |
32+
go test -v -cover ./... -covermode=count -coverprofile coverage.out -coverpkg ./...
33+
go tool cover -func coverage.out -o coverage.out
34+
35+
- name: coverage badge
36+
uses: tj-actions/coverage-badge-go@v2
37+
with:
38+
green: 80
39+
filename: coverage.out
40+
41+
- uses: stefanzweifel/git-auto-commit-action@v4
42+
name: autocommit
43+
with:
44+
commit_message: Apply Code Coverage Badge
45+
skip_fetch: false
46+
skip_checkout: false
47+
file_pattern: ./README.md
48+
49+
- name: push
50+
if: steps.auto-commit-action.outputs.changes_detected == 'true'
51+
uses: ad-m/github-push-action@master
52+
with:
53+
github_token: ${{ github.token }}
54+
branch: ${{ github.ref }}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ name: lint
33
on:
44
pull_request:
55
types: [opened, reopened, synchronize]
6-
branches:
7-
- master
8-
- v3
9-
- v4
6+
branches: [ master, v3, v4 ]
7+
paths-ignore:
8+
- '.github/**'
9+
- '.gitea/**'
1010

1111
jobs:
1212
lint:
@@ -24,6 +24,6 @@ jobs:
2424
- name: setup deps
2525
run: go get -v ./...
2626
- name: run lint
27-
uses: https://github.com/golangci/golangci-lint-action@v6
27+
uses: golangci/golangci-lint-action@v6
2828
with:
2929
version: 'latest'

.github/workflows/job_sync.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: sync
2+
3+
on:
4+
schedule:
5+
- cron: '*/5 * * * *'
6+
push:
7+
branches: [ master, v3, v4 ]
8+
paths-ignore:
9+
- '.github/**'
10+
- '.gitea/**'
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
jobs:
15+
sync:
16+
if: env.GITHUB_ACTION == 0
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: init
20+
run: |
21+
git config --global user.email "vtolstov <[email protected]>"
22+
git config --global user.name "github-actions[bot]"
23+
echo "machine git.unistack.org login vtolstov password ${{ secrets.TOKEN_GITEA }}" | tee -a /root/.netrc
24+
echo "machine github.com login vtolstov password ${{ secrets.TOKEN_GITHUB }}" | tee -a /root/.netrc
25+
26+
- name: sync master
27+
run: |
28+
git clone --depth=10 --branch master --single-branch ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} repo
29+
cd repo
30+
git remote add --no-tags --fetch --track master upstream https://github.com/${GITHUB_REPOSITORY}
31+
git pull --rebase upstream master
32+
git push upstream master --progress
33+
git merge --allow-unrelated-histories "upstream/master"
34+
git push origin master --progress
35+
cd ../
36+
rm -rf repo
37+
38+
- name: sync v3
39+
run: |
40+
git clone --depth=10 --branch v3 --single-branch ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} repo
41+
cd repo
42+
git remote add --no-tags --fetch --track v3 upstream https://github.com/${GITHUB_REPOSITORY}
43+
git pull --rebase upstream v3
44+
git push upstream v3
45+
git merge --allow-unrelated-histories "upstream/v3"
46+
git push origin v3 --progress
47+
cd ../
48+
rm -rf repo
49+
50+
- name: sync v4
51+
run: |
52+
git clone --depth=10 --branch v4 --single-branch ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} repo
53+
cd repo
54+
git remote add --no-tags --fetch --track v4 upstream https://github.com/${GITHUB_REPOSITORY}
55+
git pull --rebase upstream v4
56+
git push upstream v4
57+
git merge --allow-unrelated-histories "upstream/v4"
58+
git push origin v4 --progress
59+
cd ../
60+
rm -rf repo
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@ name: test
33
on:
44
pull_request:
55
types: [opened, reopened, synchronize]
6-
branches:
7-
- master
8-
- v3
9-
- v4
6+
branches: [ master, v3, v4 ]
107
push:
11-
branches:
12-
- master
13-
- v3
14-
- v4
8+
branches: [ master, v3, v4 ]
9+
paths-ignore:
10+
- '.github/**'
11+
- '.gitea/**'
1512

1613
jobs:
1714
test:
Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@ name: test
33
on:
44
pull_request:
55
types: [opened, reopened, synchronize]
6-
branches:
7-
- master
8-
- v3
9-
- v4
6+
branches: [ master, v3, v4 ]
107
push:
11-
branches:
12-
- master
13-
- v3
14-
- v4
8+
branches: [ master, v3, v4 ]
9+
paths-ignore:
10+
- '.github/**'
11+
- '.gitea/**'
1512

1613
jobs:
1714
test:
@@ -35,19 +32,19 @@ jobs:
3532
go-version: 'stable'
3633
- name: setup go work
3734
env:
38-
GOWORK: /workspace/${{ github.repository_owner }}/go.work
35+
GOWORK: ${{ github.workspace }}/go.work
3936
run: |
4037
go work init
4138
go work use .
4239
go work use micro-tests
4340
- name: setup deps
4441
env:
45-
GOWORK: /workspace/${{ github.repository_owner }}/go.work
42+
GOWORK: ${{ github.workspace }}/go.work
4643
run: go get -v ./...
4744
- name: run tests
4845
env:
4946
INTEGRATION_TESTS: yes
50-
GOWORK: /workspace/${{ github.repository_owner }}/go.work
47+
GOWORK: ${{ github.workspace }}/go.work
5148
run: |
5249
cd micro-tests
5350
go test -mod readonly -v ./... || true

0 commit comments

Comments
 (0)