Skip to content

Commit

Permalink
Merge branch 'feature/memory-sig-refactor' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
PaperMtn committed Sep 3, 2024
2 parents 0fff26f + 36640cd commit 2586422
Show file tree
Hide file tree
Showing 17 changed files with 459 additions and 294 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/github_release.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name: Create Release
name: Create GitHub Release

on:
push:
branches: [ master ]
branches: [ main, master ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.10' ]
python-version: [ '3.12' ]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -19,20 +19,17 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install flake8 poetry
poetry install
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test setup & install
- name: Install
run: |
pip install build twine
python3 -m build
twine check dist/*.whl
poetry build
python3 -m pip install dist/*.whl
- name: Extract release notes
id: extract-release-notes
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ name: Python package

on:
push:
branches: [ develop ]
branches: [ develop, feature/**, release/** ]
pull_request:
branches: [ develop ]
branches: [ develop, feature/**, release/** ]

jobs:
build-ubuntu:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']
python-version: ['3.12']

steps:
- uses: actions/checkout@v2
Expand All @@ -25,9 +25,8 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install flake8 poetry
poetry install
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand All @@ -36,11 +35,9 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test setup & install
run: |
pip install build twine
python3 -m build
twine check dist/*.whl
poetry build
python3 -m pip install dist/*.whl
- name: Test run
run: |
slack-watchman --version
slack-watchman --help
slack-watchman --help
21 changes: 8 additions & 13 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package
name: Poetry Publish

on:
push:
branches: [ master ]
branches: [ main ]

jobs:
deploy:
Expand All @@ -17,14 +15,11 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
python-version: '3.12'
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip twine build
- name: Build and publish
env:
TWINE_USERNAME: ${{ '__token__' }}
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python3 -m build
twine upload dist/*
pip install poetry
poetry install
poetry config pypi-token.pypi "${{ secrets.PYPI_TOKEN }}"
- name: Publish package
run: poetry publish --build
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
## [4.1.0] - 2024-09-02
### Changed
- Signatures are now downloaded, processes and stored in memory instead of writing to disk. This saves having to store them in files, and solves the issues when using Slack Watchman with read-only filesystems (raised in [#51](https://github.com/PaperMtn/watchman-signatures/issues/51))
- Migrated to Poetry for dependency control and packaging


## [4.0.2] - 2023-06-14
### Added
- Added notification for an invalid cookie being passed (Fixes #47)
- Added notification for an invalid cookie being passed (Fixes [#47](https://github.com/PaperMtn/watchman-signatures/issues/47))
### Fixed
- JSON output for User and Workspace information was malformed, this has now been fixed

Expand All @@ -11,7 +17,7 @@
## [4.0.0] - 2023-05-03
This major version release brings multiple updates to Slack Watchman in usability, functionality and behind the scenes improvements.

**Note**: While efforts have been made to make sure there is some backwards compatibility, this release may have some breaking changes on previous versions. Make sure to look at the removed secion
**Note**: While efforts have been made to make sure there is some backwards compatibility, this release may have some breaking changes on previous versions. Make sure to look at the removed section

### Added
- Support for centralised signatures from the [Watchman Signatures repository](https://github.com/PaperMtn/watchman-signatures)
Expand Down
43 changes: 35 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,40 @@
# syntax=docker/dockerfile:1

FROM python:3.10
COPY . /opt/slack-watchman
#FROM python:3.12-slim-bullseye
#WORKDIR /opt/slack-watchman
#COPY . /opt/slack-watchman
#RUN pip install poetry
#ENV PYTHONPATH=/opt/slack-watchman \
# SLACK_WATCHMAN_TOKEN="" \
# SLACK_WATCHMAN_COOKIE="" \
# SLACK_WATCHMAN_URL=""
#RUN poetry config virtualenvs.create false && \
# poetry install --no-dev && \
# chmod -R 700 . && \
# poetry build && \
# pip install dist/*.whl
#STOPSIGNAL SIGINT
#WORKDIR /opt/slack-watchman
#ENTRYPOINT ["slack-watchman"]

# syntax=docker/dockerfile:1
FROM python:3.12-slim-bullseye AS builder
WORKDIR /opt/slack-watchman
ENV PYTHONPATH=/opt/slack-watchman SLACK_WATCHMAN_TOKEN="" SLACK_WATCHMAN_COOKIE="" SLACK_WATCHMAN_URL=""
RUN pip3 install -r requirements.txt build && \
chmod -R 700 . && \
python3 -m build && \
python3 -m pip install dist/*.whl
STOPSIGNAL SIGINT
COPY . .
RUN pip install poetry
RUN poetry config virtualenvs.create false && \
poetry install --no-dev && \
poetry build

FROM python:3.12-slim-bullseye
WORKDIR /opt/slack-watchman
COPY --from=builder /opt/slack-watchman/dist/*.whl /opt/slack-watchman/dist/
COPY --from=builder /opt/slack-watchman/pyproject.toml /opt/slack-watchman/poetry.lock /opt/slack-watchman/
ENV PYTHONPATH=/opt/slack-watchman \
SLACK_WATCHMAN_TOKEN="" \
SLACK_WATCHMAN_COOKIE="" \
SLACK_WATCHMAN_URL=""
RUN pip install dist/*.whl && \
chmod -R 700 .
STOPSIGNAL SIGINT
ENTRYPOINT ["slack-watchman"]
Loading

0 comments on commit 2586422

Please sign in to comment.