-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Eagerly add a GitHub action build while the canonical URL is still in BitBucket so that some custom actions can be created ahead of the switchover from BitBucket to GitHub.
- Loading branch information
1 parent
f66d3a6
commit ed9fbec
Showing
6 changed files
with
134 additions
and
3 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,7 @@ | ||
version: 2 | ||
updates: | ||
|
||
- package-ecosystem: github-actions | ||
directory: / | ||
schedule: | ||
interval: monthly |
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,18 @@ | ||
changelog: | ||
exclude: | ||
labels: | ||
- ignore-for-release | ||
authors: | ||
- dependabot | ||
categories: | ||
- title: Breaking Changes 🛠 | ||
labels: | ||
- semver-major | ||
- breaking-change | ||
- title: New Features 🎉 | ||
labels: | ||
- semver-minor | ||
- enhancement | ||
- title: Other Changes | ||
labels: | ||
- '*' |
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,47 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [main] | ||
tags: [v*] | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # fetch all history for setuptools_scm to be able to read tags | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.x | ||
|
||
- name: Install python dependencies | ||
run: pip install .[dev,build] | ||
|
||
- name: Run tests | ||
if: matrix.os != 'windows-latest' | ||
run: | | ||
# Set up git user for git command to work with tests | ||
git config --global user.name "tests" | ||
git config --global user.email "[email protected]" | ||
pytest -vv | ||
- name: Build python package | ||
run: python -m build | ||
|
||
- name: cx_Freeze | ||
run: | | ||
python setup_cxfreeze.py build | ||
python setup_cxfreeze.py finalize | ||
- uses: secondlife-3p/release-action@v1 | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
with: | ||
artifacts: dist/autobuild-*.zip | ||
allowUpdates: 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
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import platform | ||
import shutil | ||
from distutils.core import Command | ||
from pathlib import Path | ||
|
||
from cx_Freeze import Executable, setup | ||
from setuptools_scm import get_version | ||
|
||
ROOT_DIR = Path(__file__).parent.absolute() | ||
COPY_TO_ZIP = ["LICENSE"] | ||
SYSTEM_ALIASES = {"Darwin": "macos"} | ||
ARCH_ALIASES = {"64bit": "x64"} | ||
|
||
def get_system(): | ||
default_sys = platform.system() | ||
return SYSTEM_ALIASES.get(default_sys, default_sys).lower() | ||
|
||
|
||
def get_arch(): | ||
default_arch = platform.architecture()[0] | ||
return ARCH_ALIASES.get(default_arch, default_arch).lower() | ||
|
||
|
||
class FinalizeCommand(Command): | ||
description = "Prepare cx_Freeze build dirs and create a zip file" | ||
user_options = [] | ||
|
||
def initialize_options(self) -> None: | ||
pass | ||
|
||
def finalize_options(self) -> None: | ||
pass | ||
|
||
def run(self): | ||
version = get_version(ROOT_DIR) | ||
for path in (ROOT_DIR / "build").iterdir(): | ||
if path.name.startswith("exe.") and path.is_dir(): | ||
for to_copy in COPY_TO_ZIP: | ||
shutil.copy(ROOT_DIR / to_copy, path / to_copy) | ||
system = get_system() | ||
arch = get_arch() | ||
zip_path = ROOT_DIR / f"dist/autobuild-{system}-{arch}-v{version}" | ||
shutil.make_archive(zip_path, "zip", path) | ||
|
||
|
||
build_exe_options = { | ||
"packages": ["autobuild"], | ||
} | ||
|
||
autobuild = Executable("autobuild/autobuild_main.py", base=None, target_name="autobuild") | ||
|
||
setup( | ||
options={"build_exe": build_exe_options}, | ||
executables=[autobuild], | ||
cmdclass={"finalize": FinalizeCommand} | ||
) |