Skip to content

Commit

Permalink
Merge pull request sympy#21275 from oscarbenjamin/pr_release_script_ci
Browse files Browse the repository at this point in the history
maint(release): run release script in CI
  • Loading branch information
oscarbenjamin authored Apr 9, 2021
2 parents 081c6d4 + 28352d5 commit ed9a550
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 13 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# ------------------------------------------------------------------ #
# #
# SymPy CI script for Github Actions #
# #
# Run on the release branch and builds the release artifacts. #
# #
# ------------------------------------------------------------------ #

name: release
on:
push:
branches:
- 1.8
pull_request:
branches:
- 1.8
env:
release_branch: 1.8
release_version: 1.8

jobs:

# -------------------- Build artifacts --------------------------- #

build:

runs-on: ubuntu-20.04
steps:
# Check out with full git history for authors check:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Build release files
run: release/ci_release_script.sh ${{ env.release_version }}

- name: Store release files
uses: actions/upload-artifact@v2
with:
name: release_files
path: release-${{ env.release_version }}

# -------------------- Test installation ------------------------- #

test-install:
needs: [build]

runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9', 'pypy-3.6']

name: Python ${{ matrix.python-version }} test install
steps:
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Retrieve release files
uses: actions/download-artifact@v2
with:
name: release_files

- name: List files
run: ls -R

- name: Install wheel
run: pip install sympy-${{ env.release_version }}-py3-none-any.whl

- name: Run tests after install
run: python -c 'import sympy; sympy.test()'
10 changes: 7 additions & 3 deletions bin/authors_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@
if sys.version_info < (3, 6):
sys.exit("This script requires Python 3.6 or newer")

from subprocess import run, PIPE
from subprocess import check_output, PIPE
from distutils.version import LooseVersion
from collections import OrderedDict

def run(cmd):
return check_output(cmd, encoding='utf-8')

def red(text):
return "\033[31m%s\033[0m" % text

Expand All @@ -43,7 +46,8 @@ def green(text):

# check git version
minimal = '1.8.4.2'
git_ver = run(['git', '--version'], stdout=PIPE, encoding='utf-8').stdout[12:]
git_ver = run(['git', '--version'])[12:]

if LooseVersion(git_ver) < LooseVersion(minimal):
print(yellow("Please use a git version >= %s" % minimal))

Expand All @@ -61,7 +65,7 @@ def move(l, i1, i2, who):

# find who git knows ahout
git_command = ["git", "log", "--topo-order", "--reverse", "--format=%aN <%aE>"]
git_people = run(git_command, stdout=PIPE, encoding='utf-8').stdout.strip().split("\n")
git_people = run(git_command).strip().split("\n")

# remove duplicates, keeping the original order
git_people = list(OrderedDict.fromkeys(git_people))
Expand Down
13 changes: 3 additions & 10 deletions release/aptinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

set -o errexit

sudo add-apt-repository ppa:deadsnakes/ppa
sudo add-apt-repository -y ppa:deadsnakes/ppa
sudo apt update

sudo apt install\
sudo apt install -y\
antlr4\
libgfortran5\
python3-venv\
Expand All @@ -26,18 +26,11 @@ sudo apt install\
gfortran\
#

sudo apt install\
sudo apt install -y\
python3.6\
python3.6-venv\
python3.7\
python3.7-venv\
python3.9\
python3.9-venv\
# python3.8 is installed by default in 20.04

python3 -m venv release/venv_main
source release/venv_main/bin/activate

pip install -U pip wheel
pip install -r release/requirements.txt
pip install -e .
12 changes: 12 additions & 0 deletions release/ci_release_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

release/aptinstall.sh

python3 -m venv release/venv_main
source release/venv_main/bin/activate

pip install -U pip wheel
pip install -r release/requirements.txt
pip install -e .

python release/releasecheck.py $1 release-$1
2 changes: 2 additions & 0 deletions release/compare_tar_against_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def main(tarname, gitroot):
# Travis and CI
'.travis.yml',
'.github/workflows/runtests.yml',
'.github/workflows/release.yml',
'.ci/durations.json',
'.ci/generate_durations_log.sh',
'.ci/parse_durations_log.py',
Expand Down Expand Up @@ -134,6 +135,7 @@ def main(tarname, gitroot):
'release/test_install.py',
'release/sha256.py',
'release/authors.py',
'release/ci_release_script.sh',
# This is just a distribute version of setup.py. Used mainly for setup.py
# develop, which we don't care about in the release tarball
'setupegg.py',
Expand Down

0 comments on commit ed9a550

Please sign in to comment.