-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
1,595 additions
and
369 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
{ | ||
"name": "dev", | ||
"name": "dev-ntfsfind", | ||
"dockerFile": "Dockerfile", | ||
"postCreateCommand": "/bin/sh ./.devcontainer/postCreateCommands.sh", | ||
"extensions": [ | ||
"ms-azuretools.vscode-docker", | ||
"ms-python.python", | ||
"ms-python.vscode-pylance" | ||
], | ||
"settings": { | ||
"python.linting.flake8Enabled": true, | ||
"python.formatting.provider": "black", | ||
"[python]": { | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": true | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"ms-azuretools.vscode-docker", | ||
"ms-python.python", | ||
"ms-python.vscode-pylance" | ||
], | ||
"settings": { | ||
"python.linting.flake8Enabled": true, | ||
"python.formatting.provider": "black", | ||
"[python]": { | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": true | ||
} | ||
} | ||
} | ||
}, | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
#!/bin/sh | ||
|
||
poetry config virtualenvs.in-project true | ||
poetry install | ||
|
||
echo 'Welcome to the ntfsfind development environment!' | ||
poetry install |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: publish-binary-pypi | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
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 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
name: publish-release | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build-windows: | ||
runs-on: windows-latest | ||
outputs: | ||
version: ${{ steps.create_tag.outputs.version }} | ||
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/ntfsfind.py') | ||
text = f.read_text().replace("get_version('ntfsfind')", 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 ntfsfind -h | ||
- name: build | ||
run: | | ||
pip install nuitka | ||
poetry run python -m nuitka --standalone --onefile --follow-imports -o ntfsfind.exe --output-dir=dist --assume-yes-for-downloads src/ntfsfind.py | ||
- name: verify | ||
run: | | ||
dist/ntfsfind.exe -h | ||
dist/ntfsfind.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 "version=v$version" >> $GITHUB_OUTPUT | ||
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/ntfsfind.exe | ||
name: Release ${{ steps.create_tag.outputs.version }} | ||
body: 'This release was automatically created by GitHub Actions.' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
build-linux: | ||
needs: build-windows | ||
runs-on: ubuntu-20.04 | ||
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/ntfsfind.py') | ||
text = f.read_text().replace("get_version('ntfsfind')", 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 ntfsfind -h | ||
- name: build | ||
run: | | ||
pip install nuitka | ||
poetry run python -m nuitka --standalone --onefile --follow-imports -o ntfsfind --output-dir=dist --assume-yes-for-downloads src/ntfsfind.py | ||
- name: verify | ||
run: | | ||
dist/ntfsfind -h | ||
dist/ntfsfind --version | ||
- name: upload asset to release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${{ needs.build-windows.outputs.version }} | ||
files: dist/ntfsfind | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains 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
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 ntfsfind | ||
|
||
# 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 ntfsfind:latest '/$MFT' /app/sample.raw | ||
ENTRYPOINT ["ntfsfind"] | ||
ENTRYPOINT ["python", "-m", "poetry", "run", "ntfsfind"] | ||
CMD ["-h"] |
Oops, something went wrong.