diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e19cbc3..6bb53f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,6 @@ jobs: with: python-version: ${{ matrix.python-version }} check-latest: false - allow-prereleases: true - name: Install zbar shared lib for QReader (Linux) if: runner.os == 'Linux' run: | diff --git a/.github/workflows/ci_docker.yml b/.github/workflows/ci_docker.yml index 7412592..5413078 100644 --- a/.github/workflows/ci_docker.yml +++ b/.github/workflows/ci_docker.yml @@ -25,7 +25,7 @@ on: jobs: build-and-push-docker-debian-image: - name: Build Docker Bullseye image and push to repositories + name: Build Docker Bookworm image and push to repositories # run only when code is compiling and tests are passing runs-on: ubuntu-latest @@ -82,12 +82,14 @@ jobs: file: docker/Dockerfile # builder: ${{ steps.buildx.outputs.name }} # Note: tags has to be all lower-case + build-args: | + BASE_IMAGE=python:3.12-slim-bookworm pull: true tags: | scit0/extract_otp_secrets:latest - scit0/extract_otp_secrets:bullseye + scit0/extract_otp_secrets:bookworm ghcr.io/scito/extract_otp_secrets:latest - ghcr.io/scito/extract_otp_secrets:bullseye + ghcr.io/scito/extract_otp_secrets:bookworm # build on feature branches, push only on master branch push: ${{ github.ref == 'refs/heads/master' && github.secret_source == 'Actions'}} @@ -179,8 +181,8 @@ jobs: name: alpine_digests path: digests.txt - build-and-push-docker-buster-image: - name: Build Docker Buster image (for PyInstsaller) and push to repositories + build-and-push-docker-bullseye-image: + name: Build Docker Bullseye image (for PyInstsaller) and push to repositories # run only when code is compiling and tests are passing runs-on: ubuntu-latest @@ -226,23 +228,22 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GHCR_IO_TOKEN }} - - name: "Build image from Buster and push to GitHub Container Registry" - id: docker_build_buster + - name: "Build image from Bullseye and push to GitHub Container Registry" + id: docker_build_bullseye if: github.ref == 'refs/heads/master' uses: docker/build-push-action@v3 with: platforms: linux/amd64,linux/arm64 # relative path to the place where source code with Dockerfile is located - # TODO file:, move to docker/ context: . file: docker/Dockerfile # builder: ${{ steps.buildx.outputs.name }} build-args: | - BASE_IMAGE=python:3.11-slim-buster + BASE_IMAGE=python:3.12-slim-bullseye # Note: tags has to be all lower-case pull: true tags: | - scit0/extract_otp_secrets:buster + scit0/extract_otp_secrets:bullseye push: ${{ github.secret_source == 'Actions' }} - name: Image digest @@ -254,5 +255,5 @@ jobs: if: github.ref == 'refs/heads/master' uses: actions/upload-artifact@v3 with: - name: buster_digests + name: bullseye_digests path: digests.txt diff --git a/.github/workflows/ci_release.yml b/.github/workflows/ci_release.yml index d2115f1..cb1da9c 100644 --- a/.github/workflows/ci_release.yml +++ b/.github/workflows/ci_release.yml @@ -27,6 +27,7 @@ name: release # Build matrix: # - Linux x86_64 glibc 2.35: ubuntu-latest # - Linux x86_64 glibc 2.31: extract_otp_secrets:bullseye +# - Linux x86_64 glibc 2.36: extract_otp_secrets:bookworm # - Windows x86_64: windows-latest # - MacOS x86_64: macos-11 # - Linux x86_64 glibc 2.28: extract_otp_secrets:buster @@ -87,7 +88,7 @@ jobs: https://api.github.com/repos/scito/extract_otp_secrets/releases \ --silent \ --show-error \ - -d '{"tag_name":"${{ github.ref }}","target_commitish":"master","name":"${{ steps.meta.outputs.version }} - ${{ steps.meta.outputs.date }}","body":"${{ steps.meta.outputs.tag_message }}\n\n## Executables\n\nDownload the executable for your platform and execute it, see [README.md](https://github.com/scito/extract_otp_secrets#readme)\n\n | Executable | Description |\n | --- | --- |\n | extract_otp_secrets${{ steps.meta.outputs.inline_version }}_linux_x86_64 | Linux x86_64/amd64 (glibc >= 2.28) |\n | extract_otp_secrets${{ steps.meta.outputs.inline_version }}_linux_arm64 | Linux arm64 (glibc >= 2.28) |\n | extract_otp_secrets${{ steps.meta.outputs.inline_version }}_win_x86_64.exe | Windows x86_64/amd64/x64 |\n | extract_otp_secrets${{ steps.meta.outputs.inline_version }}_win_arm64.exe | N/A |\n | extract_otp_secrets${{ steps.meta.outputs.inline_version }}_macos_x86_64.dmg | N/A, see [README.md](https://github.com/scito/extract_otp_secrets#readme) |\n | extract_otp_secrets${{ steps.meta.outputs.inline_version }}_macos_x86_64.pkg | N/A, see [README.md](https://github.com/scito/extract_otp_secrets#readme) |\n | extract_otp_secrets${{ steps.meta.outputs.inline_version }}_macos_x86_64 | MacOS x86_64/amd64 (bare executable, see [README.md](https://github.com/scito/extract_otp_secrets#readme); optional libzbar must be installed manually, see [README.md](https://github.com/scito/extract_otp_secrets#readme)) |\n | extract_otp_secrets${{ steps.meta.outputs.inline_version }}_macos_arm64 | N/A |\n","draft":true,"prerelease":false,"generate_release_notes":true}') + -d '{"tag_name":"${{ github.ref }}","target_commitish":"master","name":"${{ steps.meta.outputs.version }} - ${{ steps.meta.outputs.date }}","body":"${{ steps.meta.outputs.tag_message }}\n\n## Executables\n\nDownload the executable for your platform and execute it, see [README.md](https://github.com/scito/extract_otp_secrets#readme)\n\n | Executable | Description |\n | --- | --- |\n | extract_otp_secrets${{ steps.meta.outputs.inline_version }}_linux_x86_64 | Linux x86_64/amd64 (glibc >= 2.31) |\n | extract_otp_secrets${{ steps.meta.outputs.inline_version }}_linux_arm64 | Linux arm64 (glibc >= 2.31) |\n | extract_otp_secrets${{ steps.meta.outputs.inline_version }}_win_x86_64.exe | Windows x86_64/amd64/x64 |\n | extract_otp_secrets${{ steps.meta.outputs.inline_version }}_win_arm64.exe | N/A |\n | extract_otp_secrets${{ steps.meta.outputs.inline_version }}_macos_x86_64.dmg | N/A, see [README.md](https://github.com/scito/extract_otp_secrets#readme) |\n | extract_otp_secrets${{ steps.meta.outputs.inline_version }}_macos_x86_64.pkg | N/A, see [README.md](https://github.com/scito/extract_otp_secrets#readme) |\n | extract_otp_secrets${{ steps.meta.outputs.inline_version }}_macos_x86_64 | MacOS x86_64/amd64 (bare executable, see [README.md](https://github.com/scito/extract_otp_secrets#readme); optional libzbar must be installed manually, see [README.md](https://github.com/scito/extract_otp_secrets#readme)) |\n | extract_otp_secrets${{ steps.meta.outputs.inline_version }}_macos_arm64 | N/A |\n","draft":true,"prerelease":false,"generate_release_notes":true}') echo upload_url=$(jq '.upload_url' <<< "$response") >> $GITHUB_OUTPUT echo $(jq -r '.upload_url' <<< "$response") > release_url.txt echo $(jq -r '.id' <<< "$response") > release_id.txt @@ -174,11 +175,12 @@ jobs: docker run --pull always --rm --privileged multiarch/qemu-user-static --reset -p yes docker run --platform ${{ matrix.PLATFORM }} --pull always --entrypoint /bin/bash --rm -v "$(pwd)":/files -w /files scit0/extract_otp_secrets:bullseye -c 'apt-get update && apt-get -y install binutils && pip install -U -r /files/requirements.txt && pip install pyinstaller && PYTHONHASHSEED=31 && pyinstaller -y --add-data /usr/local/__yolo_v3_qr_detector/:__yolo_v3_qr_detector/ --onefile --name ${{ matrix.EXE }} --distpath /files/dist/ /files/src/extract_otp_secrets.py' - - name: Smoke tests ${{ matrix.PLATFORM }} + - name: Smoke tests linux/amd64 if: matrix.PLATFORM == 'linux/amd64' run: | dist/${{ matrix.EXE }} -V dist/${{ matrix.EXE }} -h + dist/${{ matrix.EXE }} --debug dist/${{ matrix.EXE }} example_export.png dist/${{ matrix.EXE }} - < example_export.txt dist/${{ matrix.EXE }} --qr ZBAR example_export.png @@ -186,7 +188,7 @@ jobs: dist/${{ matrix.EXE }} --qr QREADER_DEEP example_export.png dist/${{ matrix.EXE }} --qr CV2 example_export.png dist/${{ matrix.EXE }} --qr CV2_WECHAT example_export.png - - name: Smoke tests ${{ matrix.PLATFORM }} + - name: Smoke tests linux/arm64 if: matrix.PLATFORM == 'linux/arm64' run: | docker run --platform ${{ matrix.PLATFORM }} --pull always --entrypoint /bin/bash --rm -v "$(pwd)":/files -w /files scit0/extract_otp_secrets -c 'dist/${{ matrix.EXE }} -V && dist/${{ matrix.EXE }} -h && dist/${{ matrix.EXE }} example_export.png && dist/${{ matrix.EXE }} - < example_export.txt && dist/${{ matrix.EXE }} --qr ZBAR example_export.png && dist/${{ matrix.EXE }} --qr QREADER example_export.png && dist/${{ matrix.EXE }} --qr QREADER_DEEP example_export.png && dist/${{ matrix.EXE }} --qr CV2 example_export.png && dist/${{ matrix.EXE }} --qr CV2_WECHAT example_export.png' @@ -268,11 +270,11 @@ jobs: - uses: actions/checkout@v3 - name: Set macos macos_python_path # TODO use variable for Python version - run: echo "macos_python_path=/Library/Frameworks/Python.framework/Versions/3.11" >> $GITHUB_ENV - - name: Set up Python 3.11 + run: echo "macos_python_path=/Library/Frameworks/Python.framework/Versions/3.12" >> $GITHUB_ENV + - name: Set up Python 3.12 uses: actions/setup-python@v4 with: - python-version: 3.11 + python-version: 3.12 check-latest: true - name: Install zbar shared lib for QReader (Linux) if: runner.os == 'Linux' @@ -302,6 +304,7 @@ jobs: run: | dist/${{ matrix.EXE }} -V dist/${{ matrix.EXE }} -h + dist/${{ matrix.EXE }} --debug dist/${{ matrix.EXE }} example_export.png dist/${{ matrix.EXE }} --qr ZBAR example_export.png dist/${{ matrix.EXE }} --qr QREADER example_export.png diff --git a/build.sh b/build.sh index fee9129..817583c 100755 --- a/build.sh +++ b/build.sh @@ -406,6 +406,10 @@ if $build_local; then cmd="dist/extract_otp_secrets -h" if $interactive ; then askContinueYn "$cmd"; else echo -e "${cyan}$cmd${reset}";fi eval "$cmd" + + cmd="dist/extract_otp_secrets --qr ZBAR example_export.png" + if $interactive ; then askContinueYn "$cmd"; else echo -e "${cyan}$cmd${reset}";fi + eval "$cmd" fi # Build compiled executable @@ -431,6 +435,10 @@ if $build_local; then cmd="dist/extract_otp_secrets_compiled -h" if $interactive ; then askContinueYn "$cmd"; else echo -e "${cyan}$cmd${reset}";fi eval "$cmd" + + cmd="dist/extract_otp_secrets_compiled --qr ZBAR example_export.png" + if $interactive ; then askContinueYn "$cmd"; else echo -e "${cyan}$cmd${reset}";fi + eval "$cmd" fi # Generate README.md TOC @@ -548,6 +556,10 @@ if $build_docker; then if $interactive ; then askContinueYn "$cmd"; else echo -e "${cyan}$cmd${reset}";fi eval "$cmd" + cmd="dist/extract_otp_secrets_linux_x86_64_bookworm --qr ZBAR example_export.png || echo 'Could not run exe; see error message above'" + if $interactive ; then askContinueYn "$cmd"; else echo -e "${cyan}$cmd${reset}";fi + eval "$cmd" + # Build executable from Docker bullseye BULLSEYE_GLIBC_VERSION=$(docker run --entrypoint /bin/bash --rm extract_otp_secrets:bullseye -c 'ldd --version | sed "1!d" | sed -E "s/.* ([[:digit:]]+\.[[:digit:]]+)$/\1/"') echo "Bullseye glibc: $BULLSEYE_GLIBC_VERSION" @@ -559,6 +571,10 @@ if $build_docker; then cmd="dist/extract_otp_secrets_linux_x86_64 -h" if $interactive ; then askContinueYn "$cmd"; else echo -e "${cyan}$cmd${reset}";fi eval "$cmd" + + cmd="dist/extract_otp_secrets_linux_x86_64 --qr ZBAR example_export.png" + if $interactive ; then askContinueYn "$cmd"; else echo -e "${cyan}$cmd${reset}";fi + eval "$cmd" fi if $build_arm; then @@ -583,6 +599,10 @@ if $build_docker; then if $interactive ; then askContinueYn "$cmd"; else echo -e "${cyan}$cmd${reset}";fi eval "$cmd" + cmd="build/docker/nuitka/extract_otp_secrets_linux_x86_64_bookworm_compiled --qr ZBAR example_export.png" + if $interactive ; then askContinueYn "$cmd"; else echo -e "${cyan}$cmd${reset}";fi + eval "$cmd" + cmd="cp build/docker/nuitka/extract_otp_secrets_linux_x86_64_bookworm_compiled dist/" if $interactive ; then askContinueYn "$cmd"; else echo -e "${cyan}$cmd${reset}";fi eval "$cmd" @@ -599,6 +619,10 @@ if $build_docker; then if $interactive ; then askContinueYn "$cmd"; else echo -e "${cyan}$cmd${reset}";fi eval "$cmd" + cmd="build/docker/nuitka/extract_otp_secrets_linux_x86_64_bullseye_compiled --qr ZBAR example_export.png" + if $interactive ; then askContinueYn "$cmd"; else echo -e "${cyan}$cmd${reset}";fi + eval "$cmd" + cmd="cp build/docker/nuitka/extract_otp_secrets_linux_x86_64_bullseye_compiled dist/" if $interactive ; then askContinueYn "$cmd"; else echo -e "${cyan}$cmd${reset}";fi eval "$cmd"