Fix CI: replace actions/checkout with manual git clone
Some checks failed
Build & Release / build-linux-x86_64 (push) Failing after 24s
CI / test (push) Successful in 1m6s
Build & Release / build-linux-aarch64 (push) Failing after 28s
Build & Release / build-linux-armv7 (push) Failing after 32s
Build & Release / release (push) Has been skipped
Some checks failed
Build & Release / build-linux-x86_64 (push) Failing after 24s
CI / test (push) Successful in 1m6s
Build & Release / build-linux-aarch64 (push) Failing after 28s
Build & Release / build-linux-armv7 (push) Failing after 32s
Build & Release / release (push) Has been skipped
The act runner executes actions/checkout inside the job container, but that action is a Node.js script and rust:1.86-slim has no node. Use plain git clone instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -11,19 +11,29 @@ env:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs_on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: rust:1.86-slim
|
image: rust:1.86-slim
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Install git
|
||||||
|
run: apt-get update && apt-get install -y --no-install-recommends git
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
run: |
|
||||||
|
git config --global --add safe.directory '*'
|
||||||
|
git clone --depth 1 --branch ${GITHUB_REF_NAME:-main} ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git .
|
||||||
|
working_directory: /workspace
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: cargo test -- --test-threads=1
|
run: cargo test -- --test-threads=1
|
||||||
|
working_directory: /workspace
|
||||||
|
|
||||||
- name: Build release
|
- name: Build release
|
||||||
run: cargo build --release
|
run: cargo build --release
|
||||||
|
working_directory: /workspace
|
||||||
|
|
||||||
- name: Check binary
|
- name: Check binary
|
||||||
run: |
|
run: |
|
||||||
ls -lh target/release/btest
|
ls -lh target/release/btest
|
||||||
target/release/btest --version
|
target/release/btest --version
|
||||||
|
working_directory: /workspace
|
||||||
|
|||||||
@@ -10,190 +10,189 @@ env:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-linux-x86_64:
|
build-linux-x86_64:
|
||||||
runs-on: ubuntu-latest
|
runs_on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: rust:1.86-slim
|
image: rust:1.86-slim
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Install dependencies
|
||||||
|
|
||||||
- name: Install musl toolchain
|
|
||||||
run: |
|
run: |
|
||||||
apt-get update && apt-get install -y --no-install-recommends musl-tools
|
apt-get update && apt-get install -y --no-install-recommends git musl-tools
|
||||||
rustup target add x86_64-unknown-linux-musl
|
rustup target add x86_64-unknown-linux-musl
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
run: |
|
||||||
|
git config --global --add safe.directory '*'
|
||||||
|
git clone --depth 1 --branch ${GITHUB_REF_NAME} ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git /build
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cargo build --release --target x86_64-unknown-linux-musl
|
run: cargo build --release --target x86_64-unknown-linux-musl
|
||||||
|
working_directory: /build
|
||||||
|
|
||||||
- name: Package
|
- name: Package
|
||||||
run: |
|
run: |
|
||||||
cd target/x86_64-unknown-linux-musl/release
|
mkdir -p /artifacts
|
||||||
tar czf /tmp/btest-linux-x86_64.tar.gz btest
|
cd /build/target/x86_64-unknown-linux-musl/release
|
||||||
sha256sum /tmp/btest-linux-x86_64.tar.gz > /tmp/btest-linux-x86_64.tar.gz.sha256
|
tar czf /artifacts/btest-linux-x86_64.tar.gz btest
|
||||||
|
sha256sum /artifacts/btest-linux-x86_64.tar.gz > /artifacts/btest-linux-x86_64.tar.gz.sha256
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: btest-linux-x86_64
|
name: btest-linux-x86_64
|
||||||
path: |
|
path: /artifacts/
|
||||||
/tmp/btest-linux-x86_64.tar.gz
|
|
||||||
/tmp/btest-linux-x86_64.tar.gz.sha256
|
|
||||||
|
|
||||||
build-linux-aarch64:
|
build-linux-aarch64:
|
||||||
runs-on: ubuntu-latest
|
runs_on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: rust:1.86-slim
|
image: rust:1.86-slim
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Install dependencies
|
||||||
|
|
||||||
- name: Install cross-compilation toolchain
|
|
||||||
run: |
|
run: |
|
||||||
apt-get update && apt-get install -y --no-install-recommends \
|
apt-get update && apt-get install -y --no-install-recommends git gcc-aarch64-linux-gnu
|
||||||
musl-tools gcc-aarch64-linux-gnu
|
|
||||||
rustup target add aarch64-unknown-linux-musl
|
rustup target add aarch64-unknown-linux-musl
|
||||||
mkdir -p .cargo
|
|
||||||
cat > .cargo/config.toml << 'EOF'
|
- name: Checkout
|
||||||
|
run: |
|
||||||
|
git config --global --add safe.directory '*'
|
||||||
|
git clone --depth 1 --branch ${GITHUB_REF_NAME} ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git /build
|
||||||
|
|
||||||
|
- name: Configure cross-linker
|
||||||
|
run: |
|
||||||
|
mkdir -p /build/.cargo
|
||||||
|
cat > /build/.cargo/config.toml << 'TOML'
|
||||||
[target.aarch64-unknown-linux-musl]
|
[target.aarch64-unknown-linux-musl]
|
||||||
linker = "aarch64-linux-gnu-gcc"
|
linker = "aarch64-linux-gnu-gcc"
|
||||||
rustflags = ["-C", "target-feature=+crt-static"]
|
rustflags = ["-C", "target-feature=+crt-static"]
|
||||||
EOF
|
TOML
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cargo build --release --target aarch64-unknown-linux-musl
|
run: cargo build --release --target aarch64-unknown-linux-musl
|
||||||
|
working_directory: /build
|
||||||
|
|
||||||
- name: Package
|
- name: Package
|
||||||
run: |
|
run: |
|
||||||
cd target/aarch64-unknown-linux-musl/release
|
mkdir -p /artifacts
|
||||||
tar czf /tmp/btest-linux-aarch64.tar.gz btest
|
cd /build/target/aarch64-unknown-linux-musl/release
|
||||||
sha256sum /tmp/btest-linux-aarch64.tar.gz > /tmp/btest-linux-aarch64.tar.gz.sha256
|
tar czf /artifacts/btest-linux-aarch64.tar.gz btest
|
||||||
|
sha256sum /artifacts/btest-linux-aarch64.tar.gz > /artifacts/btest-linux-aarch64.tar.gz.sha256
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: btest-linux-aarch64
|
name: btest-linux-aarch64
|
||||||
path: |
|
path: /artifacts/
|
||||||
/tmp/btest-linux-aarch64.tar.gz
|
|
||||||
/tmp/btest-linux-aarch64.tar.gz.sha256
|
|
||||||
|
|
||||||
build-linux-armv7:
|
build-linux-armv7:
|
||||||
runs-on: ubuntu-latest
|
runs_on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: rust:1.86-slim
|
image: rust:1.86-slim
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Install dependencies
|
||||||
|
|
||||||
- name: Install cross-compilation toolchain
|
|
||||||
run: |
|
run: |
|
||||||
apt-get update && apt-get install -y --no-install-recommends \
|
apt-get update && apt-get install -y --no-install-recommends git gcc-arm-linux-gnueabihf
|
||||||
musl-tools gcc-arm-linux-gnueabihf
|
|
||||||
rustup target add armv7-unknown-linux-musleabihf
|
rustup target add armv7-unknown-linux-musleabihf
|
||||||
mkdir -p .cargo
|
|
||||||
cat > .cargo/config.toml << 'EOF'
|
- name: Checkout
|
||||||
|
run: |
|
||||||
|
git config --global --add safe.directory '*'
|
||||||
|
git clone --depth 1 --branch ${GITHUB_REF_NAME} ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git /build
|
||||||
|
|
||||||
|
- name: Configure cross-linker
|
||||||
|
run: |
|
||||||
|
mkdir -p /build/.cargo
|
||||||
|
cat > /build/.cargo/config.toml << 'TOML'
|
||||||
[target.armv7-unknown-linux-musleabihf]
|
[target.armv7-unknown-linux-musleabihf]
|
||||||
linker = "arm-linux-gnueabihf-gcc"
|
linker = "arm-linux-gnueabihf-gcc"
|
||||||
rustflags = ["-C", "target-feature=+crt-static"]
|
rustflags = ["-C", "target-feature=+crt-static"]
|
||||||
EOF
|
TOML
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cargo build --release --target armv7-unknown-linux-musleabihf
|
run: cargo build --release --target armv7-unknown-linux-musleabihf
|
||||||
|
working_directory: /build
|
||||||
|
|
||||||
- name: Package
|
- name: Package
|
||||||
run: |
|
run: |
|
||||||
cd target/armv7-unknown-linux-musleabihf/release
|
mkdir -p /artifacts
|
||||||
tar czf /tmp/btest-linux-armv7.tar.gz btest
|
cd /build/target/armv7-unknown-linux-musleabihf/release
|
||||||
sha256sum /tmp/btest-linux-armv7.tar.gz > /tmp/btest-linux-armv7.tar.gz.sha256
|
tar czf /artifacts/btest-linux-armv7.tar.gz btest
|
||||||
|
sha256sum /artifacts/btest-linux-armv7.tar.gz > /artifacts/btest-linux-armv7.tar.gz.sha256
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: btest-linux-armv7
|
name: btest-linux-armv7
|
||||||
path: |
|
path: /artifacts/
|
||||||
/tmp/btest-linux-armv7.tar.gz
|
|
||||||
/tmp/btest-linux-armv7.tar.gz.sha256
|
|
||||||
|
|
||||||
build-macos:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container:
|
|
||||||
image: rust:1.86-slim
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install macOS cross-compilation toolchain
|
|
||||||
run: |
|
|
||||||
apt-get update && apt-get install -y --no-install-recommends \
|
|
||||||
clang cmake curl git libssl-dev libxml2-dev lzma-dev make patch xz-utils zlib1g-dev
|
|
||||||
rustup target add x86_64-apple-darwin aarch64-apple-darwin
|
|
||||||
|
|
||||||
- name: Install osxcross
|
|
||||||
run: |
|
|
||||||
git clone --depth 1 https://github.com/tpoechtrager/osxcross /tmp/osxcross
|
|
||||||
# Download macOS SDK (this needs a pre-packaged SDK tarball)
|
|
||||||
# If osxcross is not available, we skip and note in release
|
|
||||||
echo "macOS cross-compilation requires osxcross SDK setup"
|
|
||||||
echo "Binaries can be built natively on macOS: cargo build --release"
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- name: Create placeholder note
|
|
||||||
run: |
|
|
||||||
echo "macOS binaries must be built on a macOS host." > /tmp/macos-build-note.txt
|
|
||||||
echo "Run: cargo build --release" >> /tmp/macos-build-note.txt
|
|
||||||
echo "Binaries: target/release/btest" >> /tmp/macos-build-note.txt
|
|
||||||
|
|
||||||
- name: Upload note
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: btest-macos-note
|
|
||||||
path: /tmp/macos-build-note.txt
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
needs: [build-linux-x86_64, build-linux-aarch64, build-linux-armv7, build-macos]
|
needs: [build-linux-x86_64, build-linux-aarch64, build-linux-armv7]
|
||||||
runs-on: ubuntu-latest
|
runs_on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: ubuntu:latest
|
image: ubuntu:latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install tools
|
- name: Install tools
|
||||||
run: apt-get update && apt-get install -y --no-install-recommends curl jq
|
run: apt-get update && apt-get install -y --no-install-recommends curl jq ca-certificates
|
||||||
|
|
||||||
- name: Download all artifacts
|
- name: Download all artifacts
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: artifacts
|
path: /artifacts
|
||||||
|
|
||||||
- name: List artifacts
|
- name: List artifacts
|
||||||
run: find artifacts -type f | sort
|
run: find /artifacts -type f | sort
|
||||||
|
|
||||||
- name: Create release
|
- name: Create release and upload
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||||
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
||||||
run: |
|
run: |
|
||||||
TAG="${GITHUB_REF##*/}"
|
TAG="${GITHUB_REF_NAME}"
|
||||||
GITEA_URL="https://git.manko.yoga"
|
GITEA_URL="${GITHUB_SERVER_URL}"
|
||||||
REPO="manawenuz/btest-rs"
|
REPO="${GITHUB_REPOSITORY}"
|
||||||
|
|
||||||
# Determine which token to use
|
echo "Creating release ${TAG} for ${REPO}..."
|
||||||
TOKEN="${GITEA_TOKEN:-$GITHUB_TOKEN}"
|
|
||||||
|
|
||||||
# Create release via Gitea API
|
# Create release
|
||||||
RELEASE_ID=$(curl -s -X POST \
|
RELEASE_BODY="## btest-rs ${TAG}
|
||||||
|
|
||||||
|
### Downloads
|
||||||
|
|
||||||
|
| Platform | Architecture | File |
|
||||||
|
|----------|-------------|------|
|
||||||
|
| Linux | x86_64 | btest-linux-x86_64.tar.gz |
|
||||||
|
| Linux | aarch64 (RPi 64-bit) | btest-linux-aarch64.tar.gz |
|
||||||
|
| Linux | armv7 (RPi 32-bit) | btest-linux-armv7.tar.gz |
|
||||||
|
| macOS | Build locally | \`cargo build --release\` |
|
||||||
|
|
||||||
|
### Quick Install
|
||||||
|
|
||||||
|
\`\`\`bash
|
||||||
|
# Download and extract
|
||||||
|
tar xzf btest-linux-x86_64.tar.gz
|
||||||
|
sudo mv btest /usr/local/bin/
|
||||||
|
|
||||||
|
# Or use the systemd installer
|
||||||
|
sudo ./install-service.sh --auth-user admin --auth-pass password
|
||||||
|
\`\`\`"
|
||||||
|
|
||||||
|
RELEASE_ID=$(curl -sf -X POST \
|
||||||
-H "Authorization: token ${TOKEN}" \
|
-H "Authorization: token ${TOKEN}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"tag_name\": \"${TAG}\", \"name\": \"btest-rs ${TAG}\", \"body\": \"## Release ${TAG}\n\n### Downloads\n\n| Platform | Architecture | File |\n|----------|-------------|------|\n| Linux | x86_64 | btest-linux-x86_64.tar.gz |\n| Linux | aarch64 (RPi 64-bit) | btest-linux-aarch64.tar.gz |\n| Linux | armv7 (RPi 32-bit) | btest-linux-armv7.tar.gz |\n| macOS | Build from source | cargo build --release |\n\n### Install\n\n\\\`\\\`\\\`bash\ntar xzf btest-linux-x86_64.tar.gz\nsudo mv btest /usr/local/bin/\n\\\`\\\`\\\`\", \"draft\": false, \"prerelease\": false}" \
|
-d "$(jq -n --arg tag "$TAG" --arg name "btest-rs $TAG" --arg body "$RELEASE_BODY" \
|
||||||
|
'{tag_name: $tag, name: $name, body: $body, draft: false, prerelease: false}')" \
|
||||||
"${GITEA_URL}/api/v1/repos/${REPO}/releases" | jq -r '.id')
|
"${GITEA_URL}/api/v1/repos/${REPO}/releases" | jq -r '.id')
|
||||||
|
|
||||||
echo "Created release ID: ${RELEASE_ID}"
|
echo "Created release ID: ${RELEASE_ID}"
|
||||||
|
|
||||||
# Upload each artifact
|
# Upload each artifact file
|
||||||
for file in artifacts/btest-linux-*/*.tar.gz artifacts/btest-linux-*/*.sha256; do
|
for file in /artifacts/btest-linux-*/*.tar.gz /artifacts/btest-linux-*/*.sha256; do
|
||||||
if [ -f "$file" ]; then
|
if [ -f "$file" ]; then
|
||||||
FILENAME=$(basename "$file")
|
FILENAME=$(basename "$file")
|
||||||
echo "Uploading: ${FILENAME}"
|
echo "Uploading: ${FILENAME}"
|
||||||
curl -s -X POST \
|
curl -sf -X POST \
|
||||||
-H "Authorization: token ${TOKEN}" \
|
-H "Authorization: token ${TOKEN}" \
|
||||||
-F "attachment=@${file}" \
|
-F "attachment=@${file}" \
|
||||||
"${GITEA_URL}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${FILENAME}"
|
"${GITEA_URL}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${FILENAME}" \
|
||||||
|
| jq -r '.name'
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Release ${TAG} created with artifacts"
|
echo "Release ${TAG} published!"
|
||||||
|
|||||||
Reference in New Issue
Block a user