101 lines
2.9 KiB
YAML
Raw Permalink Normal View History

2024-01-13 18:38:24 +01:00
name: build
2024-01-12 22:33:59 +01:00
on: [push]
jobs:
build:
2024-01-13 17:07:34 +01:00
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
2024-01-12 22:33:59 +01:00
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
2024-01-13 18:38:24 +01:00
2024-01-12 22:33:59 +01:00
- name: prep
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install pipenv pyinstaller==6.3.0
pipenv install
rm -rf build dist
2024-01-13 18:38:24 +01:00
2024-01-12 22:33:59 +01:00
- name: build
shell: bash
run: |
2024-01-13 17:07:34 +01:00
echo "RUNNER_OS: $RUNNER_OS"
# get path to venv site-packages (for blake3)
pipenv run python -c "import site; print(site.getsitepackages())"
SITEPKG=$(pipenv run python -c "import site; print(site.getsitepackages()[-1])")
pipenv run pyinstaller run.py --hidden-import chkbit --hidden-import chkbit_cli --onefile --name chkbit --console --paths $SITEPKG
2024-01-12 22:33:59 +01:00
cat build/chkbit/warn-chkbit.txt
2024-01-13 17:07:34 +01:00
cd dist; ls -l
2024-01-13 18:38:24 +01:00
if [ "$RUNNER_OS" == "Linux" ]; then
2024-06-28 22:08:43 +02:00
a=$(grep -oP '(?<=version = ")[^"]+' ../pyproject.toml)
b=$(grep -oP '(?<=__version__ = ")[^"]+' ../chkbit_cli/__init__.py)
if [[ $a != $b ]]; then echo "version error $a $b"; exit 1; fi
2024-06-28 21:58:10 +02:00
c=$(./chkbit --version)
2024-06-28 22:08:43 +02:00
echo $c
if [[ $a != $c ]]; then echo "version error $a $c"; exit 1; fi
2024-06-28 22:34:28 +02:00
tar -czf chkbit-linux_${RUNNER_ARCH}.tar.gz chkbit
2024-01-13 18:38:24 +01:00
elif [ "$RUNNER_OS" == "macOS" ]; then
2024-06-28 22:08:43 +02:00
./chkbit --version
2024-06-28 22:34:28 +02:00
tar -czf chkbit-macos_${RUNNER_ARCH}.tar.gz chkbit
2024-01-13 18:38:24 +01:00
elif [ "$RUNNER_OS" == "Windows" ]; then
2024-06-28 22:08:43 +02:00
./chkbit.exe --version
2024-06-28 22:34:28 +02:00
7z a -tzip chkbit-windows_${RUNNER_ARCH}.zip chkbit.exe
2024-01-13 17:07:34 +01:00
else
2024-01-13 18:38:24 +01:00
echo 'unknown runner'
exit 1
2024-01-13 17:07:34 +01:00
fi
2024-01-13 18:38:24 +01:00
2024-01-13 17:07:34 +01:00
- name: artifact
2024-01-13 18:38:24 +01:00
uses: actions/upload-artifact@v4
2024-01-13 17:07:34 +01:00
if: runner.os == 'Linux'
with:
2024-01-13 18:38:24 +01:00
name: binary-${{ matrix.os }}
path: dist/chkbit*.tar.gz
2024-01-12 22:33:59 +01:00
- name: artifact
2024-01-13 18:38:24 +01:00
uses: actions/upload-artifact@v4
2024-01-13 17:07:34 +01:00
if: runner.os == 'macOS'
2024-01-12 22:33:59 +01:00
with:
2024-01-13 18:38:24 +01:00
name: binary-${{ matrix.os }}
path: dist/chkbit*.tar.gz
2024-01-13 17:07:34 +01:00
- name: artifact
2024-01-13 18:38:24 +01:00
uses: actions/upload-artifact@v4
2024-01-13 17:07:34 +01:00
if: runner.os == 'Windows'
with:
2024-01-13 18:38:24 +01:00
name: binary-${{ matrix.os }}
path: dist/chkbit*.zip
2024-01-13 17:07:34 +01:00
2024-01-13 18:38:24 +01:00
publish:
runs-on: ubuntu-latest
needs: build
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
steps:
- name: get-artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: list
shell: bash
run: |
find
ls -l dist
- name: publish-release
uses: softprops/action-gh-release@v1
with:
draft: true
files: dist/*
2024-01-13 17:07:34 +01:00