Skip to content

ci(nightly): comment PR with link to nightly release #93

ci(nightly): comment PR with link to nightly release

ci(nightly): comment PR with link to nightly release #93

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: 01_ci-cd
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
name: build
runs-on: ubuntu-latest
needs: [ i18n ]
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pipenv
pipenv install --dev --ignore-pipfile
- name: Unit tests
run: |
pipenv run pytest -svv tests/ --junitxml=junit/unit-test-results-3.8.xml
- name: Upload test results
uses: actions/upload-artifact@v3
if: always()
with:
name: unit-test-results-3.8
path: junit/unit-test-results-3.8.xml
- name: Publish Test Result
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: junit/unit-test-results-3.8.xml
check_name: Unit Tests
- uses: ./.github/actions/download-i18n
- name: build artifact
run: |
python -m pip install wheel
python setup.py sdist bdist_wheel
- uses: actions/upload-artifact@v3
with:
name: hexagon
path: dist/*.tar.gz
test:
name: test
runs-on: ubuntu-latest
needs: [ i18n, build ]
strategy:
fail-fast: false
matrix:
python-version: [ 3.7, 3.8, 3.9, '3.10' ]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@v3
with:
name: hexagon
path: dist
- uses: ./.github/actions/download-i18n
- name: Setup e2e dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
python -m pip install --find-links=./dist hexagon
- name: e2e tests
run: |
echo "Running e2e tests for Python ${{ matrix.python-version }}"
echo "COLUMNS: $COLUMNS, ROWS: $ROWS"
pytest -svv tests_e2e/ --junitxml=junit/e2e-test-results-${{ matrix.python-version }}.xml
- name: Upload test results
uses: actions/upload-artifact@v3
if: always()
with:
name: e2e-test-results-${{ matrix.python-version }}
path: junit/e2e-test-results-${{ matrix.python-version }}.xml
- name: Publish Test Result
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: junit/e2e-test-results-${{ matrix.python-version }}.xml
check_name: E2E Tests Python${{ matrix.python-version }}
i18n:
name: i18n
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: install gettext
run: sudo apt-get install -y gettext
- name: add matcher
run: echo "::add-matcher::.github/i18n-problem-matcher.json"
- name: build locales
run: .github/scripts/i18n/build.sh
- name: validate translations
run: .github/scripts/i18n/check.sh
- name: upload artifact
uses: actions/upload-artifact@v3
with:
name: i18n
path: locales/**/*.mo
- name: remove matcher
run: echo "::remove-matcher owner=hexagon-i18n::"
release:
if: ${{ github.event_name != 'pull_request' && github.event_name != 'pull_request_target' }}
runs-on: ubuntu-latest
needs: [ build, test, i18n ]
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/download-i18n
- name: Python Semantic Release
id: release
uses: python-semantic-release/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
nightly:
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }}
runs-on: ubuntu-latest
needs: [ test ]
permissions:
pull-requests: write
steps:
- uses: beni69/artifact-link@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}