Skip to content

Commit

Permalink
#5 - refactoring to support go get command
Browse files Browse the repository at this point in the history
  • Loading branch information
parvit committed Jan 20, 2025
1 parent 63c7c0b commit f46db05
Show file tree
Hide file tree
Showing 477 changed files with 125,542 additions and 1,315 deletions.
84 changes: 69 additions & 15 deletions .github/workflows/update-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ run-name: Update Dependencies [${{ github.event_name }}][${{ github.head_ref ||

jobs:
build-mac-os:
if: ${{ !inputs.skip_macos }}
runs-on: macos-latest
env:
GO_VERSION: 1.20.14
Expand All @@ -17,7 +16,6 @@ jobs:
CGO_ENABLED: 1
GOPATH: ${{ github.workspace }}/.go
CMAKE_BUILD_PARALLEL_LEVEL: 4
IGNORE_PACKAGES: 'tray|docker|docs|version|webgui|workers$'
defaults:
run:
shell: bash
Expand All @@ -42,25 +40,27 @@ jobs:
run: |
go clean -cache -x
- name: Build Backends
run: |
cd backend/
go generate
- name: Build
run: |
export CPP=${CXX}
export PATH=$GOPATH/bin:$GOPATH/bin/${GOOS}_${GOARCH}:$PATH
go generate
- name: Remove unnecessary files
run: |
pushd internal/darwin/arm64/bindings/
rm -rf bin/
rm -rf share/
rm -rf ssl/
popd
- uses: actions/upload-artifact@v4
if: success()
if: always()
with:
name: gen_windows_b${{ github.run_id }}
name: gen_darwin_${{ github.sha }}
path: internal/darwin/arm64/*

build-linux:
if: ${{ !inputs.skip_linux }}
runs-on: ubuntu-latest
env:
GO_VERSION: 1.20.14
Expand All @@ -69,7 +69,6 @@ jobs:
GOOS: linux
CGO_ENABLED: 1
CMAKE_BUILD_PARALLEL_LEVEL: 4
IGNORE_PACKAGES: 'tray|docker|docs|version|webgui|workers$'
defaults:
run:
shell: bash
Expand Down Expand Up @@ -98,10 +97,18 @@ jobs:
run: |
go generate
- name: Remove unnecessary files
run: |
pushd internal/linux/amd64/bindings/
rm -rf bin/
rm -rf share/
rm -rf ssl/
popd
- uses: actions/upload-artifact@v4
if: success()
if: always()
with:
name: gen_windows_b${{ github.run_id }}
name: gen_linux_${{ github.sha }}
path: internal/linux/amd64/*

build-windows:
Expand Down Expand Up @@ -151,8 +158,55 @@ jobs:
run: |
go generate
- name: Remove unnecessary files
run: |
cd internal/windows/amd64/bindings/
rd /q /s bin
rd /q /s share
rd /q /s ssl
- uses: actions/upload-artifact@v4
if: success()
if: always()
with:
name: gen_windows_b${{ github.run_id }}
name: gen_windows_${{ github.sha }}
path: internal/windows/amd64/*

update:
needs: [ build-windows, build-linux, build-mac-os ]
runs-on: ubuntu-latest
defaults:
run:
shell: bash

steps:
- uses: actions/checkout@v4
with:
clean: true
submodules: true

- name: Download Windows Artifact
uses: actions/download-artifact@v4
with:
name: gen_windows_${{ github.sha }}
path: internal/windows/amd64/

- name: Download Linux Artifact
uses: actions/download-artifact@v4
with:
name: gen_linux_${{ github.sha }}
path: internal/linux/amd64/

- name: Download MacOS Artifact
uses: actions/download-artifact@v4
with:
name: gen_darwin_${{ github.sha }}
path: internal/darwin/arm64/

- uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: Update dependencies
add: |
- internal/windows/amd64/bindings/*
- internal/linux/amd64/bindings/*
- internal/darwin/arm64/bindings/*
14 changes: 12 additions & 2 deletions deps_build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ echo.
set BASEDIR=%~dp0
echo %BASEDIR%

go env GOOS > tmpfile
set /p GOOS= < tmpfile

go env GOARCH > tmpfile
set /p GOARCH= < tmpfile
del tmpfile

echo [%GOOS%]
echo [%GOARCH%]

set /A BUILD="Release"

if "%1" EQU "--quic" (
Expand Down Expand Up @@ -57,7 +67,7 @@ mkdir gen_quicly

echo [Build OpenSSL]
pushd gen_openssl
cmake ../deps/openssl -G"MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=%BASEDIR%/internal/deps -DCMAKE_BUILD_TYPE=%BUILD%
cmake ../deps/openssl -G"MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=%BASEDIR%/internal/%GOOS%/%GOARCH%/bindings -DCMAKE_BUILD_TYPE=%BUILD%
if %ERRORLEVEL% NEQ 0 goto fail

cmake --build .
Expand All @@ -70,7 +80,7 @@ popd
:quic
echo [Build Quicly]
pushd gen_quicly
cmake ../deps/quicly -G"MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=%BASEDIR%/internal/deps -DOPENSSL_ROOT_DIR=%BASEDIR%/internal/deps/include ^
cmake ../deps/quicly -G"MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=%BASEDIR%/internal/%GOOS%/%GOARCH%/bindings -DOPENSSL_ROOT_DIR=%BASEDIR%/%GOOS%/%GOARCH%/bindings/include ^
-DCMAKE_BUILD_TYPE=%BUILD% -DWITH_EXAMPLE=OFF -DCMAKE_VERBOSE_MAKEFILE=ON
if %ERRORLEVEL% NEQ 0 goto fail

Expand Down
7 changes: 5 additions & 2 deletions deps_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function prepare() {
function build_openssl() {
echo [Build OpenSSL]
pushd gen_openssl
cmake ../deps/openssl -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$BASEDIR/internal/deps -DCMAKE_BUILD_TYPE=$BUILD
cmake ../deps/openssl -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$BASEDIR/internal/$GOOS/$GOARCH/bindings -DCMAKE_BUILD_TYPE=$BUILD
assert_errorcode

cmake --build .
Expand All @@ -59,7 +59,7 @@ function build_openssl() {
function build_quicly() {
echo [Build Quicly]
pushd gen_quicly
cmake ../deps/quicly -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$BASEDIR/internal/deps -DOPENSSL_ROOT_DIR=$BASEDIR/internal/deps/include \
cmake ../deps/quicly -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$BASEDIR/internal/$GOOS/$GOARCH/bindings -DOPENSSL_ROOT_DIR=$BASEDIR/internal/$GOOS/$GOARCH/bindings/include \
-DCMAKE_BUILD_TYPE=$BUILD -DWITH_EXAMPLE=OFF
assert_errorcode

Expand Down Expand Up @@ -109,6 +109,9 @@ fi
prerequisites_check
assert_errorcode

GOOS=$(go env GOOS)
GOARCH=$(go env GOARCH)

prepare
assert_errorcode

Expand Down
14 changes: 9 additions & 5 deletions genspec/bindings.darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@ GENERATOR:
ConstCharIsString: true
FlagGroups:
- { name: LDFLAGS, flags: [
"<basedir>/internal/deps/lib/libquicly.a",
"<basedir>/internal/deps/lib/libcrypto.a",
"<basedir>/internal/deps/lib/libssl.a",
"-Llib/",
"-lquicly",
"-lcrypto",
"-lssl",
"-lm",
"-ldl" ] }
- { name: CPPFLAGS, flags: [
"-DDARWIN",
"-D__APPLE__",
"-D__MACH__",
"-I<basedir>/internal/deps/include/",
"-I../../../",
"-Iinclude/",
"-Iinclude/quicly/",
"-Wno-format"
] }

Expand All @@ -27,7 +30,8 @@ PARSER:
__APPLE__: 1
__MACH__: 1
IncludePaths: [
"<basedir>/internal/deps/include/"
"internal/",
"internal/darwin/arm64/bindings/include/",
]
SourcesPaths: [
"quicly.h",
Expand Down
15 changes: 10 additions & 5 deletions genspec/bindings.linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,27 @@ GENERATOR:
ConstCharIsString: true
FlagGroups:
- { name: LDFLAGS, flags: [
"<basedir>/internal/deps/lib/libquicly.a",
"<basedir>/internal/deps/lib/libcrypto.a",
"<basedir>/internal/deps/lib/libssl.a",
"-Llib/",
"-l:libquicly.a",
"-l:libcrypto.a",
"-l:libssl.a",
"-lm",
"-ldl" ] }
- { name: CPPFLAGS, flags: [
"-DUNIX",
"-I<basedir>/internal/deps/include/",
"-I../../../",
"-Iinclude/",
"-Iinclude/quicly/",
"-Wno-format"
] }

PARSER:
Defines:
UNIX: 1
IncludePaths: [
"<basedir>/internal/deps/include/" ]
"internal/",
"internal/linux/amd64/bindings/include/",
]
SourcesPaths: [
"quicly.h",
"quicly_wrapper.h",
Expand Down
15 changes: 10 additions & 5 deletions genspec/bindings.windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ GENERATOR:
ConstCharIsString: true
FlagGroups:
- { name: LDFLAGS, flags: [
"<basedir>/internal/deps/lib/libquicly.a",
"<basedir>/internal/deps/lib/libcrypto.a",
"<basedir>/internal/deps/lib/libssl.a",
"-Llib/",
"-l:libquicly.a",
"-l:libcrypto.a",
"-l:libssl.a",
"-lm",
"-lmswsock",
"-lws2_32" ] }
- { name: CPPFLAGS, flags: [
"-DWIN32",
"-I<basedir>/internal/deps/include/",
"-I../../../",
"-Iinclude/",
"-Iinclude/quicly/",
"-Wno-format"
] }

Expand All @@ -27,7 +30,9 @@ PARSER:
_WINDOWS: 1
WIN32_LEAN_AND_MEAN: 1
IncludePaths: [
"<basedir>/internal/deps/include/" ]
"internal/",
"internal/windows/amd64/bindings/include/",
]
SourcesPaths: [
"quicly.h",
"quicly_wrapper.h",
Expand Down
7 changes: 5 additions & 2 deletions genspec/errors.darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ GENERATOR:
"-DDARWIN",
"-D__APPLE__",
"-D__MACH__",
"-I<basedir>/internal/deps/include/"
"-Iinternal/",
"-Iinternal/darwin/arm64/bindings/include/",
] }

PARSER:
Expand All @@ -17,10 +18,12 @@ PARSER:
__APPLE__: 1
__MACH__: 1
IncludePaths: [
"<basedir>/internal/deps/include/"
"internal/",
"internal/darwin/arm64/bindings/include/",
]
SourcesPaths: [
"quicly_wrapper.h",
"quicly/constants.h"
]

TRANSLATOR:
Expand Down
8 changes: 6 additions & 2 deletions genspec/errors.linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@ GENERATOR:
Includes: [ "quicly_wrapper.h" ]
FlagGroups:
- { name: CPPFLAGS, flags: [
"-I<basedir>/internal/deps/include/"
"-Iinternal/",
"-Iinternal/linux/amd64/bindings/include/",
] }

PARSER:
Defines:
UNIX: 1
IncludePaths: [
"<basedir>/internal/deps/include/" ]
"internal/",
"internal/linux/amd64/bindings/include/",
]
SourcesPaths: [
"quicly_wrapper.h",
"quicly/constants.h"
]

TRANSLATOR:
Expand Down
8 changes: 6 additions & 2 deletions genspec/errors.windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ GENERATOR:
Includes: [ "quicly_wrapper.h" ]
FlagGroups:
- { name: CPPFLAGS, flags: [
"-I<basedir>/internal/deps/include/"
"-Iinternal/",
"-Iinternal/windows/amd64/bindings/include/",
] }

PARSER:
Expand All @@ -15,9 +16,12 @@ PARSER:
_WINDOWS: 1
WIN32_LEAN_AND_MEAN: 1
IncludePaths: [
"<basedir>/internal/deps/include/" ]
"internal/",
"internal/windows/amd64/bindings/include/",
]
SourcesPaths: [
"quicly_wrapper.h",
"quicly/constants.h"
]

TRANSLATOR:
Expand Down
Loading

0 comments on commit f46db05

Please sign in to comment.