|
| 1 | +name: GitHub CI |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "*" |
| 7 | + branches: |
| 8 | + - main |
| 9 | + |
| 10 | +jobs: |
| 11 | + |
| 12 | + style: |
| 13 | + name: Code style |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v2 |
| 17 | + - name: Set up Python |
| 18 | + uses: actions/setup-python@v2 |
| 19 | + with: |
| 20 | + python-version: 3.7 |
| 21 | + - name: Install dependencies |
| 22 | + run: | |
| 23 | + python -m pip install --upgrade pip tox |
| 24 | + - name: Test with tox |
| 25 | + run: tox -e style |
| 26 | + |
| 27 | + |
| 28 | + tests: |
| 29 | + name: Test baked project |
| 30 | + runs-on: ${{ matrix.os }} |
| 31 | + strategy: |
| 32 | + matrix: |
| 33 | + os: [windows-latest, ubuntu-latest] |
| 34 | + python-version: ["3.7", "3.8", "3.9", "3.10"] |
| 35 | + build-system: ["flit", "setuptools"] |
| 36 | + fail-fast: false |
| 37 | + |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v2 |
| 40 | + - name: Set up Python ${{ matrix.python-version }} |
| 41 | + uses: actions/setup-python@v2 |
| 42 | + with: |
| 43 | + python-version: ${{ matrix.python-version }} |
| 44 | + |
| 45 | + - name: Install dependencies |
| 46 | + run: python -m pip install --upgrade pip ${{ matrix.build-system }} tox tox-gh-actions |
| 47 | + |
| 48 | + # Runs only the tox environment specified in tox.ini [gh-actions] |
| 49 | + - name: Test with tox-gh-actions |
| 50 | + run: tox |
| 51 | + |
| 52 | + # Baked project actions are tested only for Linux-base OS |
| 53 | + - name: Install and configure act for Linux-based OS |
| 54 | + if: matrix.os == 'ubuntu-latest' |
| 55 | + run: | |
| 56 | + sudo apt-get install build-essential gcc |
| 57 | + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" |
| 58 | + test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)" |
| 59 | + test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" |
| 60 | + test -r ~/.bash_profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bash_profile |
| 61 | + brew install act |
| 62 | + echo "-P ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest" >> ~/.actrc |
| 63 | +
|
| 64 | + - name: Test flit baked project |
| 65 | + if: matrix.os == 'ubuntu-latest' && matrix.build-system == 'flit' |
| 66 | + run: | |
| 67 | + # Change to baked project directory |
| 68 | + cd output/test_bake_project_with_build_s0/cookies/bake00/pyproduct-library |
| 69 | + # Initialize it as git repository (pre-commit needs it) |
| 70 | + git config --global user.email "[email protected]" |
| 71 | + git config --global user.name "Your Name" |
| 72 | + git init && git add . && git commit -m "Init Python package" |
| 73 | + # TODO: Only filter out errors from tox command |
| 74 | + # act -j tests docs > act_output.log || true > act_output.log; grep -c ERROR act_output.log && cat act_output.log |
| 75 | + tox |
| 76 | + # Check package builds properly |
| 77 | + python -m pip install -r requirements/requirements_build.txt |
| 78 | + flit build |
| 79 | + python -m twine check dist/* |
| 80 | +
|
| 81 | + - name: Test poetry baked project |
| 82 | + if: matrix.os == 'ubuntu-latest' && matrix.build-system == 'poetry' |
| 83 | + run: | |
| 84 | + # Change to baked project directory |
| 85 | + cd output/test_bake_project_with_build_s1/cookies/bake00/pyproduct-library |
| 86 | + # Initialize it as git repository (pre-commit needs it) |
| 87 | + git config --global user.email "[email protected]" |
| 88 | + git config --global user.name "Your Name" |
| 89 | + git init && git add . && git commit -m "Init Python package" |
| 90 | + # TODO: Only filter out errors from tox command |
| 91 | + # act -j tests docs > act_output.log || true > act_output.log; grep -c ERROR act_output.log && cat act_output.log |
| 92 | + tox |
| 93 | + # Check package builds properly |
| 94 | + poetry run python -m pip install -r requirements/requirements_build.txt |
| 95 | + poetry build |
| 96 | + poetry run python -m twine check dist/* |
| 97 | +
|
| 98 | + - name: Test setuptools baked project |
| 99 | + if: matrix.os == 'ubuntu-latest' && matrix.build-system == 'setuptools' |
| 100 | + run: | |
| 101 | + # Change to baked project directory |
| 102 | + cd output/test_bake_project_with_build_s2/cookies/bake00/pyproduct-library |
| 103 | + # Initialize it as git repository (pre-commit needs it) |
| 104 | + git config --global user.email "[email protected]" |
| 105 | + git config --global user.name "Your Name" |
| 106 | + git init && git add . && git commit -m "Init Python package" |
| 107 | + # TODO: Only filter out errors from tox command |
| 108 | + # act -j tests docs > act_output.log || true > act_output.log; grep -c ERROR act_output.log && cat act_output.log |
| 109 | + tox |
| 110 | + # Check package builds properly |
| 111 | + python -m pip install -r requirements/requirements_build.txt |
| 112 | + python -m build |
| 113 | + python -m twine check dist/* |
0 commit comments