Skip to content

Commit 8440bb4

Browse files
committed
Use Rubisco to manage the project.
1 parent ef55887 commit 8440bb4

File tree

4 files changed

+98
-97
lines changed

4 files changed

+98
-97
lines changed

.github/workflows/build.yml

Lines changed: 14 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -6,124 +6,42 @@ on:
66

77
jobs:
88

9-
build-dist:
9+
build:
1010

1111
runs-on: ubuntu-latest
1212

1313
steps:
1414

1515
#--------------------------------------------collect--------------------------------------------
16-
- uses: actions/checkout@v3
17-
18-
- name: 🏷️ Get infomations
19-
run: |
20-
tag="${GITHUB_REF#refs/tags/}"
21-
echo "tag=$tag" >> $GITHUB_ENV
22-
echo "pkgname=cppp-platform-$tag" >> $GITHUB_ENV
23-
echo "srcdir=$(pwd)" >> $GITHUB_ENV
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.13"
2421

2522
- name: 📁 Collect dependencies
2623
run: |
2724
sudo apt-get update
2825
sudo apt-get install p7zip-full zip xz-utils -y
2926
sudo apt-get install cmake gcc python3 -y
30-
31-
#--------------------------------------------build--------------------------------------------
32-
- name: 🧳 Prepare for source distribution building
33-
run: |
34-
mkdir -p ./dist
35-
./setup.sh
36-
37-
- name: 🛠️ Build source distribution
38-
run: |
39-
./cpppdist.py
40-
41-
- name: 📦 Make packages
42-
run: |
43-
tar cvf ${{ env.pkgname }}.tar ${{ env.pkgname }}
44-
zip -r -9 dist/${{ env.pkgname }}.zip ${{ env.pkgname }}
45-
7z a dist/${{ env.pkgname }}.7z ${{ env.pkgname }}
46-
xz -c -9 -k ${{ env.pkgname }}.tar > dist/${{ env.pkgname }}.tar.xz
47-
gzip -c -9 -k ${{ env.pkgname }}.tar > dist/${{ env.pkgname }}.tar.gz
48-
49-
cd dist
50-
for i in $(ls) ; do md5sum $i > $i.md5 ; done
51-
cd ..
52-
53-
#--------------------------------------------publish--------------------------------------------
54-
55-
- name: ⬆️ Create release and upload assets
56-
uses: softprops/action-gh-release@v1
57-
with:
58-
tag_name: ${{ env.tag }}
59-
files: ./dist/*
27+
python -m pip install --upgrade pip
28+
python -m pip install rubisco
6029
61-
build:
62-
63-
needs: build-dist
64-
65-
strategy:
66-
fail-fast: false
67-
matrix:
68-
arch: [
69-
any-any-any
70-
]
71-
72-
runs-on: ubuntu-latest
73-
74-
steps:
75-
76-
#--------------------------------------------collect--------------------------------------------
77-
- name: 🏷️ Get infomations
78-
run: |
79-
tag="${GITHUB_REF#refs/tags/}"
80-
echo "tag=$tag" >> $GITHUB_ENV
81-
echo "pkgname=cppp-platform-$tag" >> $GITHUB_ENV
82-
echo "srcdir=$(pwd)" >> $GITHUB_ENV
83-
84-
- name: 📁 Collect dependencies
85-
run: |
86-
sudo apt-get update
87-
sudo apt-get install p7zip-full zip xz-utils wget -y
88-
sudo apt-get install cmake -y
89-
sudo apt-get install gcc g++ -y
90-
91-
- name: 📁 Get source distribution tarball
92-
run: |
93-
wget https://github.com/${{ github.repository }}/releases/download/${{ env.tag }}/${{ env.pkgname }}.tar.gz
94-
tar zxvf ${{ env.pkgname }}.tar.gz
95-
mv ${{ env.pkgname }}/* .
96-
9730
#--------------------------------------------build--------------------------------------------
98-
- name: 🧳 Prepare for binary distribution building
31+
- name: 🛠️ Build distribution
9932
run: |
100-
mkdir -p dist
101-
102-
- name: 🛠️ Build binary distribution
103-
run: |
104-
mkdir build
105-
cd build
106-
cmake .. -DCMAKE_INSTALL_PREFIX=${{ env.srcdir }}/${{ env.pkgname }}-${{ matrix.arch }}
107-
cmake --build . --config=Release
108-
cmake --install .
109-
cd ..
33+
rubisco build
11034
11135
- name: 📦 Make packages
11236
run: |
113-
tar cvf ${{ env.pkgname }}-${{ matrix.arch }}.tar ${{ env.pkgname }}-${{ matrix.arch }}
114-
zip -r -9 dist/${{ env.pkgname }}-${{ matrix.arch }}.zip ${{ env.pkgname }}-${{ matrix.arch }}
115-
7z a dist/${{ env.pkgname }}-${{ matrix.arch }}.7z ${{ env.pkgname }}-${{ matrix.arch }}
116-
xz -c -9 -k ${{ env.pkgname }}-${{ matrix.arch }}.tar > dist/${{ env.pkgname }}-${{ matrix.arch }}.tar.xz
117-
gzip -c -9 -k ${{ env.pkgname }}-${{ matrix.arch }}.tar > dist/${{ env.pkgname }}-${{ matrix.arch }}.tar.gz
118-
11937
cd dist
120-
for i in $(ls) ; do md5sum $i > $i.md5 ; done
38+
for i in $(ls) ; do sha256sum $i > $i.sha256 ; done
12139
cd ..
12240
12341
#--------------------------------------------publish--------------------------------------------
12442

12543
- name: ⬆️ Create release and upload assets
126-
uses: softprops/action-gh-release@v1
44+
uses: softprops/action-gh-release@v2
45+
if: startsWith(github.ref, 'refs/tags/')
12746
with:
128-
tag_name: ${{ env.tag }}
129-
files: ./dist/*
47+
files: ./dist/*

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# CMake build files
22
build/
3+
dist/
4+
install/
35
CMakeFiles
46
*.so
57
*.so.*.*.*
@@ -34,5 +36,5 @@ Testing
3436
.cache
3537

3638
# Dist directory and temps
37-
cppp-platform-v*
39+
cppp-platform-*
3840
__pycache__

.rubisco/build.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: 🛠️ Build cppp-platfrom
2+
3+
steps:
4+
- name: 📦 Make source distribution directory
5+
mkdir: ${{ project.name }}-${{ project.version }}
6+
- mkdir: dist
7+
8+
- name: 📦 Copy files to source distribution directory
9+
copy: ${{ cwd }}
10+
to: ${{ project.name }}-${{ project.version }}
11+
excludes:
12+
[
13+
".git*",
14+
"build",
15+
"dist",
16+
"*.7z",
17+
"*.gz",
18+
"*.xz",
19+
"*.zip",
20+
".vscode",
21+
".rubisco/extensions",
22+
"${{ project.name }}-*",
23+
]
24+
25+
- name: 📦 Packing the source distribution
26+
compress: ${{ project.name }}-${{ project.version }}
27+
to: dist/${{ project.name }}-${{ project.version }}
28+
format: [zip, tar.xz]
29+
30+
- name: 🛠️ Build the project.
31+
mkdir: build
32+
- cwd: build
33+
run: ["cmake", "..", "-DCMAKE_BUILD_TYPE=Release", "-DCMAKE_INSTALL_PREFIX=install"]
34+
- cwd: build
35+
run: ["cmake", "--build", ".", "--config", "Release"]
36+
- cwd: build
37+
run: ["cmake", "--install", ".", "--config", "Release"]
38+
39+
- name: 📦 Packing the binary distribution.
40+
compress: build/install
41+
start: build
42+
to: dist/${{ project.name }}-${{ project.version }}-unknown-unknown-unknown
43+
format: [zip, tar.xz]

repo.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "cppp-platform",
3+
"version": "1.4.0",
4+
"description": "C+++ portable platform check library.",
5+
"maintainer": "ChenPi11 <wushengwuxi-msctinoulk@outlook.com>",
6+
"license": "Unlicense",
7+
"hooks": {
8+
"build": {
9+
"run": ".rubisco/build.yaml"
10+
},
11+
"format": {
12+
"exec": "python -m ruff format rubisco"
13+
},
14+
"test": {
15+
"run": ".rubisco/test.yaml"
16+
},
17+
"clean": {
18+
"workflow": [
19+
{
20+
"name": "Clean workflow",
21+
"remove": [
22+
"build",
23+
"dist",
24+
"*/**/__pycache__",
25+
".rubisco/*.log",
26+
"*.7z",
27+
"*.gz",
28+
"*.xz",
29+
"*.zip",
30+
"rubisco-*"
31+
],
32+
"strict": false
33+
}
34+
]
35+
}
36+
}
37+
}
38+

0 commit comments

Comments
 (0)