|
| 1 | +name: build and test allure-nose2 |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + paths: |
| 8 | + - "allure-nose2/**" |
| 9 | + - "allure-python-commons/**" |
| 10 | + - "allure-python-commons-test/**" |
| 11 | + |
| 12 | +env: |
| 13 | + PROJECT_NAME: allure-nose2 |
| 14 | + |
| 15 | +jobs: |
| 16 | + commons: |
| 17 | + name: Build commons |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v3 |
| 21 | + |
| 22 | + - name: Cache commons |
| 23 | + id: commons |
| 24 | + uses: actions/cache@v3 |
| 25 | + with: |
| 26 | + path: dist/ |
| 27 | + key: commons-${{ github.sha }} |
| 28 | + |
| 29 | + - name: Build python commons |
| 30 | + if: steps.commons.outputs.cache-hit != 'true' |
| 31 | + run: pip install build && |
| 32 | + python -m build allure-python-commons --outdir dist/ && |
| 33 | + python -m build allure-python-commons-test --outdir dist/ |
| 34 | + |
| 35 | + linters: |
| 36 | + name: Static check |
| 37 | + runs-on: ubuntu-latest |
| 38 | + needs: [commons] |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v3 |
| 41 | + |
| 42 | + - name: Set up Python |
| 43 | + uses: actions/setup-python@v4 |
| 44 | + with: |
| 45 | + python-version: "3.10" |
| 46 | + |
| 47 | + - name: Get commons from cache |
| 48 | + id: commons |
| 49 | + uses: actions/cache@v3 |
| 50 | + with: |
| 51 | + path: dist/ |
| 52 | + key: commons-${{ github.sha }} |
| 53 | + |
| 54 | + - name: Install packages |
| 55 | + run: pip install dist/allure-python-commons*.tar.gz && |
| 56 | + pip install ./${{ env.PROJECT_NAME }} && |
| 57 | + pip install -r ${{ env.PROJECT_NAME }}/requirements.txt |
| 58 | + |
| 59 | + - name: Static check ${{ env.PROJECT_NAME }} |
| 60 | + run: flake8 ${{ env.PROJECT_NAME }}/src/ ${{ env.PROJECT_NAME }}/test/ |
| 61 | + |
| 62 | + build: |
| 63 | + name: Build and test package |
| 64 | + runs-on: ubuntu-latest |
| 65 | + needs: [linters, commons] |
| 66 | + strategy: |
| 67 | + matrix: |
| 68 | + python-version: ["3.10", 3.9, 3.8, 3.7] |
| 69 | + env: |
| 70 | + ALLURE_INDENT_OUTPUT: yep |
| 71 | + steps: |
| 72 | + - uses: actions/checkout@v3 |
| 73 | + |
| 74 | + - name: Set up Python ${{ matrix.python-version }} |
| 75 | + uses: actions/setup-python@v4 |
| 76 | + with: |
| 77 | + python-version: ${{ matrix.python-version }} |
| 78 | + |
| 79 | + - name: Get commons from cache |
| 80 | + id: commons |
| 81 | + uses: actions/cache@v3 |
| 82 | + with: |
| 83 | + path: dist/ |
| 84 | + key: commons-${{ github.sha }} |
| 85 | + |
| 86 | + - name: Install packages |
| 87 | + run: pip install dist/allure-python-commons*.tar.gz && |
| 88 | + pip install ./${{ env.PROJECT_NAME }} && |
| 89 | + pip install -r ${{ env.PROJECT_NAME }}/requirements.txt |
| 90 | + |
| 91 | + - name: Test ${{ env.PROJECT_NAME }} |
| 92 | + working-directory: ${{ env.PROJECT_NAME }} |
| 93 | + run: nose2 --plugin=test.example_loader --plugin=allure_nose2.plugin --allure |
| 94 | + --current-example -t . -s ./test |
0 commit comments