Skip to content

Commit 7dfc2d9

Browse files
committed
Add tools to do production builds as a part of CI.
1 parent 6e0d4a1 commit 7dfc2d9

File tree

4 files changed

+107
-90
lines changed

4 files changed

+107
-90
lines changed

.github/workflows/publish.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Publish support package
2+
3+
on:
4+
release:
5+
types: published
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Set up Python environment
13+
uses: actions/setup-python@v1
14+
with:
15+
python-version: "3.X"
16+
- name: Set build variables
17+
env:
18+
TAG_NAME: ${{ github.ref }}
19+
run: |
20+
export TAG=$(basename $TAG_NAME)
21+
echo "TAG=${TAG}"
22+
export TAG_VERSION="${TAG%-*}"
23+
export TAG_BUILD="${TAG#*-}"
24+
echo "PY_VERSION=${TAG_VERSION}"
25+
echo "BUILD_NUMBER=${TAG_BUILD}"
26+
echo "::set-env name=TAG::${TAG}"
27+
echo "::set-env name=PY_VERSION::${TAG_VERSION}"
28+
echo "::set-env name=BUILD_NUMBER::${TAG_BUILD}"
29+
- name: Update Release Asset to S3
30+
env:
31+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
32+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
33+
run: |
34+
python -m pip install -U pip
35+
python -m pip install -U setuptools
36+
python -m pip install awscli
37+
# macOS build
38+
curl -o macOS-artefact.tar.gz -L https://github.com/beeware/Python-Apple-support/releases/download/${{ env.TAG }}/Python-${{ env.PY_VERSION }}-macOS-support.${{ env.BUILD_NUMBER }}.tar.gz
39+
aws s3 cp macOS-artefact.tar.gz s3://briefcase-support/python/${{ env.PY_VERSION }}/macOS/Python-${{ env.PY_VERSION }}-macOS-support.${{ env.BUILD_NUMBER }}.tar.gz
40+
# iOS build
41+
curl -o iOS-artefact.tar.gz -L https://github.com/beeware/Python-Apple-support/releases/download/${{ env.TAG }}/Python-${{ env.PY_VERSION }}-iOS-support.${{ env.BUILD_NUMBER }}.tar.gz
42+
aws s3 cp iOS-artefact.tar.gz s3://briefcase-support/python/${{ env.PY_VERSION }}/iOS/Python-${{ env.PY_VERSION }}-iOS-support.${{ env.BUILD_NUMBER }}.tar.gz
43+
# tvOS build
44+
curl -o tvOS-artefact.tar.gz -L https://github.com/beeware/Python-Apple-support/releases/download/${{ env.TAG }}/Python-${{ env.PY_VERSION }}-tvOS-support.${{ env.BUILD_NUMBER }}.tar.gz
45+
aws s3 cp tvOS-artefact.tar.gz s3://briefcase-support/python/${{ env.PY_VERSION }}/tvOS/Python-${{ env.PY_VERSION }}-tvOS-support.${{ env.BUILD_NUMBER }}.tar.gz
46+
# watchOS build
47+
curl -o watchOS-artefact.tar.gz -L https://github.com/beeware/Python-Apple-support/releases/download/${{ env.TAG }}/Python-${{ env.PY_VERSION }}-watchOS-support.${{ env.BUILD_NUMBER }}.tar.gz
48+
aws s3 cp watchOS-artefact.tar.gz s3://briefcase-support/python/${{ env.PY_VERSION }}/watchOS/Python-${{ env.PY_VERSION }}-watchOS-support.${{ env.BUILD_NUMBER }}.tar.gz

.github/workflows/release.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# This is the DEV workflow.
2+
# Run this Action on creating a new tag matching "<version>-b<build>"
3+
# e.g., 3.7-b1
4+
name: Build support package
5+
on:
6+
push:
7+
tags:
8+
- '*-b*'
9+
10+
jobs:
11+
build:
12+
runs-on: macOS-latest
13+
strategy:
14+
max-parallel: 4
15+
matrix:
16+
target: ['macOS', 'iOS', 'tvOS', 'watchOS']
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set build variables
20+
env:
21+
TAG_NAME: ${{ github.ref }}
22+
run: |
23+
export TAG=$(basename $TAG_NAME)
24+
echo "TAG=${TAG}"
25+
export TAG_VERSION="${TAG%-*}"
26+
export TAG_BUILD="${TAG#*-}"
27+
echo "PY_VERSION=${TAG_VERSION}"
28+
echo "BUILD_NUMBER=${TAG_BUILD}"
29+
echo "::set-env name=TAG::${TAG}"
30+
echo "::set-env name=PY_VERSION::${TAG_VERSION}"
31+
echo "::set-env name=BUILD_NUMBER::${TAG_BUILD}"
32+
- name: Build project
33+
env:
34+
BUILD_NUMBER: ${{ env.BUILD_NUMBER }}
35+
run: make -e ${{ matrix.target }}
36+
- name: Create Release
37+
id: create_release
38+
uses: actions/create-release@v1
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
with:
42+
tag_name: ${{ github.ref }}
43+
release_name: ${{ github.ref }}
44+
draft: true
45+
prerelease: false
46+
- name: Upload Release Asset to Github
47+
uses: actions/upload-release-asset@v1
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
with:
51+
upload_url: ${{ steps.create_release.outputs.upload_url }}
52+
asset_path: ./dist/Python-${{ env.PY_VERSION }}-${{ matrix.target }}-support.${{ env.BUILD_NUMBER }}.tar.gz
53+
asset_name: Python-${{ env.PY_VERSION }}-${{ matrix.target }}-support.${{ env.BUILD_NUMBER }}.tar.gz
54+
asset_content_type: application/gzip

