Skip to content

Commit 67fe4ee

Browse files
Migrate from Travis CI to Github Action
2 parents 1b0c70d + df3e47f commit 67fe4ee

File tree

6 files changed

+135
-29
lines changed

6 files changed

+135
-29
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: 'Build Python Package'
2+
description: 'Sets up Python, builds package, and validates it'
3+
inputs:
4+
python-version:
5+
description: 'Python version to use'
6+
required: false
7+
default: '3.8'
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
- name: Set up Python ${{ inputs.python-version }}
13+
uses: actions/setup-python@v5
14+
with:
15+
python-version: ${{ inputs.python-version }}
16+
17+
- name: Upgrade pip and setuptools
18+
shell: bash
19+
run: python -m pip install --upgrade pip setuptools
20+
21+
- name: Install dependencies
22+
shell: bash
23+
run: pip install twine wheel
24+
25+
- name: Setup deployment
26+
shell: bash
27+
run: python setup.py sdist bdist_wheel
28+
29+
- name: Validate deployment
30+
shell: bash
31+
run: twine check dist/*

.github/workflows/release.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
release-test:
10+
runs-on: ubuntu-22.04
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- uses: ./.github/actions/build-package
15+
16+
- name: Set up a fresh environment and run tests
17+
run: |
18+
python -m venv venv
19+
source venv/bin/activate
20+
pip install dist/*.tar.gz
21+
pip install dist/*.whl
22+
pip install -e .[test]
23+
pytest
24+
25+
release:
26+
runs-on: ubuntu-22.04
27+
needs: release-test
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- name: Set up Python 3.8
33+
uses: actions/setup-python@v5
34+
with:
35+
python-version: 3.8
36+
37+
- name: Compare tags
38+
run: |
39+
PKG_VERSION=`grep '__version__' mapbox_tilesets/__init__.py | sed -E "s/^.*['\"](.*)['\"].*$/\1/"`
40+
echo "Checking that package version [v$PKG_VERSION] matches release tag [${{ github.ref_name }}]"
41+
[ "${{ github.ref_type }}" = "tag" ] && [ "${{ github.ref_name }}" = "v$PKG_VERSION" ]
42+
43+
- uses: ./.github/actions/build-package
44+
45+
- name: Run deployment
46+
run:
47+
twine upload dist/* -r pypi -u __token__ -p ${{ secrets.PYPI_PASSWORD }}

.github/workflows/test.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Unit test
2+
3+
on:
4+
push:
5+
branches: ["**"]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
strategy:
11+
matrix:
12+
include:
13+
- python-version: 3.8
14+
os: ubuntu-22.04
15+
- python-version: 3.9
16+
os: ubuntu-22.04
17+
18+
runs-on: ${{ matrix.os }}
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip setuptools
31+
pip install "importlib-metadata==4.8.3"
32+
pip install -r requirements.txt -e .[test]
33+
34+
- name: Show Python and pytest versions
35+
run: |
36+
python --version
37+
pytest --version
38+
39+
- name: Run pre-commit checks
40+
run: pre-commit run --all-files
41+
42+
- name: Run tests with coverage
43+
run: pytest --cov --cov-config=.coveragerc --cov-report=xml
44+
45+
- name: List all files in current directory
46+
run: ls -la
47+
48+
- name: Upload coverage to GitHub (optional, internal)
49+
if: matrix.python-version == '3.8'
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: coverage-report
53+
path: coverage.xml

.travis.yml

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

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,16 @@ After which you can add these changes and commit again. Note that failing pre-co
5454

5555
## Release process
5656

57-
Releases to PyPi are handled via TravisCI and GitHub tags. Once changes have been merged to master:
57+
Releases to PyPi are handled via Github Actions and GitHub tags. Once changes have been merged to master:
5858

5959
1. Update the version in mapbox_tilesets/__init__.py
6060
2. Update the changelog
6161
3. Commit changes to **your branch**. For example `git commit -am '0.2.0' && git push origin HEAD`
6262
4. Get a review and merge your changes to master.
6363
5. Get the latest changes locally from master `git checkout master && git pull origin master`
6464
6. Tag on GitHub with `git tag` and push tags. For example `git tag -a v0.2.0 -m 'v0.2.0' && git push --tags`
65-
7. Watch for tag build on travis at https://travis-ci.com/github/mapbox/tilesets-cli/builds
66-
8. Once travis completes successfully, look for the release at https://pypi.org/project/mapbox-tilesets/#history
65+
7. Watch for tag build on Github Actions at https://github.com/mapbox/tilesets-cli/actions
66+
8. Once Github Actions completes successfully, look for the release at https://pypi.org/project/mapbox-tilesets/#history
6767

6868
## Tests
6969

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# tilesets-cli
22

3-
[![Build Status](https://travis-ci.com/mapbox/tilesets-cli.svg?token=wqR3RcWUEprcQ1ttsgiP&branch=master)](https://travis-ci.com/mapbox/tilesets-cli) [![codecov](https://codecov.io/gh/mapbox/tilesets-cli/branch/master/graph/badge.svg?token=YBTKyc2o3j)](https://codecov.io/gh/mapbox/tilesets-cli)
3+
[![Build Status](https://github.com/mapbox/tilesets-cli/actions/workflows/release.yaml/badge.svg)](https://github.com/mapbox/tilesets-cli/actions/workflows/release.yaml) [![codecov](https://codecov.io/gh/mapbox/tilesets-cli/branch/master/graph/badge.svg?token=YBTKyc2o3j)](https://codecov.io/gh/mapbox/tilesets-cli)
44

55
CLI for interacting with and preparing data for the [Mapbox Tiling Service](https://docs.mapbox.com/mapbox-tiling-service/overview/).
66

0 commit comments

Comments
 (0)