|
| 1 | +{% raw -%} |
| 2 | +name: Test PR |
| 3 | + |
| 4 | +on: |
| 5 | + pull_request: |
| 6 | + |
| 7 | +env: |
| 8 | + # Please make sure this version is included in the `matrix`, as the |
| 9 | + # `matrix` section can't use `env`, so it must be entered manually |
| 10 | + DEFAULT_PYTHON_VERSION: '3.11' |
| 11 | + # It would be nice to be able to also define a DEFAULT_UBUNTU_VERSION |
| 12 | + # but sadly `env` can't be used either in `runs-on`. |
| 13 | + |
| 14 | +jobs: |
| 15 | + {% endraw %}{% if cookiecutter.type == "api" %}{% raw -%} |
| 16 | + protolint: |
| 17 | + name: Check proto files with protolint |
| 18 | + runs-on: ubuntu-24.04 |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Setup Git |
| 22 | + uses: frequenz-floss/[email protected] |
| 23 | + # TODO(cookiecutter): Uncomment this for projects with private dependencies |
| 24 | + # with: |
| 25 | + # username: ${{ secrets.GIT_USER }} |
| 26 | + # password: ${{ secrets.GIT_PASS }} |
| 27 | + |
| 28 | + - name: Fetch sources |
| 29 | + uses: actions/checkout@v3 |
| 30 | + with: |
| 31 | + submodules: true |
| 32 | + |
| 33 | + - name: Run protolint |
| 34 | + # Only use hashes here, as we are passing the github token, we want to |
| 35 | + # make sure updates are done consciously to avoid security issues if the |
| 36 | + # action repo gets hacked |
| 37 | + uses: yoheimuta/action-protolint@e94cc01b1ad085ed9427098442f66f2519c723eb # v1.0.0 |
| 38 | + with: |
| 39 | + fail_on_error: true |
| 40 | + filter_mode: nofilter |
| 41 | + github_token: ${{ secrets.github_token }} |
| 42 | + protolint_flags: proto/ |
| 43 | + protolint_version: "0.53.0" |
| 44 | + reporter: github-check |
| 45 | + |
| 46 | + {% endraw %}{% endif %}{% raw -%} |
| 47 | + nox: |
| 48 | + name: Test with nox |
| 49 | + runs-on: ubuntu-24.04 |
| 50 | + |
| 51 | + steps: |
| 52 | + - name: Run nox |
| 53 | + uses: frequenz-floss/[email protected] |
| 54 | + with: |
| 55 | + python-version: "3.11" |
| 56 | + nox-session: ci_checks_max |
| 57 | + # TODO(cookiecutter): Uncomment this for projects with private dependencies |
| 58 | + # git-username: ${{ secrets.GIT_USER }} |
| 59 | + # git-password: ${{ secrets.GIT_PASS }} |
| 60 | + |
| 61 | + test-docs: |
| 62 | + name: Test documentation website generation |
| 63 | + runs-on: ubuntu-24.04 |
| 64 | + steps: |
| 65 | + - name: Setup Git |
| 66 | + uses: frequenz-floss/[email protected] |
| 67 | + # TODO(cookiecutter): Uncomment this for projects with private dependencies |
| 68 | + # with: |
| 69 | + # username: ${{ secrets.GIT_USER }} |
| 70 | + # password: ${{ secrets.GIT_PASS }} |
| 71 | + |
| 72 | + - name: Fetch sources |
| 73 | + uses: actions/checkout@v4 |
| 74 | + with: |
| 75 | + submodules: true |
| 76 | + |
| 77 | + - name: Setup Python |
| 78 | + uses: frequenz-floss/[email protected] |
| 79 | + with: |
| 80 | + python-version: ${{ env.DEFAULT_PYTHON_VERSION }} |
| 81 | + dependencies: .[dev-mkdocs] |
| 82 | + |
| 83 | + - name: Generate the documentation |
| 84 | + env: |
| 85 | + MIKE_VERSION: gh-${{ github.job }} |
| 86 | + run: | |
| 87 | + mike deploy $MIKE_VERSION |
| 88 | + mike set-default $MIKE_VERSION |
| 89 | +
|
| 90 | + - name: Upload site |
| 91 | + uses: actions/upload-artifact@v4 |
| 92 | + with: |
| 93 | + name: docs-site |
| 94 | + path: site/ |
| 95 | + if-no-files-found: error |
| 96 | +{%- endraw %} |
0 commit comments