forked from iterative/dvc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: separate building and packaging (iterative#5675)
* build: separate pyinstaller and fpm/innosetup * gha: upload deb/rpm/osxpkg/exe artifacts * build: dynamically generate dvc version
- Loading branch information
Showing
20 changed files
with
294 additions
and
217 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 |
---|---|---|
|
@@ -6,7 +6,7 @@ on: | |
release: | ||
types: [released, prereleased] | ||
jobs: | ||
linux: | ||
deb: | ||
runs-on: ubuntu-16.04 | ||
steps: | ||
- uses: actions/[email protected] | ||
|
@@ -18,29 +18,63 @@ jobs: | |
uses: actions/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.4 | ||
- name: Build | ||
run: ./scripts/build_posix.sh | ||
- name: Install deps | ||
run: | | ||
pip install .[all] | ||
pip install -r scripts/build-requirements.txt | ||
gem install --no-document fpm | ||
- name: Build deb | ||
run: python scripts/build.py deb | ||
- name: Upload deb artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
path: scripts/fpm/dvc*.deb | ||
if-no-files-found: error | ||
- name: Publish deb | ||
if: github.event_name == 'release' | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: dvc_${{ github.event.release.tag_name }}_amd64.deb | ||
asset_path: scripts/fpm/dvc_${{ github.event.release.tag_name }}_amd64.deb | ||
asset_name: dvc_${{ github.event.release.tag_name }}_amd64.deb | ||
asset_content_type: binary/octet-stream | ||
rpm: | ||
runs-on: ubuntu-16.04 | ||
steps: | ||
- uses: actions/[email protected] | ||
- name: Set up Python 3.7 | ||
uses: actions/[email protected] | ||
with: | ||
python-version: 3.7 | ||
- name: Set up Ruby 2.4 | ||
uses: actions/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.4 | ||
- name: Install deps | ||
run: | | ||
pip install .[all] | ||
pip install -r scripts/build-requirements.txt | ||
gem install --no-document fpm | ||
- name: Build rpm | ||
run: python scripts/build.py rpm | ||
- name: Upload rpm artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
path: scripts/fpm/dvc*.rpm | ||
if-no-files-found: error | ||
- name: Publish rpm | ||
if: github.event_name == 'release' | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: dvc-${{ github.event.release.tag_name }}-1.x86_64.rpm | ||
asset_path: scripts/fpm/dvc-${{ github.event.release.tag_name }}-1.x86_64.rpm | ||
asset_name: dvc-${{ github.event.release.tag_name }}-1.x86_64.rpm | ||
asset_content_type: binary/octet-stream | ||
mac: | ||
osxpkg: | ||
runs-on: macos-10.15 | ||
steps: | ||
- uses: actions/[email protected] | ||
|
@@ -52,40 +86,62 @@ jobs: | |
uses: actions/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.4 | ||
- name: Install deps | ||
run: | | ||
pip install .[all] | ||
pip install -r scripts/build-requirements.txt | ||
gem install --no-document fpm | ||
- name: Build | ||
run: ./scripts/build_posix.sh | ||
run: python scripts/build.py osxpkg | ||
- name: Upload osxpkg artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
path: scripts/fpm/dvc*.pkg | ||
if-no-files-found: error | ||
- name: Publish | ||
if: github.event_name == 'release' | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: dvc-${{ github.event.release.tag_name }}.pkg | ||
asset_path: scripts/fpm/dvc-${{ github.event.release.tag_name }}.pkg | ||
asset_name: dvc-${{ github.event.release.tag_name }}.pkg | ||
asset_content_type: binary/octet-stream | ||
windows: | ||
exe: | ||
runs-on: windows-2019 | ||
steps: | ||
- uses: actions/[email protected] | ||
- name: Set up Python 3.7 | ||
uses: actions/[email protected] | ||
with: | ||
python-version: 3.7 | ||
- name: Install deps | ||
run: | | ||
pip install .[all] | ||
pip install -r scripts/build-requirements.txt | ||
- name: Pull images | ||
run: | | ||
dvc pull | ||
- name: Build | ||
run: scripts\build_windows.cmd | ||
run: python scripts\build.py exe | ||
shell: cmd | ||
- name: Upload exe artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
path: scripts/innosetup/dvc*.exe | ||
if-no-files-found: error | ||
- name: Publish | ||
if: github.event_name == 'release' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
uses: actions/[email protected] | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: dvc-${{ github.event.release.tag_name }}.exe | ||
asset_path: scripts/innosetup/dvc-${{ github.event.release.tag_name }}.exe | ||
asset_name: dvc-${{ github.event.release.tag_name }}.exe | ||
asset_content_type: binary/octet-stream | ||
python: | ||
pip: | ||
runs-on: ubuntu-16.04 | ||
steps: | ||
- uses: actions/[email protected] | ||
|
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,49 @@ | ||
import argparse | ||
import importlib | ||
import pathlib | ||
import textwrap | ||
from subprocess import STDOUT, check_call | ||
|
||
path = pathlib.Path(__file__).parent.absolute() | ||
dvc = path.parent / "dvc" | ||
pyinstaller = path / "pyinstaller" | ||
innosetup = path / "innosetup" | ||
fpm = path / "fpm" | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument( | ||
"pkg", choices=["deb", "rpm", "osxpkg", "exe"], help="package type" | ||
) | ||
args = parser.parse_args() | ||
|
||
(dvc / "utils" / "build.py").write_text(f'PKG = "{args.pkg}"') | ||
|
||
# Autogenerate version, similar to what we do in setup.py | ||
spec = importlib.util.spec_from_file_location( | ||
"dvc.version", dvc / "version.py" | ||
) | ||
dvc_version = importlib.util.module_from_spec(spec) | ||
spec.loader.exec_module(dvc_version) | ||
version = dvc_version.__version__ | ||
|
||
(dvc / "version.py").write_text( | ||
textwrap.dedent( | ||
f"""\ | ||
# AUTOGENERATED at build time by scripts/build.py | ||
__version__ = "{version}" | ||
""" | ||
) | ||
) | ||
|
||
check_call( | ||
["python", "build.py"], cwd=pyinstaller, stderr=STDOUT, | ||
) | ||
|
||
if args.pkg == "exe": | ||
check_call( | ||
["python", "build.py"], cwd=innosetup, stderr=STDOUT, | ||
) | ||
else: | ||
check_call( | ||
["python", "build.py", args.pkg], cwd=fpm, stderr=STDOUT, | ||
) |
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,4 @@ | ||
/build | ||
/*.deb | ||
/*.rpm | ||
/*.pkg |
Oops, something went wrong.