Skip to content

Commit 5799575

Browse files
committed
add 1st version
Signed-off-by: roots666 <m0980701299@gmail.com>
0 parents  commit 5799575

42 files changed

Lines changed: 5259 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ["v*.*.*"]
7+
pull_request:
8+
branches: [main]
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
build-amd64:
16+
name: Build amd64
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Install build dependencies
23+
run: |
24+
sudo apt-get update
25+
sudo apt-get install -y nasm make binutils
26+
27+
- name: Build amd64 binary
28+
run: |
29+
make build-amd64
30+
strip build/mini-init-amd64
31+
32+
- name: Upload amd64 artifact
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: mini-init-amd64-${{ github.sha }}
36+
path: build/mini-init-amd64
37+
if-no-files-found: error
38+
retention-days: 7
39+
40+
build-arm64:
41+
name: Build arm64
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Checkout
45+
uses: actions/checkout@v4
46+
47+
- name: Install cross-compile dependencies
48+
run: |
49+
sudo apt-get update
50+
sudo apt-get install -y nasm make binutils gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
51+
52+
- name: Build arm64 binary
53+
run: |
54+
make build-arm64
55+
aarch64-linux-gnu-strip build/mini-init-arm64
56+
57+
- name: Upload arm64 artifact
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: mini-init-arm64-${{ github.sha }}
61+
path: build/mini-init-arm64
62+
if-no-files-found: error
63+
retention-days: 7
64+
65+
release:
66+
name: Release
67+
needs: [build-amd64, build-arm64]
68+
runs-on: ubuntu-latest
69+
if: startsWith(github.ref, 'refs/tags/v')
70+
permissions:
71+
contents: write
72+
steps:
73+
- name: Download amd64 artifact
74+
uses: actions/download-artifact@v4
75+
with:
76+
name: mini-init-amd64-${{ github.sha }}
77+
path: release
78+
79+
- name: Download arm64 artifact
80+
uses: actions/download-artifact@v4
81+
with:
82+
name: mini-init-arm64-${{ github.sha }}
83+
path: release
84+
85+
- name: Prepare release assets
86+
run: |
87+
cd release
88+
sha256sum mini-init-amd64 > mini-init-amd64.sha256
89+
sha256sum mini-init-arm64 > mini-init-arm64.sha256
90+
cat > RELEASE_NOTES.txt <<EOF
91+
Release: ${GITHUB_REF_NAME}
92+
Commit: ${GITHUB_SHA}
93+
Date: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
94+
95+
Binaries:
96+
- mini-init-amd64 (x86-64 Linux)
97+
- mini-init-arm64 (AArch64/ARM64 Linux)
98+
99+
Usage:
100+
./mini-init-amd64 --version
101+
./mini-init-arm64 --version
102+
EOF
103+
ls -lh .
104+
105+
- name: Create GitHub release
106+
uses: softprops/action-gh-release@v1
107+
with:
108+
body_path: release/RELEASE_NOTES.txt
109+
files: |
110+
release/mini-init-amd64
111+
release/mini-init-amd64.sha256
112+
release/mini-init-arm64
113+
release/mini-init-arm64.sha256

.gitignore

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Prerequisites
2+
*.d
3+
4+
# Object files
5+
*.o
6+
*.ko
7+
*.obj
8+
*.elf
9+
10+
# Linker output
11+
*.ilk
12+
*.map
13+
*.exp
14+
15+
# Precompiled Headers
16+
*.gch
17+
*.pch
18+
19+
# Libraries
20+
*.lib
21+
*.a
22+
*.la
23+
*.lo
24+
25+
# Shared objects (inc. Windows DLLs)
26+
*.dll
27+
*.so
28+
*.so.*
29+
*.dylib
30+
31+
# Executables
32+
*.exe
33+
*.out
34+
*.app
35+
*.i*86
36+
*.x86_64
37+
*.hex
38+
39+
# Debug files
40+
*.dSYM/
41+
*.su
42+
*.idb
43+
*.pdb
44+
45+
# Kernel Module Compile Results
46+
*.mod*
47+
*.cmd
48+
.tmp_versions/
49+
build/
50+
modules.order
51+
Module.symvers
52+
Mkfile.old
53+
dkms.conf
54+
55+
# debug information files
56+
*.dwo