Makefile

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# Current director
2626
PROJECT_DIR=$(shell pwd)
2727

28-
BUILD_NUMBER=1
28+
BUILD_NUMBER=custom
2929

3030
MACOSX_DEPLOYMENT_TARGET=10.8
3131

@@ -87,9 +87,6 @@ update-patch:
8787
if [ -z "$(PYTHON_REPO_DIR)" ]; then echo "\n\nPYTHON_REPO_DIR must be set to the root of your Python github checkout\n\n"; fi
8888
cd $(PYTHON_REPO_DIR) && git diff -D v$(PYTHON_VERSION) $(PYTHON_VER) | filterdiff -X $(PROJECT_DIR)/patch/Python/diff-exclude.lst -p 1 --clean > $(PROJECT_DIR)/patch/Python/Python.patch
8989

90-
upload: $(foreach os,$(OS),$(os))
91-
python tools/upload.py b$(BUILD_NUMBER)
92-
9390
###########################################################################
9491
# OpenSSL
9592
# These build instructions adapted from the scripts developed by
@@ -327,12 +324,12 @@ XZ_FRAMEWORK-$1=build/$1/Support/XZ
327324
PYTHON_FRAMEWORK-$1=build/$1/Support/Python
328325
PYTHON_RESOURCES-$1=$$(PYTHON_FRAMEWORK-$1)/Resources
329326

330-
$1: dist/Python-$(PYTHON_VER)-$1-support.b$(BUILD_NUMBER).tar.gz
327+
$1: dist/Python-$(PYTHON_VER)-$1-support.$(BUILD_NUMBER).tar.gz
331328

332329
clean-$1:
333330
rm -rf build/$1
334331

335-
dist/Python-$(PYTHON_VER)-$1-support.b$(BUILD_NUMBER).tar.gz: $$(BZIP2_FRAMEWORK-$1) $$(XZ_FRAMEWORK-$1) $$(OPENSSL_FRAMEWORK-$1) $$(PYTHON_FRAMEWORK-$1)
332+
dist/Python-$(PYTHON_VER)-$1-support.$(BUILD_NUMBER).tar.gz: $$(BZIP2_FRAMEWORK-$1) $$(XZ_FRAMEWORK-$1) $$(OPENSSL_FRAMEWORK-$1) $$(PYTHON_FRAMEWORK-$1)
336333
mkdir -p dist
337334
echo "Python version: $(PYTHON_VERSION) " > build/$1/Support/VERSIONS
338335
echo "Build: $(BUILD_NUMBER)" >> build/$1/Support/VERSIONS
@@ -346,7 +343,7 @@ ifeq ($1,macOS)
346343
tar zcvf $$@ -X patch/Python/exclude.macOS -C build/$1/python `ls -A build/$1/python`
347344
else
348345
# Build a "full" tarball with all content for test purposes
349-
tar zcvf dist/Python-$(PYTHON_VER)-$1-support.test-b$(BUILD_NUMBER).tar.gz -X patch/Python/test-exclude.embedded -C build/$1/Support `ls -A build/$1/Support`
346+
tar zcvf dist/Python-$(PYTHON_VER)-$1-support.test-$(BUILD_NUMBER).tar.gz -X patch/Python/test-exclude.embedded -C build/$1/Support `ls -A build/$1/Support`
350347
# Build a distributable tarball
351348
tar zcvf $$@ -X patch/Python/exclude.embedded -C build/$1/Support `ls -A build/$1/Support`
352349
endif
@@ -413,7 +410,7 @@ build/$1/xz/lib/liblzma.a: $$(foreach target,$$(TARGETS-$1),$$(XZ_DIR-$$(target)
413410

414411
$1: Python-$1
415412

416-
Python-$1: dist/Python-$(PYTHON_VER)-$1-support.b$(BUILD_NUMBER).tar.gz
413+
Python-$1: dist/Python-$(PYTHON_VER)-$1-support.$(BUILD_NUMBER).tar.gz
417414

418415
# Build Python
419416
$$(PYTHON_FRAMEWORK-$1): build/$1/libpython$(PYTHON_VER).a $$(foreach target,$$(TARGETS-$1),build/$1/$$(pyconfig.h-$$(target)))

tools/upload.py

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)