Adds the MaxMind geoip app #927
Workflow file for this run
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
name: CI | |
on: [push] | |
env: | |
CACHE_BUST_ITER: 0 | |
jobs: | |
tests: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
# Service containers to run | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
# Maps tcp port 5432 on service container to the host | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # fetch all history | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Apt update | |
run: sudo apt-get update | |
- name: Apt install | |
run: sudo apt-get install -y libxmlsec1-dev | |
- name: Initialize Pants | |
uses: pantsbuild/actions/init-pants@7151afe1e66338457f7f65a894bc12a2d8f9cab7 | |
with: | |
# cache0 makes it easy to bust the cache if needed | |
gha-cache-key: cache-${{ env.CACHE_BUST_ITER }}-py${{ matrix.python_version }} | |
named-caches-hash: ${{ hashFiles('build-support/lockfiles/*.lockfile') }} | |
- name: Prune pants cache | |
run: bash ./.github/workflows/scripts/prune_pants_cache.sh | |
- name: Lints | |
run: 'pants lint ::' | |
# - name: Typecheck | |
# run: 'pants typecheck ::' | |
- name: Tests | |
run: 'pants test ::' | |
- name: Changelog | |
run: 'pants ol-project changelog check' | |
# - name: Upload coverage to CodeCov | |
# uses: codecov/codecov-action@v1 | |
# with: | |
# directory: ${{ matrix.app-name }}/coverage/ | |
# flags: ${{ matrix.app-name }} | |
release: | |
needs: tests | |
runs-on: ubuntu-20.04 | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Initialize Pants | |
uses: pantsbuild/actions/init-pants@7151afe1e66338457f7f65a894bc12a2d8f9cab7 | |
with: | |
# cache0 makes it easy to bust the cache if needed | |
gha-cache-key: cache-${{ env.CACHE_BUST_ITER }}-py${{ matrix.python_version }} | |
named-caches-hash: ${{ hashFiles('build-support/lockfiles/*.lockfile') }} | |
# extract the app name out of the tag's ref value | |
- id: get-app-name | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const appName = context.ref.match(/refs\/tags\/([a-z\-]+)\/v\S+$/)[1] | |
core.setOutput('app-name', appName) | |
core.setOutput('app-package', appName.replace("mitol-django-", "").replace(/-/g, "_")) | |
- name: Build | |
run: pants package "src/mitol/${{steps.get-app-name.outputs.app-package}}:" | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} |