Skip to content

Commit a00c584

Browse files
committed
chore: add go, python, rust, java examples
1 parent da63678 commit a00c584

38 files changed

+4464
-103
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Build Runner Image
2+
run-name: Build Runner Image
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- docker/**
10+
- build.sh
11+
- Makefile
12+
- .github/workflows/build_runner_image.yml
13+
# Scheduled on every 4:00 A.M. in UTC+8 on Monday.
14+
schedule:
15+
- cron: "0 20 * * 1"
16+
workflow_dispatch:
17+
18+
concurrency:
19+
group: build-runner-image-${{ github.event_name }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
build-runner:
24+
runs-on:
25+
group: github-amd64-8c32g
26+
timeout-minutes: 15
27+
steps:
28+
- run: sudo chown -R $(whoami) .
29+
- run: git config --global --add safe.directory '*'
30+
- uses: actions/checkout@v4
31+
32+
- uses: docker/login-action@v3
33+
with:
34+
registry: ghcr.io
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- uses: docker/setup-qemu-action@v3
39+
40+
- uses: docker/setup-buildx-action@v3
41+
42+
- uses: docker/metadata-action@v5
43+
id: meta
44+
with:
45+
images: ghcr.io/${{ github.repository }}/runner
46+
flavor: |
47+
latest=true
48+
tags: |
49+
type=sha,prefix=sha-,suffix=,format=short
50+
51+
- uses: docker/build-push-action@v6
52+
env:
53+
DOCKER_BUILD_SUMMARY: false
54+
with:
55+
pull: true
56+
push: true
57+
platforms: linux/amd64
58+
tags: ${{ steps.meta.outputs.tags }}
59+
labels: ${{ steps.meta.outputs.labels }}
60+
file: ./docker/Dockerfile.runner
61+
context: .

.github/workflows/dev_checks.yml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: Dev checks
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
paths-ignore:
7+
- "assets/**"
8+
- "**.md"
9+
- ".gitignore"
10+
- "docker/**"
11+
push:
12+
branches:
13+
- main
14+
paths-ignore:
15+
- "assets/**"
16+
- "**.md"
17+
- ".gitignore"
18+
- "docker/**"
19+
workflow_dispatch:
20+
21+
concurrency:
22+
group: dev-checks-${{ github.event_name }}-${{ github.ref }}
23+
cancel-in-progress: true
24+
25+
jobs:
26+
commit-check:
27+
runs-on: ubuntu-22.04
28+
if: ${{ github.event_name == 'push' }}
29+
timeout-minutes: 5
30+
steps:
31+
- name: Check Commit Type
32+
uses: gsactions/commit-message-checker@v2
33+
with:
34+
pattern: '^(feat|fix|docs|style|refactor|chore|perf|test|build|ci|revert)(\(\S+\))?: .+'
35+
error: "Invalid commit type"
36+
excludeDescription: "true"
37+
excludeTitle: "false"
38+
checkAllCommitMessages: "true"
39+
accessToken: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Check Commit Message
42+
uses: gsactions/commit-message-checker@v2
43+
with:
44+
pattern: '^.+: [^A-Z].+[^\.](\n.*)*$'
45+
error: 'Invalid commit message: first letter capitalized, less than 3 letter, end with "."'
46+
excludeDescription: "true"
47+
excludeTitle: "true"
48+
checkAllCommitMessages: "true"
49+
accessToken: ${{ secrets.GITHUB_TOKEN }}
50+
51+
format-check:
52+
runs-on: ubuntu-22.04
53+
timeout-minutes: 5
54+
container:
55+
image: ghcr.io/${{ github.repository }}/runner:latest
56+
steps:
57+
- run: git config --global --add safe.directory '*'
58+
- uses: actions/checkout@v4
59+
- name: Check Go format
60+
working-directory: go
61+
run: |
62+
if [ -n "$(gofmt -d .)" ]; then
63+
echo "Formatting issues found. Please run gofmt."
64+
exit 1
65+
fi
66+
- name: Check Python format
67+
working-directory: python
68+
run: |
69+
black --check .
70+
- name: Check Rust format
71+
working-directory: rust
72+
run: |
73+
cargo fmt --check 2>/dev/null
74+
75+
typo-check:
76+
runs-on: ubuntu-22.04
77+
container:
78+
image: ghcr.io/${{ github.repository }}/runner:latest
79+
timeout-minutes: 5
80+
steps:
81+
- run: git config --global --add safe.directory '*'
82+
- uses: actions/checkout@v4
83+
- uses: crate-ci/typos@master
84+
85+
deny-check:
86+
runs-on: ubuntu-22.04
87+
timeout-minutes: 5
88+
steps:
89+
- run: git config --global --add safe.directory '*'
90+
- uses: actions/checkout@v4
91+
- run: cd rust
92+
- uses: EmbarkStudios/cargo-deny-action@v1
93+
with:
94+
manifest-path: rust/Cargo.toml
95+
arguments: --all-features
96+
command: check licenses sources bans
97+
98+
toml-check:
99+
runs-on: ubuntu-22.04
100+
timeout-minutes: 10
101+
container:
102+
image: ghcr.io/${{ github.repository }}/runner:latest
103+
steps:
104+
- run: git config --global --add safe.directory '*'
105+
- uses: actions/checkout@v4
106+
- run: taplo format --check --diff
107+
108+
clippy-check:
109+
runs-on:
110+
group: github-amd64-8c32g
111+
timeout-minutes: 15
112+
container:
113+
image: ghcr.io/${{ github.repository }}/runner:latest
114+
steps:
115+
- run: git config --global --add safe.directory '*'
116+
- uses: actions/checkout@v4
117+
- run: ls
118+
- run: pwd
119+
- run: rustup toolchain list
120+
- working-directory: rust
121+
run: cargo clippy --workspace --all-targets --all-features -- -D warnings

0 commit comments

Comments
 (0)