-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
小滋润
committed
Oct 29, 2024
1 parent
9c635a7
commit 8b37aeb
Showing
231 changed files
with
26,694 additions
and
3,821 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
local_test | ||
docker/runtime | ||
docker/log | ||
docker/data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[*.go] | ||
indent_style = tab | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[*.go] | ||
indent_style = tab | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
*.go whitespace=fix | ||
|
||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
|
||
# Always perform LF normalization on Go source files and related text files | ||
*.go text | ||
*.md text | ||
*.yaml text | ||
*.yml text | ||
*.json text | ||
*.sh text | ||
*.txt text | ||
*.xml text | ||
|
||
# Make sure that these Windows files always have CRLF line endings in checkout | ||
*.bat text eol=crlf | ||
*.ps1 text eol=crlf | ||
|
||
# Never perform LF normalization on these binary files | ||
*.zip binary | ||
*.tar binary | ||
*.gz binary | ||
*.bz2 binary | ||
*.7z binary | ||
*.rar binary | ||
*.xls binary | ||
*.xlsx binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: CI | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
test-and-update-docs: | ||
uses: ./.github/workflows/common-test-and-update-docs.yml | ||
with: | ||
ref: ${{ github.ref }} | ||
|
||
push-image: | ||
needs: test-and-update-docs | ||
uses: ./.github/workflows/common-push-image.yml | ||
with: | ||
tag: latest | ||
secrets: | ||
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Create Release | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
draft: | ||
required: true | ||
type: boolean | ||
|
||
jobs: | ||
create-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Create GitHub Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref_name }} | ||
release_name: "Release ${{ github.ref_name }}" | ||
body: | | ||
Release notes for version ${{ github.ref_name }}. | ||
draft: ${{ inputs.draft }} | ||
prerelease: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Push Image | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
tag: | ||
required: true | ||
type: string | ||
|
||
secrets: | ||
DOCKER_HUB_USERNAME: | ||
required: true | ||
DOCKER_HUB_ACCESS_TOKEN: | ||
required: true | ||
|
||
jobs: | ||
push-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: docker/Dockerfile.build | ||
push: true | ||
tags: xiaozirun/leap-ledger:${{ inputs.tag }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Test And Update Docs | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
ref: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
test-and-update-docs: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build image | ||
run: | | ||
docker build -t xiaozirun/leap-ledger:latest -f docker/Dockerfile . | ||
- name: Set up Docker Compose | ||
run: | | ||
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | ||
sudo chmod +x /usr/local/bin/docker-compose | ||
- name: Start server | ||
run: | | ||
docker-compose -f docker-compose.yaml up -d leap-ledger-mysql && docker-compose -f docker-compose.yaml up -d | ||
- name: Run tests and make report | ||
run: | | ||
docker exec leap-ledger-server sh -c "go install github.com/jstemmer/go-junit-report@latest" | ||
docker exec leap-ledger-server sh -c "go test -v 2>&1 ./... -coverprofile=docs/coverage.out | go-junit-report > docs/test-report.xml" | ||
docker exec leap-ledger-server sh -c "go tool cover -html=docs/coverage.out -o docs/coverage.html" | ||
continue-on-error: false | ||
|
||
- name: Upload test-report.xml | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: test-report.xml | ||
path: docs/test-report.xml | ||
|
||
- name: Upload coverage.html | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: coverage-report | ||
path: docs/coverage.html | ||
|
||
- name: Execute updateDocs.sh in container | ||
run: docker exec leap-ledger-server sh "./docs/updateDocs.sh" | ||
|
||
- name: Commit and push changes | ||
# https://github.com/actions/checkout/discussions/479 | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git add -u docs/docs.go docs/swagger.json docs/swagger.yaml | ||
if git diff-index --quiet HEAD --; then | ||
echo "No changes to commit." | ||
else | ||
git commit -m "update docs" || echo "No changes to commit." | ||
git push origin ${{ inputs.ref }} | ||
fi | ||
- name: Docker Compose Down | ||
run: | | ||
docker-compose -f docker-compose.yaml down |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Develop CI | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ "develop" ] | ||
|
||
jobs: | ||
test-and-update-docs: | ||
uses: ./.github/workflows/common-test-and-update-docs.yml | ||
with: | ||
ref: ${{ github.ref }} | ||
|
||
push-image: | ||
needs: test-and-update-docs | ||
uses: ./.github/workflows/common-push-image.yml | ||
with: | ||
tag: ${{ github.ref_name }} | ||
secrets: | ||
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Push Tag | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
create-release: | ||
uses: ./.github/workflows/common-create-release.yml | ||
with: | ||
draft: true | ||
|
||
push-image: | ||
needs: create-release | ||
uses: ./.github/workflows/common-push-image.yml | ||
with: | ||
tag: ${{ github.ref_name }} | ||
secrets: | ||
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.