.gitlab-ci.yml

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
default:
2+
image: debian:13-slim
3+
before_script:
4+
- apt-get update
5+
- apt-get install -y --no-install-recommends nasm make binutils bash ca-certificates
6+
- update-ca-certificates
7+
timeout: 20 minutes
8+
tags:
9+
- docker
10+
- dev
11+
12+
stages:
13+
- build
14+
- test
15+
- release
16+
17+
build:amd64:
18+
stage: build
19+
script:
20+
- make
21+
- strip build/mini-init-amd64
22+
artifacts:
23+
name: "mini-init-amd64-$CI_COMMIT_SHORT_SHA"
24+
paths:
25+
- build/mini-init-amd64
26+
expire_in: 1 week
27+
rules:
28+
- if: $CI_COMMIT_TAG
29+
- if: $CI_PIPELINE_SOURCE == "web"
30+
when: manual
31+
32+
build:arm64:
33+
stage: build
34+
before_script:
35+
- apt-get update
36+
- apt-get install -y --no-install-recommends nasm make binutils bash ca-certificates gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
37+
- update-ca-certificates
38+
script:
39+
- make build-arm64
40+
- aarch64-linux-gnu-strip build/mini-init-arm64
41+
- aarch64-linux-gnu-strip build/arm64/helper-exit42 || true
42+
- aarch64-linux-gnu-strip build/arm64/helper-sleeper || true
43+
artifacts:
44+
name: "mini-init-arm64-$CI_COMMIT_SHORT_SHA"
45+
paths:
46+
- build/mini-init-arm64
47+
- build/arm64/helper-exit42
48+
- build/arm64/helper-sleeper
49+
expire_in: 1 week
50+
rules:
51+
- if: $CI_COMMIT_TAG
52+
- if: $CI_PIPELINE_SOURCE == "web"
53+
when: manual
54+
55+
test:e2e:
56+
stage: test
57+
needs: ["build:amd64"]
58+
script:
59+
- bash scripts/test_harness.sh build/mini-init-amd64
60+
rules:
61+
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
62+
when: manual
63+
- if: $CI_PIPELINE_SOURCE == "web"
64+
when: manual
65+
- if: $CI_COMMIT_TAG
66+
- when: never
67+
68+
test:ep_signals:
69+
stage: test
70+
needs: ["build:amd64"]
71+
script:
72+
- chmod +x scripts/test_ep_signals.sh
73+
- bash scripts/test_ep_signals.sh build/mini-init-amd64
74+
rules:
75+
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
76+
when: manual
77+
- if: $CI_PIPELINE_SOURCE == "web"
78+
when: manual
79+
- if: $CI_COMMIT_TAG
80+
- when: never
81+
82+
test:edge_cases:
83+
stage: test
84+
needs: ["build:amd64"]
85+
script:
86+
- chmod +x scripts/test_edge_cases.sh
87+
- bash scripts/test_edge_cases.sh build/mini-init-amd64
88+
rules:
89+
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
90+
when: manual
91+
- if: $CI_PIPELINE_SOURCE == "web"
92+
when: manual
93+
- if: $CI_COMMIT_TAG
94+
- when: never
95+
96+
test:exit_code_mapping:
97+
stage: test
98+
needs: ["build:amd64"]
99+
script:
100+
- chmod +x scripts/test_exit_code_mapping.sh
101+
- bash scripts/test_exit_code_mapping.sh build/mini-init-amd64
102+
rules:
103+
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
104+
when: manual
105+
- if: $CI_PIPELINE_SOURCE == "web"
106+
when: manual
107+
- if: $CI_COMMIT_TAG
108+
- when: never
109+
110+
test:restart:
111+
stage: test
112+
needs: ["build:amd64"]
113+
script:
114+
- chmod +x scripts/test_restart.sh
115+
- bash scripts/test_restart.sh build/mini-init-amd64
116+
rules:
117+
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
118+
when: manual
119+
- if: $CI_PIPELINE_SOURCE == "web"
120+
when: manual
121+
- if: $CI_COMMIT_TAG
122+
- when: never
123+
124+
test:arm64:
125+
stage: test
126+
needs: ["build:arm64"]
127+
before_script:
128+
- apt-get update
129+
- apt-get install -y --no-install-recommends qemu-user-static file
130+
script:
131+
- chmod +x scripts/test_harness_arm64.sh
132+
- ARM64_FALLBACK=${ARM64_FALLBACK:-1} EP_ARM64_FALLBACK=${EP_ARM64_FALLBACK:-1} bash scripts/test_harness_arm64.sh build/mini-init-arm64
133+
allow_failure: true
134+
rules:
135+
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"
136+
when: manual
137+
- if: $CI_PIPELINE_SOURCE == "web"
138+
when: manual
139+
- if: $CI_COMMIT_TAG
140+
- when: never
141+
142+
release:
143+
stage: release
144+
needs:
145+
- build:amd64
146+
- build:arm64
147+
- test:e2e
148+
- test:ep_signals
149+
- test:edge_cases
150+
- test:exit_code_mapping
151+
- test:restart
152+
#- test:arm64
153+
script:
154+
- |
155+
echo "Creating release for tag $CI_COMMIT_TAG"
156+
mkdir -p release
157+
cp build/mini-init-amd64 release/mini-init-amd64
158+
cp build/mini-init-arm64 release/mini-init-arm64
159+
# Create checksums
160+
sha256sum release/mini-init-amd64 > release/mini-init-amd64.sha256
161+
sha256sum release/mini-init-arm64 > release/mini-init-arm64.sha256
162+
# Create a simple release notes file
163+
cat > release/RELEASE_NOTES.txt <<EOF
164+
Release: $CI_COMMIT_TAG
165+
Commit: $CI_COMMIT_SHA
166+
Date: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
167+
168+
Binaries:
169+
- mini-init-amd64 (x86-64 Linux)
170+
- mini-init-arm64 (AArch64/ARM64 Linux)
171+
172+
Usage:
173+
./mini-init-amd64 --version
174+
./mini-init-arm64 --version
175+
EOF
176+
cat release/RELEASE_NOTES.txt
177+
ls -lh release/
178+
artifacts:
179+
name: "mini-init-$CI_COMMIT_TAG"
180+
paths:
181+
- release/
182+
expire_in: never
183+
rules:
184+
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 roots666
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)