Skip to content

[feature] block blacklisted domains by TLS SNI, keep address backstop… #1938

[feature] block blacklisted domains by TLS SNI, keep address backstop…

[feature] block blacklisted domains by TLS SNI, keep address backstop… #1938

Workflow file for this run

name: Build and Test
on:
push:
branches:
- '**'
tags:
- '*'
release:
types: [ published ]
env:
DOCKER_REGISTRY: fptnvpn
IMAGE_NAME: fptn-vpn-server
jobs:
build_ubuntu_x86_64:
runs-on: Ubuntu_x86_64
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Set env
if: github.event_name == 'release'
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "FPTN_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Print Release Version
if: github.event_name == 'release'
run: |
echo "Release Version: $RELEASE_VERSION"
- name: Set dev version
if: github.event_name != 'release'
run: |
TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0")
DEV_VERSION="$TAG-dev-$(date -u +%Y%m%d-%H%M%S)"
echo "FPTN_VERSION=$DEV_VERSION" >> $GITHUB_ENV
echo "Dev version: $DEV_VERSION"
- name: Install dependencies
run: |
conan install . --output-folder=build --build=missing -o with_gui_client=True --settings build_type=Release -s compiler.cppstd=17 -c "tools.build:defines=['QT_NO_INT128']"
- name: Run cpplint
run: |
python3 cpplint.py --recursive --filter=-build/c++17,-whitespace/newline,-readability/braces --counting=total ./src/ ./tests/
- name: Run cppcheck
run: |
cppcheck --force --error-exitcode=1 --enable=all --check-level=exhaustive --language=c++ --suppress=unusedFunction --inline-suppr --suppress=missingIncludeSystem --suppress=unknownMacro --suppress=unmatchedSuppression -I ./src/fptn-client/ -I ./src/fptn-server/ -I ./src/fptn-passwd/ -I ./src/fptn-client-protocol-lib -I ./src/ ./src/ ./tests/
- name: Run cmake-format
run: |
cmake-format -i CMakeLists.txt src/fptn-client/CMakeLists.txt src/fptn-passwd/CMakeLists.txt src/fptn-server/CMakeLists.txt src/fptn-protocol-lib/CMakeLists.txt depends/cmake/FetchBase64.cmake depends/cmake/FetchLibTunTap.cmake depends/cmake/FetchWintun.cmake
- name: Build
run: |
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
cmake --build .
- name: Test
run: |
cd build
ctest -C Release
- name: Build Debian package
run: |
cd build
cmake --build . --target build-deb
cmake --build . --target build-deb-gui
- name: Upload deb RELEASE
if: github.event_name == 'release'
uses: AButler/upload-release-assets@v3.0
with:
files: "fptn-*.deb"
repo-token: ${{ secrets.CI_TOKEN }}
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: Ubuntu86_64Artifacts
path: |
*.deb
if-no-files-found: warn
- name: Build and Push Docker Image (amd64)
if: github.event_name == 'release'
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
docker buildx create --name amd64-builder --platform linux/amd64 --use || true
docker buildx build \
--platform linux/amd64 \
-f ./deploy/docker/Dockerfile \
-t "$DOCKER_REGISTRY/$IMAGE_NAME:$RELEASE_VERSION-amd64" \
--build-arg FPTN_SERVER_PATH=build/src/fptn-server/fptn-server \
--build-arg FPTN_PASSWD_PATH=build/src/fptn-passwd/fptn-passwd \
--push \
--provenance=false \
--sbom=false .
build_ubuntu_arm64:
runs-on: Ubuntu_ARM64_Desktop
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Set env
if: github.event_name == 'release'
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "FPTN_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Print Release Version
if: github.event_name == 'release'
run: |
echo "Release Version: $RELEASE_VERSION"
- name: Set dev version
if: github.event_name != 'release'
run: |
TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0")
DEV_VERSION="$TAG-dev-$(date -u +%Y%m%d-%H%M%S)"
echo "FPTN_VERSION=$DEV_VERSION" >> $GITHUB_ENV
echo "Dev version: $DEV_VERSION"
- name: Install dependencies
run: |
conan install . --output-folder=build --build=missing -o with_gui_client=True --settings build_type=Release -s compiler.cppstd=17 -c "tools.build:defines=['QT_NO_INT128']"
- name: Run cpplint
run: |
python3 cpplint.py --recursive --filter=-build/c++17,-whitespace/newline,-readability/braces --counting=total ./src/ ./tests/
- name: Run cppcheck
run: |
cppcheck --force --error-exitcode=1 --enable=all --check-level=exhaustive --language=c++ --suppress=unusedFunction --inline-suppr --suppress=missingIncludeSystem --suppress=unmatchedSuppression -I ./src/fptn-client/ -I ./src/fptn-server/ -I ./src/fptn-passwd/ -I ./src/fptn-client-protocol-lib -I ./src/ ./src/ ./tests/
- name: Run cmake-format
run: |
cmake-format -i CMakeLists.txt src/fptn-client/CMakeLists.txt src/fptn-passwd/CMakeLists.txt src/fptn-server/CMakeLists.txt src/fptn-protocol-lib/CMakeLists.txt depends/cmake/FetchBase64.cmake depends/cmake/FetchLibTunTap.cmake depends/cmake/FetchWintun.cmake
- name: Build
run: |
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
cmake --build .
- name: Test
run: |
cd build
ctest -C Release
- name: Build Debian package
run: |
cd build
cmake --build . --target build-deb
cmake --build . --target build-deb-gui
- name: Upload deb
if: github.event_name == 'release'
uses: AButler/upload-release-assets@v3.0
with:
files: "fptn-*.deb"
repo-token: ${{ secrets.CI_TOKEN }}
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: UbuntuArmArtifacts
path: |
*.deb
if-no-files-found: warn
- name: Build and Push Docker Image (arm64)
if: github.event_name == 'release'
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
docker buildx create --name arm64-builder --platform linux/arm64 --use || true
docker buildx build \
--platform linux/arm64 \
-f ./deploy/docker/Dockerfile \
-t "$DOCKER_REGISTRY/$IMAGE_NAME:$RELEASE_VERSION-arm64" \
--build-arg FPTN_SERVER_PATH=build/src/fptn-server/fptn-server \
--build-arg FPTN_PASSWD_PATH=build/src/fptn-passwd/fptn-passwd \
--push \
--provenance=false \
--sbom=false .
build_macos_arm64:
runs-on: MacOS_ARM64
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Set env
if: github.event_name == 'release'
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "FPTN_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Print Release Version
if: github.event_name == 'release'
run: |
echo "Release Version: $RELEASE_VERSION"
- name: Set dev version
if: github.event_name != 'release'
run: |
TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0")
DEV_VERSION="$TAG-dev-$(date -u +%Y%m%d-%H%M%S)"
echo "FPTN_VERSION=$DEV_VERSION" >> $GITHUB_ENV
echo "Dev version: $DEV_VERSION"
- name: Install dependencies
run: |
conan install . --output-folder=build --build=missing -o with_gui_client=True --settings build_type=Release -s compiler.cppstd=17
- name: Run cpplint
run: |
python3 cpplint.py --recursive --filter=-build/c++17,-whitespace/newline,-readability/braces --counting=total ./src/ ./tests/
- name: Run cppcheck
run: |
cppcheck --force --error-exitcode=1 --enable=all --check-level=exhaustive --language=c++ --suppress=unusedFunction --inline-suppr --suppress=missingIncludeSystem --suppress=unknownMacro --suppress=unmatchedSuppression -I ./src/fptn-client/ -I ./src/fptn-server/ -I ./src/fptn-passwd/ -I ./src/fptn-client-protocol-lib -I ./src/ ./src/ ./tests/
- name: Run cmake-format
run: |
cmake-format -i CMakeLists.txt src/fptn-client/CMakeLists.txt src/fptn-passwd/CMakeLists.txt src/fptn-server/CMakeLists.txt src/fptn-protocol-lib/CMakeLists.txt depends/cmake/FetchBase64.cmake depends/cmake/FetchLibTunTap.cmake depends/cmake/FetchWintun.cmake
- name: Build
run: |
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
cmake --build .
- name: Test
run: |
cd build
ctest -C Release
- name: Build MacOS pkg
run: |
cd build
cmake --build . --target build-pkg
- name: Upload macOS pkg
if: github.event_name == 'release'
uses: AButler/upload-release-assets@v3.0
with:
files: "*.pkg"
repo-token: ${{ secrets.CI_TOKEN }}
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: MacOsAppleSiliconArtifacts
path: |
*.pkg
if-no-files-found: warn
build_windows_AMD64:
runs-on: Windows11_AMD64
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Set env
shell: powershell
if: github.event_name == 'release'
run: |
$releaseVersion = "${{ github.ref_name }}"
echo "RELEASE_VERSION=$releaseVersion" >> $env:GITHUB_ENV
echo "FPTN_VERSION=$releaseVersion" >> $env:GITHUB_ENV
- name: Print Release Version
shell: powershell
if: github.event_name == 'release'
run: |
Write-Output "Release Version: $env:RELEASE_VERSION"
- name: Set dev version
shell: powershell
if: github.event_name != 'release'
run: |
git config --global --add safe.directory "$env:GITHUB_WORKSPACE"
$tag = (git describe --tags --abbrev=0 2>$null)
if (-not $tag) { $tag = "0.0.0" }
$stamp = (Get-Date).ToUniversalTime().ToString("yyyyMMdd-HHmmss")
$devVersion = "$tag-dev-$stamp"
echo "FPTN_VERSION=$devVersion" >> $env:GITHUB_ENV
Write-Output "Dev version: $devVersion"
- name: Install dependencies
shell: powershell
run: |
conan install . --output-folder=build --build=missing -o with_gui_client=True --settings build_type=Release -s compiler.cppstd=17
- name: Run cpplint
run: |
python cpplint.py --recursive --filter=-build/c++17,-whitespace/newline,-readability/braces --counting=total ./src/ ./tests/
- name: Run cppcheck
shell: powershell
run: |
cppcheck --force --error-exitcode=1 --enable=all --check-level=exhaustive --language=c++ --suppress=unusedFunction --inline-suppr --suppress=missingIncludeSystem --suppress=unknownMacro --suppress=unmatchedSuppression -I ./src/fptn-client/ -I ./src/fptn-server/ -I ./src/fptn-passwd/ -I ./src/fptn-client-protocol-lib -I ./src/ ./src/ ./tests/
- name: Run cmake-format
shell: powershell
run: |
cmake-format -i CMakeLists.txt src/fptn-client/CMakeLists.txt src/fptn-passwd/CMakeLists.txt src/fptn-server/CMakeLists.txt src/fptn-protocol-lib/CMakeLists.txt depends/cmake/FetchBase64.cmake depends/cmake/FetchLibTunTap.cmake depends/cmake/FetchWintun.cmake
- name: Build
shell: powershell
run: |
cd build
cmake .. -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
- name: Test
shell: powershell
run: |
cd build
ctest -C Release
- name: Build Windows installer
shell: powershell
run: |
cd build
cmake --build . --config Release --target build-installer
- name: Zip the .exe
shell: powershell
run: |
$exePath = Get-ChildItem -Path "." -Filter "FptnClientInstaller-*-windows-x64_x86.exe" | Select-Object -First 1
Compress-Archive -Path $exePath.FullName -DestinationPath "FptnClientInstaller-$env:RELEASE_VERSION-windows-x64_x86.zip"
- name: Upload Windows installer
if: github.event_name == 'release'
uses: AButler/upload-release-assets@v3.0
with:
files: "*.zip"
repo-token: ${{ secrets.CI_TOKEN }}
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: WindowsArtifacts
path: |
*.zip
if-no-files-found: warn
create_multiarch_manifest:
needs: [build_ubuntu_x86_64, build_ubuntu_arm64]
runs-on: ubuntu-latest
steps:
- name: Get release version
if: github.event_name == 'release'
run: |
RELEASE_VERSION="${GITHUB_REF#refs/*/}"
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
echo "Version: $RELEASE_VERSION"
- name: Login to Docker Hub
if: github.event_name == 'release'
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Create multi-arch manifests
if: github.event_name == 'release'
run: |
docker pull --quiet $DOCKER_REGISTRY/$IMAGE_NAME:$RELEASE_VERSION-amd64
docker pull --quiet $DOCKER_REGISTRY/$IMAGE_NAME:$RELEASE_VERSION-arm64
docker manifest rm $DOCKER_REGISTRY/$IMAGE_NAME:$RELEASE_VERSION 2>/dev/null || true
docker manifest rm $DOCKER_REGISTRY/$IMAGE_NAME:latest 2>/dev/null || true
docker buildx imagetools create \
-t $DOCKER_REGISTRY/$IMAGE_NAME:$RELEASE_VERSION \
$DOCKER_REGISTRY/$IMAGE_NAME:$RELEASE_VERSION-amd64 \
$DOCKER_REGISTRY/$IMAGE_NAME:$RELEASE_VERSION-arm64
docker buildx imagetools create \
-t "$DOCKER_REGISTRY/$IMAGE_NAME":latest \
$DOCKER_REGISTRY/$IMAGE_NAME:$RELEASE_VERSION-amd64 \
$DOCKER_REGISTRY/$IMAGE_NAME:$RELEASE_VERSION-arm64
deploy_website:
if: github.event_name == 'release' || github.ref == 'refs/heads/master'
needs: [build_ubuntu_x86_64, build_ubuntu_arm64, build_macos_arm64, build_windows_AMD64]
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout master
uses: actions/checkout@v3
with:
ref: master
fetch-depth: 0
- name: Set version in docs
run: |
VERSION=$(git tag --sort=-v:refname | head -n1)
if [ -z "$VERSION" ]; then
echo "No tags found"
exit 1
fi
echo "Website version: $VERSION"
sed -i -E "s|(<span id=\"version\">)[^<]*(</span>)|\1${VERSION}\2|" docs/index.html docs/index-ru.html
sed -i -E "s|(const tag_name = ')[^']*(')|\1${VERSION}\2|" docs/index.html docs/index-ru.html
grep -n 'id="version"\|const tag_name' docs/index.html docs/index-ru.html
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload site
uses: actions/upload-pages-artifact@v3
with:
path: docs
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4