Update .gitignore and defconfig options #270
This file contains hidden or 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
| name: create-release | |
| permissions: | |
| contents: write | |
| on: | |
| push: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| tag_name: ${{ steps.create_tag.outputs.tag_name }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc make libncurses5-dev perl mingw-w64 | |
| - name: Build BusyBox-W32 | |
| run: | | |
| make kib64u_defconfig -j$(nproc) | |
| make -j$(nproc) | |
| mkdir -p build | |
| mv ./busybox.exe build/busybox64.exe | |
| - name: Create Git tag | |
| id: create_tag | |
| run: | | |
| TAG_NAME="release-$(date -u +'%Y%m%dT%H%M%SZ')" | |
| git tag $TAG_NAME | |
| git push origin $TAG_NAME | |
| echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload to release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| tag_name: ${{ steps.create_tag.outputs.tag_name }} | |
| files: build/busybox64.exe | |
| test-windows-binary: | |
| runs-on: windows-latest | |
| needs: build-and-deploy | |
| steps: | |
| - name: Download latest busybox64.exe from release | |
| shell: pwsh | |
| run: | | |
| Set-Location -Path "C:\" | |
| $binaryPath = "C:\busybox64.exe" | |
| $url = "https://github.com/KIB-in-Batch/busybox-w32/releases/latest/download/busybox64.exe" | |
| curl.exe -L# $url -o $binaryPath | |
| - name: Verify basic commands | |
| shell: pwsh | |
| run: | | |
| $binary = "C:\busybox64.exe" | |
| Write-Host "Running basic commands..." | |
| & $binary echo "Hello World" | |
| & $binary date | |
| & $binary uname -a | |
| - name: Test directory and file operations | |
| shell: pwsh | |
| run: | | |
| $binary = "C:\busybox64.exe" | |
| $testDir = "C:\test_busybox" | |
| New-Item -ItemType Directory -Path $testDir | Out-Null | |
| Set-Location -Path $testDir | |
| # Create files | |
| & $binary touch file1.txt file2.txt | |
| & $binary sh -c "echo 'content1' > file1.txt" | |
| & $binary sh -c "echo 'content2' > file2.txt" | |
| # List files | |
| $files = & $binary ls | |
| Write-Host "Files: $files" | |
| # Read files | |
| $content1 = & $binary cat file1.txt | |
| $content2 = & $binary cat file2.txt | |
| - name: Test copy, move, and remove | |
| shell: pwsh | |
| run: | | |
| $testDir = "C:\test_busybox" | |
| Set-Location -Path $testDir | |
| $binary = "C:\busybox64.exe" | |
| # Copy file1.txt to copy_file1.txt | |
| & $binary cp file1.txt copy_file1.txt | |
| if (!(Test-Path copy_file1.txt)) { throw "Copy failed" } | |
| # Move file2.txt to moved_file2.txt | |
| & $binary mv file2.txt moved_file2.txt | |
| if (!(Test-Path moved_file2.txt) -or (Test-Path file2.txt)) { throw "Move failed" } | |
| # Remove files | |
| & $binary rm copy_file1.txt moved_file2.txt | |
| if ((Test-Path copy_file1.txt) -or (Test-Path moved_file2.txt)) { throw "Remove failed" } | |
| - name: Test command chaining and redirection | |
| shell: pwsh | |
| run: | | |
| $testDir = "C:\test_busybox" | |
| Set-Location -Path $testDir | |
| $binary = "C:\busybox64.exe" | |
| & $binary sh -c "echo 'line1' > chain.txt" | |
| & $binary sh -c "echo 'line2' >> chain.txt" | |
| $lines = & $binary cat chain.txt | |
| Write-Host "Chained file content: $lines" | |
| - name: Clean up | |
| shell: pwsh | |
| run: | | |
| Remove-Item -Recurse -Force "C:\test_busybox" | |
| Remove-Item -Force "C:\busybox64.exe" |