Skip to content

Commit

Permalink
init project
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Cui <[email protected]>
  • Loading branch information
BlackHole1 committed Oct 15, 2024
1 parent e93ca5b commit de08d7f
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true

[*.{json,yml,yaml}]
indent_style = space
indent_size = 2
65 changes: 65 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
build:
runs-on: macos-latest
steps:
- name: Configure R2 Credentials
run: |
aws configure set aws_access_key_id ${{ secrets.R2_OOMOL_STATIC_S3_AK }}
aws configure set aws_secret_access_key ${{ secrets.R2_OOMOL_STATIC_S3_SK }}
aws configure set region auto
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Set up Goenv
run: |
brew install goenv
- name: Exec
run: |
./main.sh
env:
CODESIGN_IDENTITY: ${{ secrets.MACOS_CODESIGN_IDENTITY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Hash
run: sha256sums ./out/* > sha256.txt

- name: Get Tag Name
shell: bash
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Upload To R2
shell: bash
run: |
aws s3 cp \
--endpoint-url ${{ secrets.R2_OOMOL_STATIC_S3_ENDPOINT }} \
./out \
s3://oomol-static/ovm-resources/libexec/$RELEASE_VERSION \
--recursive --exclude "*" --include "*.tar.gz"
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
./*.tar.gz
./out/*
./sha256.txt
body_path: ./sha256.txt
draft: false
prerelease: false
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.idea
.vscode
out
Thumbs.db
[Dd]esktop.ini
$RECYCLE.BIN/
.DS_Store

gvisor-tap-vsock
krunkit
*.tar.gz
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# ovm-libexec

OVM needs some third-party binary files, but some binary are either unsigned or universal. This project exists to address these issues.
10 changes: 10 additions & 0 deletions krunkit.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.hypervisor</key>
<true/>
<key>com.apple.security.cs.disable-library-validationr</key>
<true/>
</dict>
</plist>
47 changes: 47 additions & 0 deletions main.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#/bin/sh

set -e

export WORK=`pwd`

rm -rf ./out
mkdir -p ./out
export GOARCH=arm64
export GOOS=darwin

# Gvp
echo "Building gvp..."
rm -rf gvisor-tap-vsock
git clone https://github.com/containers/gvisor-tap-vsock.git
cd gvisor-tap-vsock
git checkout v0.7.5
eval "$(goenv init -)"
goenv install 1.22.0 -s
goenv shell 1.22.0
make gvproxy
mv ./bin/gvproxy $WORK/out/gvproxy

# krun
echo "Dwonloading krun..."
cd $WORK
rm -rf ./krunkit
mkdir -p krunkit
cd krunkit
gh release download v0.1.3 -R containers/krunkit --pattern "krunkit-*" --clobber
tar -zxvf krunkit-*.tgz -C ./
mv bin/krunkit $WORK/out/krunkit
mv lib/* $WORK/out/

cd $WORK

# codesign
echo "Signing gvproxy..."
codesign --force --sign $CODESIGN_IDENTITY --timestamp $WORK/out/gvproxy

echo "Signing krunkit..."
codesign --force --sign $CODESIGN_IDENTITY --timestamp --entitlements krunkit.entitlements $WORK/out/krunkit

find $WORK/out -name "*.dylib" -type f -exec sh -c "echo 'Signing {}...'; codesign --force --sign $CODESIGN_IDENTITY --timestamp {}" ';'

# pack
tar -czvf ./libexec-$GOOS-$GOARCH.tar.gz -C ./out/ .

0 comments on commit de08d7f

Please sign in to comment.