Skip to content

Commit

Permalink
Merge branch 'feature/2.5.0' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
sumeshi committed Nov 23, 2023
2 parents dfa152b + 8e2fee7 commit 1e28794
Show file tree
Hide file tree
Showing 12 changed files with 311 additions and 147 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.12.0-bullseye
FROM python:3.11.0-bullseye

RUN apt -y update && apt upgrade -qqy && apt -y install \
curl \
Expand Down
53 changes: 0 additions & 53 deletions .github/workflows/build-binary.yaml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/build-docker-image.yaml

This file was deleted.

24 changes: 24 additions & 0 deletions .github/workflows/publish-binary-pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: publish-binary-pypi

on:
release:
types: [created]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Build and publish
run: |
poetry config pypi-token.pypi ${{secrets.PYPI_TOKEN}}
poetry publish --build
124 changes: 124 additions & 0 deletions .github/workflows/publish-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: publish-release

on:
push:
branches:
- master

jobs:
build-windows:
runs-on: windows-latest
strategy:
matrix:
python-version: ['3.11']
steps:
- name: checkout
uses: actions/checkout@v3

- name: install python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: replace version
run: |
from pathlib import Path
version = [l for l in Path('pyproject.toml').read_text().splitlines() if 'version' in l][0].split(' ')[-1].strip('\"')
f = Path('src/ntfsdump/models/MetaData.py')
text = f.read_text().replace("get_version(name)", f"\'{version}\'")
f.write_text(text)
shell: python

- name: Install dependencies
run: |
pip install poetry
poetry config virtualenvs.in-project true
poetry install
- name: run python
run: |
poetry run ntfsdump -h
- name: build
run: |
pip install nuitka
poetry run python -m nuitka --standalone --onefile --follow-imports -o ntfsdump.exe --output-dir=dist --assume-yes-for-downloads src/ntfsdump/views/NtfsDumpView.py
- name: verify
run: |
dist/ntfsdump.exe -h
dist/ntfsdump.exe --version
- name: create tag
id: create_tag
if: startsWith(github.ref, 'refs/heads/master')
run: |
version=$(cat pyproject.toml | grep version | head -1 | awk -F '"' '{print $2}')
git tag "v$version"
git push origin "v$version"
echo "::set-output name=version::v$version"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash

- name: create release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.create_tag.outputs.version }}
files: dist/ntfsdump.exe
name: Release ${{ steps.create_tag.outputs.version }}
body: 'Release description here'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-linux:
needs: build-windows
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11']
steps:
- name: checkout
uses: actions/checkout@v3

- name: install python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: replace version
run: |
from pathlib import Path
version = [l for l in Path('pyproject.toml').read_text().splitlines() if 'version' in l][0].split(' ')[-1].strip('\"')
f = Path('src/ntfsdump/models/MetaData.py')
text = f.read_text().replace("get_version(name)", f"\'{version}\'")
f.write_text(text)
shell: python

- name: Install dependencies
run: |
sudo apt install patchelf
pip install poetry
poetry install
- name: run python
run: |
poetry run ntfsdump -h
- name: build
run: |
pip install nuitka
poetry run python -m nuitka --standalone --onefile --follow-imports -o ntfsdump --output-dir=dist --assume-yes-for-downloads src/ntfsdump/views/NtfsDumpView.py
- name: verify
run: |
dist/ntfsdump -h
dist/ntfsdump --version
- name: upload asset to release
uses: softprops/action-gh-release@v1
with:
files: dist/ntfsdump
tag_name: ${{ needs.build-windows.outputs.tag_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ name: pytest
on:
push:
branches:
- master
- develop
# - 'feature/**'

jobs:
pytest:
name: Run tests with pytest
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
python-version: ['3.11', '3.12']
steps:
- name: checkout
uses: actions/checkout@v2
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,7 @@ dmypy.json
**/*.tgs
**/*.E01

NtfsDumpView.*/

/tests/ntfsdump/cache/*
!/tests/ntfsdump/cache/.gitkeep
15 changes: 10 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
FROM python:3.9-bullseye

# install from pypi
FROM python:3.11-bullseye
WORKDIR /app
RUN pip install ntfsdump

# install dependencies
RUN pip install -U pip && pip install poetry
RUN poetry config virtualenvs.create false

# install application
COPY . /app
RUN poetry install

# you can rewrite this command when running the docker container.
# ex. docker run --rm -v $(pwd):/app -t ntfsdump:latest '/$MFT' /app/sample.raw
ENTRYPOINT ["ntfsdump"]
ENTRYPOINT ["python", "-m", "poetry", "run", "ntfsdump"]
CMD ["-h"]
Loading

0 comments on commit 1e28794

Please sign in to comment.