Skip to content

Merge pull request #23 from elastic/renovate/actions-upload-artifact-… #61

Merge pull request #23 from elastic/renovate/actions-upload-artifact-…

Merge pull request #23 from elastic/renovate/actions-upload-artifact-… #61

Workflow file for this run

name: Main
on:
push:
tags: "v[0-9]+.[0-9]+.[0-9]+"
branches: "main"
pull_request:
branches: "*"
env:
HOME_REPO: "elastic/faker-datasets"
jobs:
unit-tests:
name: Unit tests (${{ matrix.os }}/py${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
os: ["ubuntu-latest", "macos-latest"]
steps:
- name: Checkout code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
- name: Setup Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: make prereq
- name: Lint code
run: make lint
- name: Run tests
run: make test V=2
package-build:
name: Package build (${{ matrix.os }}/py${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
os: ["ubuntu-latest", "macos-latest"]
steps:
- name: Checkout code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
- name: Setup Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: make prereq
- name: Build package
run: make pkg-build
- name: Upload artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
with:
name: python-package-${{ matrix.python-version }}-${{ matrix.os }}
path: dist/*
package-tests:
name: Package tests (${{ matrix.os }}/py${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
needs: package-build
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
os: ["ubuntu-latest", "macos-latest"]
steps:
- name: Checkout code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
path: code
- name: Setup Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5
with:
python-version: ${{ matrix.python-version }}
- name: Download artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: python-package-${{ matrix.python-version }}-${{ matrix.os }}
path: dist
- name: Install package
run: make -f code/Makefile pkg-install
publish:
name: Publish
runs-on: ubuntu-latest
needs:
- unit-tests
- package-tests
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- name: Setup Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5
with:
python-version: "3.8"
- name: Download artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: python-package-3.8-ubuntu-latest
path: dist
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@f7600683efdcb7656dec5b29656edb7bc586e597 # v1.10.3
if: github.repository != env.HOME_REPO
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
print_hash: true
repository_url: https://test.pypi.org/legacy/
skip_existing: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@f7600683efdcb7656dec5b29656edb7bc586e597 # v1.10.3
if: github.repository == env.HOME_REPO
with:
password: ${{ secrets.PYPI_API_TOKEN }}
print_hash: true