Merge pull request #3 from memfault/sync_fork_v050 #6
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: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
tags: | |
- "v*" | |
env: | |
PYTHON_VERSION: "3.8" | |
POETRY_VERSION: "1.5" | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- run: pip install poetry==${{ env.POETRY_VERSION }} | |
- run: poetry install | |
- run: poetry run black --check axiom tests examples | |
- run: poetry run pylint -E axiom tests examples | |
test-integration: | |
name: Test Integration | |
runs-on: ubuntu-latest | |
# run integration tests on PRs originating in the upstream repo (non-forks only) | |
if: github.repository == 'axiomhq/axiom-py' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) | |
needs: lint | |
strategy: | |
fail-fast: true | |
max-parallel: 1 | |
matrix: | |
python: ["3.8", "3.9", "3.10", "3.11"] | |
environment: | |
- development | |
- staging | |
include: | |
- environment: development | |
url: TESTING_DEV_API_URL | |
token: TESTING_DEV_TOKEN | |
org_id: TESTING_DEV_ORG_ID | |
- environment: staging | |
url: TESTING_STAGING_API_URL | |
token: TESTING_STAGING_TOKEN | |
org_id: TESTING_STAGING_ORG_ID | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- run: pip install poetry==${{ env.POETRY_VERSION }} | |
- run: poetry install | |
- run: poetry run python -m pytest | |
env: | |
AXIOM_URL: ${{ secrets[matrix.url] }} | |
AXIOM_TOKEN: ${{ secrets[matrix.token] }} | |
AXIOM_ORG_ID: ${{ secrets[matrix.org_id] }} | |
publish: | |
name: Publish on PyPi | |
runs-on: ubuntu-latest | |
if: github.repository == 'axiomhq/axiom-py' && startsWith(github.ref, 'refs/tags') | |
needs: | |
- test-integration | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- run: pip install poetry==${{ env.POETRY_VERSION }} | |
- run: poetry publish --build -u __token__ -p "${{ secrets.PYPI_TOKEN }}" |