This repository has been archived by the owner on Aug 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Updated builders to use GitHub Actions
- Loading branch information
Showing
6 changed files
with
93 additions
and
124 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,72 @@ | ||
name: Build | ||
on: pull_request # TODO: Only run on workflow_dispatch | ||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] # TODO: Run all [macos-12, ubuntu-latest, windows-latest] | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Check-out repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: 'true' | ||
fetch-tags: 'true' | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
cache: 'pip' | ||
cache-dependency-path: | | ||
**/requirements-build.txt | ||
- name: Install Dependencies | ||
run: | | ||
pip install --upgrade -r requirements-build.txt | ||
- name: Setup npm | ||
uses: actions/setup-node@v4 | ||
- name: Build npm | ||
run: | | ||
cd src/tribler/ui/ | ||
npm install | ||
npm run build | ||
- name: Determine tag | ||
run: | | ||
git fetch --tags | ||
git for-each-ref --count=1 --sort=-creatordate --format '%(refname)' refs/tags > raw_tag.txt | ||
echo "GITHUB_TAG=$(git name-rev --tags --name-only $(cat raw_tag.txt))" >> $GITHUB_ENV | ||
- name: Prepare version | ||
shell: python | ||
env: | ||
GITHUB_REF: ${{ vars.GITHUB_SHA }} | ||
GITHUB_TAG: ${{ env.GITHUB_TAG }} | ||
run: | | ||
from os import getenv | ||
from time import ctime | ||
print(f'Writing version ({getenv("GITHUB_SHA")}, {getenv("GITHUB_TAG")})') | ||
with open("src/tribler/core/version.py", "w") as version_py: | ||
version_py.write(f'version_id = "{getenv("GITHUB_TAG")}"\n') | ||
version_py.write(f'build_date = "{ctime()}"\n') | ||
version_py.write(f'commit_id = "{getenv("GITHUB_SHA")}"\n') | ||
- name: Build Executables (Ubuntu) | ||
if: matrix.os == 'ubuntu-latest' | ||
run: | | ||
sudo apt-get install -y --allow-downgrades alien cpio=2.13+dfsg-7 devscripts fakeroot libgirepository1.0-dev rpm libayatana-appindicator3-dev gir1.2-ayatanaappindicator3-0.1 gir1.2-appindicator3-0.1 python3-gi libgirepository1.0-dev libcairo2-dev | ||
./build/debian/makedist_debian.sh | ||
- name: Build Executables (MacOS-12) | ||
if: matrix.os == 'macos-12' | ||
run: | | ||
./build/mac/makedist_macos.sh | ||
- name: Build Executables (Windows) | ||
if: matrix.os == 'windows-latest' | ||
run: | | ||
./build/win/makedist_win.bat | ||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ runner.os }} Build | ||
path: | | ||
build/debian/*.deb | ||
dist/* | ||
# ^^^^^^ DEBUG CRASH |
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,37 +1,12 @@ | ||
import logging | ||
import time | ||
import xml.etree.ElementTree as xml | ||
from argparse import ArgumentParser | ||
from pathlib import Path | ||
|
||
import defusedxml.ElementTree as defxml | ||
|
||
logger = logging.getLogger(__name__) | ||
logging.basicConfig(level=logging.INFO) | ||
|
||
|
||
def parse_arguments(): | ||
parser = ArgumentParser(description='Update Tribler metainfo.xml') | ||
parser.add_argument('-r', '--repo', type=str, help='path to a repository folder', default='.') | ||
return parser.parse_args() | ||
|
||
|
||
if __name__ == '__main__': | ||
arguments = parse_arguments() | ||
|
||
version = Path('.TriblerVersion').read_text().lstrip('v').rstrip('\n') | ||
|
||
release_info = { | ||
'version': version, | ||
'date': time.strftime("%Y-%m-%d", time.localtime()) | ||
} | ||
|
||
logger.info(f'Release info: {release_info}') | ||
metainfo_xml = Path(arguments.repo) / 'build/debian/tribler/usr/share/metainfo/org.tribler.Tribler.metainfo.xml' | ||
|
||
xml_dom = defxml.parse(metainfo_xml) | ||
releases = xml_dom.getroot().find('releases') | ||
release = xml.SubElement(releases, 'release', release_info) | ||
|
||
xml_dom.write(metainfo_xml, encoding='utf-8', xml_declaration=True) | ||
logger.info(f'Content of metainfo.xml: {metainfo_xml.read_text()}') | ||
from os import getenv | ||
from time import localtime, strftime | ||
from xml.etree.ElementTree import SubElement, parse | ||
|
||
if __name__ == "__main__": | ||
metainfo_xml = "build/debian/tribler/usr/share/metainfo/org.tribler.Tribler.metainfo.xml" | ||
tree = parse(metainfo_xml) | ||
root = tree.getroot() | ||
releases_tag = root.find("releases") | ||
releases_tag.append(SubElement(releases_tag, "release", {"version": getenv("GITHUB_TAG"), | ||
"date": strftime("%Y-%m-%d", localtime())})) | ||
tree.write(metainfo_xml, encoding="utf-8", xml_declaration=True) |
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
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,19 +1,7 @@ | ||
# These are specific versions of the packages that are used for making the build work. | ||
# These are installed before other dependencies. | ||
PyQt5==5.15.10 | ||
PyQt5-sip==12.13.0 | ||
pyqtgraph==0.13.3 | ||
|
||
-r requirements.txt | ||
|
||
cx_Freeze==7.0.0; sys_platform != 'darwin' | ||
PyInstaller==6.6.0; sys_platform == 'darwin' | ||
|
||
setuptools==65.5.1; sys_platform == 'darwin' | ||
text-unidecode==1.3; sys_platform == 'darwin' | ||
|
||
defusedxml==0.7.1; sys_platform == 'linux2' or sys_platform == 'linux' | ||
markupsafe==2.0.1; sys_platform == 'linux2' or sys_platform == 'linux' | ||
PyGObject==3.44.1; sys_platform == 'linux2' or sys_platform == 'linux' | ||
cx_Freeze; sys_platform != 'darwin' | ||
PyInstaller; sys_platform == 'darwin' | ||
|
||
requests==2.31.0 | ||
setuptools | ||
requests |