Skip to content

Commit 00b3889

Browse files
committed
add ci
1 parent 11f4dd1 commit 00b3889

File tree

2 files changed

+155
-0
lines changed

2 files changed

+155
-0
lines changed

.github/FUNDING.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# These are supported funding model platforms
2+
3+
github: [tihmstar]
4+
patreon: tihmstar
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
otechie: # Replace with a single Otechie username
12+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.github/workflows/main.yml

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
name: Buildrunner
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
strategy:
9+
matrix:
10+
platform: [ubuntu-latest, macos-latest]
11+
runs-on: ${{ matrix.platform }}
12+
env:
13+
BUILDROOT: "buildroot_${{ matrix.platform }}"
14+
GIT_DEPENDENCIES: libgeneral
15+
MAC_DYNAMIC_LIBS: openssl
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
- name: Install pre-dependencies
22+
run: |
23+
if [ "$RUNNER_OS" == "Linux" ]; then
24+
sudo apt-get update
25+
sudo apt-get install -y jq libssl-dev libfuse-dev
26+
27+
elif [ "$RUNNER_OS" == "macOS" ]; then
28+
brew install autoconf automake libtool jq pkg-config
29+
brew install openssl macfuse
30+
31+
cd $(brew --prefix openssl)
32+
sudo mkdir -p /usr/local/lib/pkgconfig/
33+
sudo cp -r lib/pkgconfig/* /usr/local/lib/pkgconfig/
34+
cd $GITHUB_WORKSPACE
35+
36+
else
37+
echo "$RUNNER_OS not supported"
38+
exit 1
39+
fi
40+
shell: bash
41+
- name: download dependencies
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
run: |
45+
get_latest_release() {
46+
url="https://api.github.com/repos/$1/releases/latest"
47+
echo "url: ${url}" >&2
48+
curl --silent --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' "${url}" | # Get latest release from GitHub api
49+
jq .tag_name | # Get tag
50+
tr -d '"' # Strip quotes
51+
}
52+
mkdir depdir
53+
cd depdir
54+
mkdir $BUILDROOT
55+
IFS=',' read -r -a deparray <<< "$GIT_DEPENDENCIES"; for d in ${deparray[@]}; do
56+
dep=$d
57+
if ! echo ${dep} | grep -q '/'; then
58+
dep=${{ github.repository_owner }}/${dep}
59+
fi
60+
echo "Got dependency: ${dep}"
61+
tag=$(get_latest_release ${dep});
62+
echo "Found tag: $tag"
63+
wget "https://github.com/${dep}/releases/download/$tag/$BUILDROOT.zip"
64+
unzip -u "$BUILDROOT.zip"
65+
rm "$BUILDROOT.zip"
66+
done
67+
echo "moving dependencies to /"
68+
sudo cp -r $BUILDROOT/* /
69+
cd ..
70+
rm -rf depdir
71+
- name: prepre buildroot
72+
run: mkdir -p $BUILDROOT
73+
- name: autogen
74+
run: ./autogen.sh --enable-static --disable-shared
75+
- name: make
76+
run: |
77+
if [ "$RUNNER_OS" == "macOS" ]; then
78+
IFS=',' read -r -a deparray <<< "$MAC_DYNAMIC_LIBS"; for d in ${deparray[@]}; do
79+
echo "moving library $d"
80+
cd $(brew --prefix $d)
81+
find . -name "*.dylib" -exec mv {} {}.bak \;
82+
done
83+
cd $GITHUB_WORKSPACE
84+
85+
make -j || make
86+
87+
IFS=',' read -r -a deparray <<< "$MAC_DYNAMIC_LIBS"; for d in ${deparray[@]}; do
88+
echo "restoring library $d"
89+
cd $(brew --prefix $d)
90+
find . -name "*.dylib.bak" | while read f; do o=$(echo $f | rev | cut -d '.' -f2- | rev); mv $f $o; done
91+
done
92+
cd $GITHUB_WORKSPACE
93+
else
94+
make -j || make
95+
fi
96+
- name: make install
97+
run: make DESTDIR=$GITHUB_WORKSPACE/$BUILDROOT install
98+
- uses: actions/upload-artifact@v4
99+
with:
100+
name: ${{ env.BUILDROOT }}
101+
path: ${{ env.BUILDROOT }}
102+
103+
release:
104+
needs: build
105+
runs-on: ubuntu-latest
106+
steps:
107+
- uses: actions/checkout@v4
108+
with:
109+
fetch-depth: 0
110+
- name: Download ubuntu artifact
111+
uses: actions/download-artifact@v4
112+
with:
113+
name: buildroot_ubuntu-latest
114+
path: buildroot_ubuntu-latest
115+
- name: Download macos artifact
116+
uses: actions/download-artifact@v4
117+
with:
118+
name: buildroot_macos-latest
119+
path: buildroot_macos-latest
120+
- name: Set env vars and zip
121+
run: |
122+
echo "BUILD_VERSION_NUM=$(echo "$(git rev-list --count HEAD | tr -d '\n')")" >> $GITHUB_ENV
123+
echo "BUILD_VERSION_SHA=$(echo "$(git rev-parse HEAD | tr -d '\n'])")" >> $GITHUB_ENV
124+
echo "BUILD_VERSION_STR=$(echo "$(git rev-list --count HEAD | tr -d '\n')-$(git rev-parse HEAD | tr -d '\n'])")" >> $GITHUB_ENV
125+
echo "COMMIT_MSG=$(echo "$(git log -1 --pretty=%B)")" >> $GITHUB_ENV
126+
zip -r buildroot_macos-latest.zip buildroot_macos-latest
127+
zip -r buildroot_ubuntu-latest.zip buildroot_ubuntu-latest
128+
- name: Create Release
129+
id: create_release
130+
uses: softprops/action-gh-release@v2
131+
if: github.ref == 'refs/heads/master'
132+
env:
133+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
134+
with:
135+
prerelease: false
136+
draft: false
137+
tag_name: ${{ env.BUILD_VERSION_NUM }}
138+
name: Build ${{ env.BUILD_VERSION_STR }}
139+
body: ${{ env.COMMIT_MSG }}
140+
files: |
141+
buildroot_ubuntu-latest.zip
142+
buildroot_macos-latest.zip

0 commit comments

Comments
 (0)