Repository navigation
82 lines (74 loc) · 2.59 KB
/
Copy pathpython-package.yml
File metadata and controls
82 lines (74 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# 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: Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
jobs:
build:
# See https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
# for available Python versions on ubuntu
runs-on: ubuntu-22.04
strategy:
matrix:
# see https://www.python.org/downloads/
python-version: [ '3.9', '3.12' ]
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: make init
- name: Lint
run: make lint
- name: Test
env:
TEST_CONFIGURATION_ACCESS_TOKEN: ${{ secrets.TEST_CONFIGURATION_ACCESS_TOKEN }}
run: |
chmod +x scripts/*
make test test-example
- name: Upload coverage report
if: matrix.python-version == '3.12'
uses: actions/upload-artifact@v7
with:
name: coverage
path: |
coverage/coverage-badge.json
coverage/coverage-summary.json
coverage/coverage.xml
publish-coverage:
name: Publish coverage
needs: build
# Only pushes to the default branch publish, and only once the GitHub App for
# the test-coverage repository is configured (COVERAGE_APP_CLIENT_ID variable).
if: github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && vars.COVERAGE_APP_CLIENT_ID != ''
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/download-artifact@v8
with:
name: coverage
path: coverage
- name: Get a token for the test-coverage repository
id: coverage-token
uses: actions/create-github-app-token@v3
with:
client-id: ${{ vars.COVERAGE_APP_CLIENT_ID }}
private-key: ${{ secrets.COVERAGE_APP_PRIVATE_KEY }}
owner: aspose-barcode-cloud
repositories: test-coverage
permission-contents: write
- name: Publish to test-coverage
run: python scripts/publish-coverage.py python
env:
COVERAGE_TOKEN: ${{ steps.coverage-token.outputs.token }}
COVERAGE_APP_SLUG: ${{ steps.coverage-token.outputs.app-slug }}