diff --git a/.github/workflows/ci-test-run.yml b/.github/workflows/ci-test-run.yml index 1747395a7..a765c216c 100644 --- a/.github/workflows/ci-test-run.yml +++ b/.github/workflows/ci-test-run.yml @@ -1,20 +1,21 @@ name: ci build -on: [pull_request] - -env: - CURRENT_TOOL: 'far2l' +on: [pull_request, workflow_dispatch] jobs: prejob: runs-on: ubuntu-latest + environment: release outputs: tool: ${{ steps.setvar.outputs.envvar }} steps: - id: setvar - run: echo "::set-output name=envvar::$CURRENT_TOOL" + run: | + echo ${{ secrets._CURRENT_TOOL }} > CI_ENV + echo "::set-output name=envvar::$(sed -e 's/^_//' CI_ENV)" + - run: echo CURRENT_TOOL '${{ steps.setvar.outputs.envvar }}' - alpine-bsdtar-linux: + bsdtar-alpine-musl: needs: prejob if: ${{ needs.prejob.outputs.tool=='bsdtar' }} runs-on: ubuntu-latest @@ -27,11 +28,81 @@ jobs: apk add --no-cache bash ./bsdtar/build.sh + - uses: actions/upload-artifact@v3 + with: + name: bsdtar-alpine-musl + path: | + ./bsdtar/release/_musl.tar.gz + + bsdtar-windows-mingw: + needs: prejob + if: ${{ needs.prejob.outputs.tool=='bsdtar' }} + runs-on: windows-2019 + steps: + - uses: actions/checkout@v2 + - name: build + id: build + shell: cmd + run: .tools\busybox64.exe sh bsdtar\build_mingw.sh + + - uses: actions/upload-artifact@v3 + with: + name: bsdtar-windows-mingw + path: | + ./bsdtar/release/_mingw.tar.gz + + bsdtar-alpine-test: + needs: bsdtar-alpine-musl + runs-on: ubuntu-latest + container: alpine:3.15.0 + steps: + - uses: actions/download-artifact@v2 + with: + name: bsdtar-alpine-musl + path: . + + - name: Test musl build on Alpine + run: | + tar -xf ./_musl.tar.gz + ./bsdtar --version + + bsdtar-windows-test: + needs: bsdtar-windows-mingw + runs-on: windows-2022 + steps: + - uses: actions/download-artifact@v2 + with: + name: bsdtar-windows-mingw + path: . + + - name: Test mingw build on Windows + shell: cmd + run: | + tar -xf .\_mingw.tar.gz + .\bsdtar.exe --version + + bsdtar-release: + runs-on: ubuntu-latest + needs: [bsdtar-alpine-test, bsdtar-windows-test] + steps: + - uses: actions/download-artifact@v2 + with: + name: bsdtar-alpine-musl + path: . + - uses: actions/download-artifact@v2 + with: + name: bsdtar-windows-mingw + path: . + - run: | + tar -xf ./_musl.tar.gz + tar -xf ./_mingw.tar.gz + cat _musl.md >> body.md + cat _mingw.md >> body.md - uses: ncipollo/release-action@v1 with: - tag: '${{ steps.build.outputs.tool_name }}-${{ steps.build.outputs.tool_version }}' - bodyFile: './bsdtar/release/body.md' - artifacts: './bsdtar/release/${{ steps.build.outputs.tool_name }}' + tag: 'bsdtar-3.5.1' + artifacts: './bsdtar*' + bodyFile: './body.md' allowUpdates: true token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.tools/busybox64.exe b/.tools/busybox64.exe new file mode 100644 index 000000000..e4538bdbe Binary files /dev/null and b/.tools/busybox64.exe differ diff --git a/bsdtar/build.sh b/bsdtar/build.sh index a3f9510e0..98f5050c3 100755 --- a/bsdtar/build.sh +++ b/bsdtar/build.sh @@ -5,7 +5,7 @@ set -e echo "::group::install deps" apk update -apk add --no-cache alpine-sdk zlib-dev bzip2-dev zlib-static bzip2-static +apk add --no-cache alpine-sdk zlib-dev bzip2-dev zlib-static bzip2-static xz-dev echo "::endgroup::" @@ -27,7 +27,9 @@ echo "::group::build" ./configure LDFLAGS='--static' --enable-bsdtar=static --disable-shared --disable-bsdcpio --disable-bsdcat make -j$(nproc) -gcc -static -o "../$tool_name" \ + +mkdir "$dp0/release/build" +gcc -static -o "$dp0/release/build/$tool_name" \ tar/bsdtar-bsdtar.o \ tar/bsdtar-cmdline.o \ tar/bsdtar-creation_set.o \ @@ -38,17 +40,20 @@ gcc -static -o "../$tool_name" \ .libs/libarchive.a \ .libs/libarchive_fe.a \ /lib/libz.a \ - /usr/lib/libbz2.a + /usr/lib/libbz2.a \ + /usr/lib/liblzma.a echo "::endgroup::" -cd "$dp0/release" +cd "$dp0/release/build" strip "$tool_name" chmod +x "$tool_name" { printf 'SHA-256: %s %s -%s' "$(sha256sum < $tool_name)" "$("./$tool_name" --version)" "$download_url" -} > body.md +' "$(sha256sum $tool_name)" "$("./$tool_name" --version)" +} > _musl.md + +cat _musl.md -cat body.md +tar -czvf ../_musl.tar.gz . diff --git a/bsdtar/build_mingw.sh b/bsdtar/build_mingw.sh new file mode 100755 index 000000000..9c9da50aa --- /dev/null +++ b/bsdtar/build_mingw.sh @@ -0,0 +1,42 @@ +#!/bin/bash +dp0="$(realpath "$(dirname "$0")")" +set -e + +tool_name="bsdtar.exe" +tool_version="3.5.1" +echo "::set-output name=tool_name::$tool_name" +echo "::set-output name=tool_version::$tool_version" + +download_url="https://github.com/libarchive/libarchive/releases/download/v$tool_version/libarchive-$tool_version.tar.gz" +echo "::group::prepare sources $download_url" + +mkdir -p "$dp0/release" && cd "$dp0/release" +wget "$download_url" -O "libarchive-$tool_version.tar.gz" +tar -xf "libarchive-$tool_version.tar.gz" && cd "libarchive-$tool_version" + +wget "https://github.com/libarchive/libarchive/raw/v$tool_version/build/ci/github_actions/ci.cmd" -O "$dp0/ci.cmd" + +echo "::endgroup::" + +echo "::group::build" + +export BE=mingw-gcc + +"$dp0/ci.cmd" deplibs +"$dp0/ci.cmd" configure +"$dp0/ci.cmd" build + +echo "::endgroup::" + +mkdir "$dp0/release/build" && cd "$dp0/release/build" +cp -f "$dp0/release/libarchive-$tool_version/build_ci/cmake/bin/$tool_name" "." + +{ printf 'SHA-256: %s +%s +%s +' "$(sha256sum $tool_name)" "$("./$tool_name" --version)" "$download_url" +} > _mingw.md + +cat _mingw.md + +tar -czvf ../_mingw.tar.gz .