Skip to content

Commit ea207cc

Browse files
authored
Run CI on GitHub Actions (#413)
1 parent 5fcb15f commit ea207cc

File tree

15 files changed

+249
-241
lines changed

15 files changed

+249
-241
lines changed

.github/workflows/checks.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Checks
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
checks:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
include:
17+
- python-version: 3
18+
env:
19+
TOXENV: flake8
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v2
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
29+
- name: Run check
30+
env: ${{ matrix.env }}
31+
run: |
32+
pip install -U pip
33+
pip install -U tox
34+
tox
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Freeze, Release & Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
freeze:
13+
name: "Freeze: ${{ matrix.os }}"
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [ubuntu-latest, macos-latest, windows-latest]
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: 3.9
27+
28+
- name: Install tox
29+
run: pip install tox
30+
31+
- name: Build binary
32+
run: tox -e freeze
33+
34+
- name: Pack binary (Windows)
35+
if: ${{ runner.os == 'Windows' }}
36+
run: 7z a shub-Windows.zip dist_bin/shub.exe
37+
38+
- name: Pack binary (Linux/macOS)
39+
if: ${{ runner.os != 'Windows' }}
40+
run: tar -czvf shub-${{ runner.os }}.tar.gz dist_bin/shub
41+
42+
- name: Upload binary
43+
uses: actions/upload-artifact@v2
44+
with:
45+
name: shub-${{ runner.os }}
46+
path: |
47+
shub-${{ runner.os }}.tar.gz
48+
shub-${{ runner.os }}.zip
49+
50+
release:
51+
# if: startsWith(github.ref, 'refs/tags/v') # FIXME: uncomment before merging
52+
needs: freeze
53+
runs-on: ubuntu-latest
54+
55+
steps:
56+
- name: Download binaries
57+
uses: actions/download-artifact@v2
58+
with:
59+
path: binaries
60+
61+
- name: Display structure of downloaded files
62+
run: ls -R binaries
63+
64+
- name: Draft release
65+
uses: softprops/action-gh-release@v1
66+
with:
67+
draft: true
68+
files: binaries/**
69+
70+
publish:
71+
if: startsWith(github.ref, 'refs/tags/v')
72+
runs-on: ubuntu-latest
73+
74+
steps:
75+
- uses: actions/checkout@v2
76+
77+
- name: Set up Python
78+
uses: actions/setup-python@v2
79+
with:
80+
python-version: 3.9
81+
82+
- name: Publish to PyPI
83+
run: |
84+
pip install --upgrade pip
85+
pip install --upgrade setuptools wheel twine
86+
python setup.py sdist bdist_wheel
87+
export TWINE_USERNAME=__token__
88+
export TWINE_PASSWORD=${{ secrets.PYPI_TOKEN }}
89+
twine upload dist/*

.github/workflows/tests.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
tests-ubuntu:
13+
name: "Test: py${{ matrix.python-version }}, Ubuntu"
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
python-version: ["3.6", "3.7", "3.8", "3.9"]
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
28+
- name: Install tox
29+
run: pip install tox
30+
31+
- name: Run tests
32+
run: tox -e py
33+
34+
- name: Upload coverage report
35+
run: |
36+
curl -Os https://uploader.codecov.io/latest/linux/codecov
37+
chmod +x codecov
38+
./codecov
39+
40+
tests-macos:
41+
name: "Test: py${{ matrix.python-version }}, macOS"
42+
runs-on: macos-latest
43+
strategy:
44+
fail-fast: false
45+
matrix:
46+
python-version: ["3.6", "3.7", "3.8", "3.9"]
47+
48+
steps:
49+
- uses: actions/checkout@v2
50+
51+
- name: Set up Python ${{ matrix.python-version }}
52+
uses: actions/setup-python@v2
53+
with:
54+
python-version: ${{ matrix.python-version }}
55+
56+
- name: Install tox
57+
run: pip install tox
58+
59+
- name: Run tests
60+
run: tox -e py
61+
62+
tests-windows:
63+
name: "Test: py${{ matrix.python-version }}, Windows"
64+
runs-on: windows-latest
65+
strategy:
66+
fail-fast: false
67+
matrix:
68+
python-version: ["3.6", "3.7", "3.8", "3.9"]
69+
70+
steps:
71+
- uses: actions/checkout@v2
72+
73+
- name: Set up Python ${{ matrix.python-version }}
74+
uses: actions/setup-python@v2
75+
with:
76+
python-version: ${{ matrix.python-version }}
77+
78+
- name: Install tox
79+
run: pip install tox
80+
81+
- name: Run tests
82+
run: tox -e py

.travis.yml

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

README.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
Scrapinghub command line client
22
===============================
33

4+
.. image:: https://img.shields.io/pypi/v/shub.svg
5+
:target: https://pypi.python.org/pypi/shub
6+
:alt: PyPI Version
7+
8+
.. image:: https://github.com/scrapinghub/shub/actions/workflows/tests.yml/badge.svg
9+
:target: https://github.com/scrapinghub/shub/actions/workflows/tests.yml
10+
:alt: Tests
11+
12+
.. image:: https://img.shields.io/codecov/c/github/scrapinghub/shub/master.svg
13+
:target: https://codecov.io/github/scrapinghub/shub?branch=master
14+
:alt: Coverage report
15+
416
``shub`` is the Scrapinghub command line client. It allows you to deploy
517
projects or dependencies, schedule spiders, and retrieve scraped data or logs
618
without leaving the command line.
@@ -9,7 +21,7 @@ without leaving the command line.
921
Requirements
1022
------------
1123

12-
* Python 2.7+ or Python 3.5+
24+
* Python >= 3.6
1325

1426

1527
Installation
@@ -20,6 +32,9 @@ the Python Package Index::
2032

2133
pip install shub
2234

35+
Please note that if you are using Python < 3.6,
36+
you should pin `shub` to `2.13.0` or lower.
37+
2338
We also supply stand-alone binaries. You can find them in our `latest GitHub
2439
release`_.
2540

RELEASE.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Release procedure for shub
22
==========================
33

4-
The Travis build is configured to release shub to PyPI whenever a new tag is
5-
committed.
4+
The GitHub Actions build is configured to release `shub` to PyPI whenever
5+
a new tag (starting with `v`, e.g. `v2.13.0`) is committed.
66

77
The steps to do a release are:
88

@@ -11,7 +11,7 @@ The steps to do a release are:
1111
2. Make sure you're at the tip of master, and then run:
1212

1313
bumpversion VERSION_PART
14-
14+
1515
In place of `VERSION_PART`, use one of `patch`, `minor` or `major`, meaning
1616
the part of the version number to be updated.
1717

@@ -28,7 +28,5 @@ The steps to do a release are:
2828

2929
https://github.com/scrapinghub/shub/releases
3030

31-
Travis and AppVeyor will automatically create a release draft and attach the
32-
binaries they built to it. Sometimes their timing leads to them creating
33-
multiple release drafts, in which case we need to combine them such that we
34-
have one release that has all three (Linux, OSX, Windows) binaries.
31+
The GitHub action will automatically create a release draft and attach the
32+
platform-specific binaries (built with the `freeze` tox environment) to it.

0 commit comments

Comments
 (0)