-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
174 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: ruff | ||
# version_tests: skip_readme | ||
|
||
on: [pull_request, workflow_dispatch] | ||
|
||
jobs: | ||
alpine-musl: | ||
if: ${{ vars.CURRENT_TOOL == github.workflow }} | ||
uses: ./.github/workflows/build-alpine.yml | ||
with: | ||
workflow: ${{ github.workflow }} | ||
|
||
alpine-mingw: | ||
if: ${{ vars.CURRENT_TOOL == github.workflow }} | ||
uses: ./.github/workflows/build-alpine.yml | ||
with: | ||
workflow: ${{ github.workflow }} | ||
toolset: mingw | ||
|
||
test-alpine: | ||
needs: alpine-musl | ||
uses: ./.github/workflows/test-alpine.yml | ||
with: | ||
workflow: ${{ github.workflow }} | ||
artifact: build-musl | ||
|
||
test-ubuntu: | ||
needs: alpine-musl | ||
uses: ./.github/workflows/test-ubuntu.yml | ||
with: | ||
workflow: ${{ github.workflow }} | ||
artifact: build-musl | ||
|
||
test-windows: | ||
needs: alpine-mingw | ||
uses: ./.github/workflows/test-windows.yml | ||
with: | ||
workflow: ${{ github.workflow }} | ||
artifact: build-mingw | ||
|
||
release: | ||
needs: [test-alpine, | ||
test-ubuntu, | ||
test-windows] | ||
uses: ./.github/workflows/release.yml | ||
with: | ||
workflow: ${{ github.workflow }} | ||
tool_version: '0.0.280' | ||
prepare_body: | | ||
bsdtar -Oxf ./build-musl/build-musl.tar.gz build-musl.md >> body.md | ||
bsdtar -Oxf ./build-mingw/build-mingw.tar.gz build-mingw.md >> body.md | ||
artifacts: ./build-musl/build-musl.tar.gz,./build-mingw/build-mingw.tar.gz | ||
secrets: | ||
token: ${{ secrets.GITHUB_TOKEN }} |
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,52 @@ | ||
#!/bin/bash | ||
dp0="$(realpath "$(dirname "$0")")" | ||
set -e | ||
|
||
echo "::group::install deps" | ||
|
||
apk update | ||
apk add --no-cache alpine-sdk musl-dev gcc curl wget rustup pkgconfig openssl-dev mingw-w64-gcc | ||
|
||
rustup-init -y | ||
. "$HOME/.cargo/env" | ||
|
||
echo "::endgroup::" | ||
|
||
tool_name="ruff" | ||
tool_version="0.0.280" | ||
self_name="build-$tool_name-$tool_version" | ||
self_toolset_name="build-mingw" | ||
release_version_dirpath="$dp0/release/$self_name" | ||
|
||
mkdir -p "$release_version_dirpath" && cd "$dp0/release" | ||
|
||
download_url="https://github.com/astral-sh/ruff/archive/refs/tags/v$tool_version.tar.gz" | ||
echo "::group::prepare sources $download_url" | ||
|
||
"$dp0/../.tools/download_bsdtar.sh" | ||
bsdtar="$dp0/release/bsdtar" | ||
|
||
wget "$download_url" -O "tool-$tool_version.tar.gz" | ||
"$bsdtar" -xf "tool-$tool_version.tar.gz" && cd "$tool_name-$tool_version" | ||
|
||
cargo fetch | ||
rustup target add x86_64-pc-windows-gnu | ||
cargo build --target x86_64-pc-windows-gnu --release | ||
|
||
cp -f "./target/x86_64-pc-windows-gnu/release/$tool_name.exe" "$release_version_dirpath/" | ||
|
||
echo "::endgroup::" | ||
|
||
cd "$release_version_dirpath" | ||
|
||
strip "$tool_name.exe" | ||
|
||
{ printf '### %s | ||
SHA-256: %s | ||
' "$self_toolset_name.tar.gz" "$(sha256sum $tool_name.exe)" | ||
} > "$self_toolset_name.md" | ||
|
||
cat "$self_toolset_name.md" | ||
|
||
tar -czvf "../$self_toolset_name.tar.gz" . |
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,52 @@ | ||
#!/bin/bash | ||
dp0="$(realpath "$(dirname "$0")")" | ||
set -e | ||
|
||
echo "::group::install deps" | ||
|
||
apk update | ||
apk add --no-cache alpine-sdk musl-dev gcc curl wget rustup pkgconfig openssl-dev | ||
|
||
rustup-init -y | ||
. "$HOME/.cargo/env" | ||
|
||
echo "::endgroup::" | ||
|
||
tool_name="ruff" | ||
tool_version="0.0.280" | ||
self_name="build-$tool_name-$tool_version" | ||
self_toolset_name="build-musl" | ||
release_version_dirpath="$dp0/release/$self_name" | ||
|
||
mkdir -p "$release_version_dirpath" && cd "$dp0/release" | ||
|
||
download_url="https://github.com/astral-sh/ruff/archive/refs/tags/v$tool_version.tar.gz" | ||
echo "::group::prepare sources $download_url" | ||
|
||
"$dp0/../.tools/download_bsdtar.sh" | ||
bsdtar="$dp0/release/bsdtar" | ||
|
||
wget "$download_url" -O "tool-$tool_version.tar.gz" | ||
"$bsdtar" -xf "tool-$tool_version.tar.gz" && cd "$tool_name-$tool_version" | ||
|
||
cargo build --target x86_64-unknown-linux-musl --release | ||
|
||
cp -f "./target/x86_64-unknown-linux-musl/release/$tool_name" "$release_version_dirpath/" | ||
|
||
echo "::endgroup::" | ||
|
||
cd "$release_version_dirpath" | ||
strip "$tool_name" | ||
chmod +x "$tool_name" | ||
|
||
{ printf '%s | ||
### %s | ||
SHA-256: %s | ||
' "$("./$tool_name" --version)" "$self_toolset_name.tar.gz" "$(sha256sum $tool_name)" | ||
} > "$self_toolset_name.md" | ||
|
||
cat "$self_toolset_name.md" | ||
|
||
tar -czvf "../$self_toolset_name.tar.gz" . |
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,8 @@ | ||
#!/bin/bash | ||
|
||
testVersion() { | ||
assertEquals "ruff 0.0.280" "$(../bin/ruff --version)" | ||
} | ||
|
||
# Load and run shUnit2. | ||
source "../.tests/shunit2/shunit2" |
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,8 @@ | ||
#!/bin/bash | ||
|
||
testVersion() { | ||
assertEquals "ruff 0.0.280" "$(../bin/ruff.exe --version)" | ||
} | ||
|
||
# Load and run shUnit2. | ||
source "../.tests/shunit2/shunit2" |