-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(version): Bump version to v1.0.3 - Includes performance improve…
…ments and bug fixes
- Loading branch information
Showing
29 changed files
with
948 additions
and
333 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
name: Build and Release | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
|
@@ -16,22 +14,35 @@ on: | |
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- version: "linux-x64" | ||
os: ubuntu-latest | ||
platform: linux-x64 | ||
- version: "linux-arm64" | ||
os: ubuntu-latest | ||
platform: linux-arm64 | ||
- version: "windows-x64" | ||
os: windows-latest | ||
platform: win32-x64 | ||
- version: "windows-arm64" | ||
os: windows-latest | ||
platform: win32-arm64 | ||
- version: "darwin-x64" | ||
os: ubuntu-latest | ||
platform: darwin-x64 | ||
- version: "darwin-arm64" | ||
os: ubuntu-latest | ||
platform: darwin-arm64 | ||
|
||
runs-on: ${{ matrix.os }} | ||
outputs: | ||
version: ${{ steps.get_version.outputs.VERSION }} | ||
platform: ${{ steps.detect_platform.outputs.PLATFORM }} | ||
binary_name: ${{ steps.setup_env.outputs.BINARY_NAME }} | ||
archive_name: ${{ steps.setup_env.outputs.ARCHIVE_NAME }} | ||
strategy: | ||
matrix: | ||
version: | ||
[ | ||
"linux-x64", | ||
"linux-arm64", | ||
"windows-x64", | ||
"darwin-x64", | ||
"darwin-arm64", | ||
] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: oven-sh/[email protected] | ||
|
@@ -40,6 +51,7 @@ jobs: | |
|
||
- name: Detect Platform and Compress Format | ||
id: detect_platform | ||
shell: bash | ||
run: | | ||
PLATFORM="${{ matrix.version }}" | ||
echo "PLATFORM=${PLATFORM}" >> $GITHUB_OUTPUT | ||
|
@@ -52,12 +64,14 @@ jobs: | |
- name: Extract version number | ||
id: get_version | ||
shell: bash | ||
run: | | ||
VERSION=$(jq -r .version < package.json) | ||
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT | ||
- name: Setup Build Environment | ||
id: setup_env | ||
shell: bash | ||
run: | | ||
mkdir -p ${{ runner.temp }}/build/out | ||
mkdir -p ${{ runner.temp }}/build/logs | ||
|
@@ -74,40 +88,54 @@ jobs: | |
bun install --no-install-postinstall || { echo "Failed to install dependencies"; exit 1; } | ||
- name: Compile Code | ||
shell: bash | ||
run: | | ||
bun build --compile --sourcemap --minify --bytecode \ | ||
--target=bun-${{ steps.detect_platform.outputs.PLATFORM }} \ | ||
--target=bun-${{ matrix.platform }} \ | ||
./src/cli.ts \ | ||
--outfile ${{ runner.temp }}/build/out/${{ steps.setup_env.outputs.BINARY_NAME }} | ||
- name: Generate Checksums | ||
- name: Generate Checksums (Linux/macOS) | ||
if: runner.os != 'Windows' | ||
working-directory: ${{ runner.temp }}/build/out | ||
shell: bash | ||
run: | | ||
sha1sum ${{ steps.setup_env.outputs.BINARY_NAME }}* > checksum.txt | ||
- name: Generate Checksums (Windows) | ||
if: runner.os == 'Windows' | ||
working-directory: ${{ runner.temp }}/build/out | ||
shell: pwsh | ||
run: | | ||
Get-FileHash -Algorithm SHA1 ${{ steps.setup_env.outputs.BINARY_NAME }}* | ForEach-Object { "$($_.Hash.ToLower()) $($_.Path.Split('\')[-1])" } | Out-File -Encoding utf8 checksum.txt | ||
- name: Compress artifacts (Linux) | ||
if: startsWith(steps.detect_platform.outputs.PLATFORM, 'linux') | ||
working-directory: ${{ runner.temp }}/build/out | ||
shell: bash | ||
run: | | ||
tar -cJf ${{ steps.setup_env.outputs.ARCHIVE_NAME }} ${{ steps.setup_env.outputs.BINARY_NAME }}* checksum.txt | ||
tar --threads=0 -c -I 'xz -5 -T0' -f ${{ steps.setup_env.outputs.ARCHIVE_NAME }} ${{ steps.setup_env.outputs.BINARY_NAME }}* checksum.txt | ||
rm -f ${{ steps.setup_env.outputs.BINARY_NAME }} | ||
# Keep a copy of checksum.txt for later use | ||
cp checksum.txt ${{ steps.setup_env.outputs.BINARY_NAME }}.checksum.txt | ||
- name: Compress artifacts (macOS/Windows) | ||
if: ${{ !startsWith(steps.detect_platform.outputs.PLATFORM, 'linux') }} | ||
- name: Compress artifacts (macOS) | ||
if: contains(steps.detect_platform.outputs.PLATFORM, 'darwin') | ||
working-directory: ${{ runner.temp }}/build/out | ||
shell: bash | ||
run: | | ||
if [[ "${{ steps.detect_platform.outputs.PLATFORM }}" == *"windows"* ]]; then | ||
zip -j ${{ steps.setup_env.outputs.ARCHIVE_NAME }} ${{ steps.setup_env.outputs.BINARY_NAME }}*.exe checksum.txt | ||
rm -f ${{ steps.setup_env.outputs.BINARY_NAME }}*.exe | ||
else | ||
zip -j ${{ steps.setup_env.outputs.ARCHIVE_NAME }} ${{ steps.setup_env.outputs.BINARY_NAME }}* checksum.txt | ||
rm -f ${{ steps.setup_env.outputs.BINARY_NAME }} | ||
fi | ||
# Keep a copy of checksum.txt for later use | ||
zip -j ${{ steps.setup_env.outputs.ARCHIVE_NAME }} ${{ steps.setup_env.outputs.BINARY_NAME }}* checksum.txt | ||
rm -f ${{ steps.setup_env.outputs.BINARY_NAME }} | ||
cp checksum.txt ${{ steps.setup_env.outputs.BINARY_NAME }}.checksum.txt | ||
- name: Compress artifacts (Windows) | ||
if: runner.os == 'Windows' | ||
working-directory: ${{ runner.temp }}/build/out | ||
shell: pwsh | ||
run: | | ||
Compress-Archive -Path "${{ steps.setup_env.outputs.BINARY_NAME }}*.exe","checksum.txt" -DestinationPath "${{ steps.setup_env.outputs.ARCHIVE_NAME }}" | ||
Remove-Item "${{ steps.setup_env.outputs.BINARY_NAME }}*.exe" | ||
Copy-Item "checksum.txt" "${{ steps.setup_env.outputs.BINARY_NAME }}.checksum.txt" | ||
- name: Upload build artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
|
@@ -133,7 +161,6 @@ jobs: | |
- name: Consolidate checksums | ||
working-directory: ${{ runner.temp }}/release/ | ||
run: | | ||
# Combine all checksum files into one | ||
cat *.checksum.txt > checksums.txt | ||
rm *.checksum.txt | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import type { TestType } from '@/types'; | ||
import { isDebugMode } from '@/utils/common'; | ||
|
||
export const DEFAULT_TEST_OPTIONS = { | ||
minTestTime: 5000, | ||
maxTestTime: 30000, | ||
targetError: 0.05, | ||
minSamples: 3, | ||
progressInterval: 200, | ||
thread: 4, | ||
type: 'SingleFile' as TestType, | ||
debug: isDebugMode() | ||
}; | ||
|
||
export const TEST_ENDPOINTS = { | ||
LibreSpeed: (baseUrl: string, testType: string) => { | ||
const paths = ['/backend', '/speed', '']; | ||
const endpoint = testType === 'download' ? 'garbage.php' : 'empty.php'; | ||
const params = testType === 'download' ? '?ckSize=100' : ''; | ||
const path = paths[0]; | ||
const url = `${baseUrl}${path}/${endpoint}${params}?r=${Math.random()}`; | ||
const referrer = `${baseUrl}/speedtest_worker.js?r=${Math.random()}`; | ||
|
||
return { | ||
url, | ||
referrer, | ||
fallbackUrls: paths.slice(1).map(p => | ||
`${baseUrl}${p}/${endpoint}${params}?r=${Math.random()}` | ||
) | ||
}; | ||
}, | ||
Cloudflare: (baseUrl: string, testType: string) => ({ | ||
url: `${baseUrl}/${testType === 'download' ? '__down?bytes=10000000' : '__up?r=0'}&measId=${Math.random() * Number(10000000000000000n)}`, | ||
referrer: "https://speed.cloudflare.com/", | ||
fallbackUrls: [] | ||
}), | ||
SingleFile: (baseUrl: string, testType: string) => ({ | ||
url: baseUrl, | ||
referrer: '', | ||
fallbackUrls: [] | ||
}) | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
src/controllers/startTest.ts → src/controllers/runSpeedTest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.