-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
0 parents
commit 2556615
Showing
47 changed files
with
6,068 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
name: release_github | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release: | ||
description: 'Release after build' | ||
required: true | ||
default: 'no' | ||
push: | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+" | ||
|
||
env: | ||
BUILD_PYTHON_VERSION: 3.9 | ||
BUILD_POETRY_VERSION: 1.1.11 | ||
PACKAGE_NAME: enex2notion | ||
|
||
jobs: | ||
build_python: | ||
runs-on: ubuntu-latest | ||
env: | ||
POETRY_VIRTUALENVS_CREATE: false | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ env.BUILD_PYTHON_VERSION }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.BUILD_PYTHON_VERSION }} | ||
|
||
- name: Set up Poetry ${{ env.BUILD_POETRY_VERSION }} | ||
uses: abatilo/actions-poetry@v2.0.0 | ||
with: | ||
poetry-version: ${{ env.BUILD_POETRY_VERSION }} | ||
|
||
- name: Export requirements | ||
run: poetry export --without-hashes -f requirements.txt --output requirements.txt | ||
|
||
- name: Build project for distribution | ||
run: poetry build | ||
|
||
- name: Save release python requirements | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: release_dist_reqs | ||
path: requirements.txt | ||
|
||
- name: Save release python packages | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: release_dist_python | ||
path: dist | ||
|
||
build_binaries_mac: | ||
needs: build_python | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Get tag version | ||
run: echo "TAG_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
|
||
- name: Load release python requirements | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: release_dist_reqs | ||
|
||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pyinstaller | ||
pip install -r requirements.txt | ||
- name: Build with pyinstaller for macos | ||
run: pyinstaller ${{ env.PACKAGE_NAME }}.spec | ||
|
||
- name: Make directory for bins | ||
run: mkdir dist_bin | ||
|
||
- name: Pack up binary for macos | ||
run: zip -q -j dist_bin/bin_${{ env.PACKAGE_NAME }}_${TAG_VERSION}_macos_x64.zip ./dist/${{ env.PACKAGE_NAME }} | ||
|
||
- name: Save release binaries for macos x64 | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: release_dist_bin_macos_x64 | ||
path: dist_bin | ||
|
||
build_binaries: | ||
needs: build_python | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
os: [windows, linux] | ||
arch: [32, 64] | ||
include: | ||
- os: windows | ||
image: "cdrx/pyinstaller-windows" | ||
- os: linux | ||
image: "cdrx/pyinstaller-linux" | ||
- arch: 32 | ||
arch_code: "x86" | ||
image_tag: "python3-32bit" | ||
- arch: 64 | ||
arch_code: "x64" | ||
image_tag: "python3" | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get tag version | ||
run: echo "TAG_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
|
||
- name: Load release python requirements | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: release_dist_reqs | ||
|
||
- name: Build binary for ${{ matrix.os }} ${{ matrix.arch_code }} | ||
env: | ||
IMAGE: ${{ matrix.image }} | ||
IMAGE_TAG: ${{ matrix.image_tag }} | ||
run: docker run -v "$(pwd):/src/" ${IMAGE}:${IMAGE_TAG} | ||
|
||
- name: Make directory for bins | ||
run: mkdir dist_bin | ||
|
||
- name: Pack up binary for windows | ||
if: matrix.os == 'windows' | ||
env: | ||
BUILD_ARCH: ${{ matrix.arch_code }} | ||
run: zip -q -j dist_bin/bin_${{ env.PACKAGE_NAME }}_${TAG_VERSION}_win_${BUILD_ARCH}.zip ./dist/windows/${{ env.PACKAGE_NAME }}.exe | ||
|
||
- name: Pack up binary for linux | ||
if: matrix.os == 'linux' | ||
env: | ||
BUILD_ARCH: ${{ matrix.arch_code }} | ||
run: tar -zcvf dist_bin/bin_${{ env.PACKAGE_NAME }}_${TAG_VERSION}_linux_${BUILD_ARCH}.tar.gz -C ./dist/linux ${{ env.PACKAGE_NAME }} | ||
|
||
- name: Save release binaries for ${{ matrix.os }} ${{ matrix.arch_code }} | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: release_dist_bin_${{ matrix.os }}_${{ matrix.arch_code }} | ||
path: dist_bin | ||
|
||
release: | ||
if: github.event_name == 'push' || github.event.inputs.release == 'yes' | ||
needs: [build_binaries, build_binaries_mac] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Extract release changelog | ||
run: | | ||
sed "0,/### \[/d;/### \[/Q" CHANGELOG.md > release_changelog | ||
echo -n "**Full Changelog**: " >> release_changelog | ||
sed -n 's/### \[.*\](\(.*\)) (.*/\1/p' CHANGELOG.md | head -1 >> release_changelog | ||
- name: Load release python packages | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: release_dist_python | ||
path: dist | ||
|
||
- name: Load release binaries for linux x86 | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: release_dist_bin_linux_x86 | ||
path: dist | ||
|
||
- name: Load release binaries for linux x64 | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: release_dist_bin_linux_x64 | ||
path: dist | ||
|
||
- name: Load release binaries for windows x86 | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: release_dist_bin_windows_x86 | ||
path: dist | ||
|
||
- name: Load release binaries for windows x64 | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: release_dist_bin_windows_x64 | ||
path: dist | ||
|
||
- name: Load release binaries for macos x64 | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: release_dist_bin_macos_x64 | ||
path: dist | ||
|
||
- name: Create Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
bodyFile: release_changelog | ||
artifacts: "dist/*" | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
draft: false |
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,35 @@ | ||
name: release_pypi | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+" | ||
|
||
env: | ||
BUILD_PYTHON_VERSION: 3.9 | ||
BUILD_POETRY_VERSION: 1.1.11 | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ env.BUILD_PYTHON_VERSION }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ env.BUILD_PYTHON_VERSION }} | ||
|
||
- name: Set up Poetry ${{ env.BUILD_POETRY_VERSION }} | ||
uses: abatilo/actions-poetry@v2.0.0 | ||
with: | ||
poetry-version: ${{ env.BUILD_POETRY_VERSION }} | ||
|
||
- name: Build project for distribution | ||
run: poetry build | ||
|
||
- name: Publish to PyPI | ||
env: | ||
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} | ||
run: poetry publish |
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,61 @@ | ||
name: tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
tags-ignore: | ||
- '*.*' | ||
paths-ignore: | ||
- "*.md" | ||
- ".pre-commit-config.yaml" | ||
- "pyproject.toml" | ||
- "**/version.py" | ||
|
||
env: | ||
BUILD_POETRY_VERSION: 1.1.11 | ||
POETRY_VIRTUALENVS_CREATE: false | ||
PACKAGE_NAME: enex2notion | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
max-parallel: 4 | ||
matrix: | ||
python-version: [3.6, 3.7, 3.8, 3.9] | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Set up Poetry ${{ env.BUILD_POETRY_VERSION }} | ||
uses: abatilo/actions-poetry@v2.0.0 | ||
with: | ||
poetry-version: ${{ env.BUILD_POETRY_VERSION }} | ||
|
||
- name: Set up Poetry cache for Python dependencies | ||
uses: actions/cache@v2 | ||
if: startsWith(runner.os, 'Linux') | ||
with: | ||
path: ~/.cache/pypoetry | ||
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} | ||
restore-keys: ${{ runner.os }}-poetry- | ||
|
||
- name: Install dependencies | ||
run: | | ||
poetry install | ||
- name: Run tests | ||
env: | ||
NOTION_TEST_TOKEN: ${{ secrets.NOTION_TEST_TOKEN }} | ||
run: | | ||
poetry run pytest --cov-report=xml --cov=${{ env.PACKAGE_NAME }} tests/ | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v1 | ||
if: matrix.python-version == '3.9' |
Oops, something went wrong.