File: doc.yml

package info (click to toggle)
python-apischema 0.18.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,636 kB
  • sloc: python: 15,281; makefile: 3; sh: 2
file content (151 lines) | stat: -rw-r--r-- 4,841 bytes parent folder | download | duplicates (2)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Documentation

on:
  workflow_dispatch:
  release:
    types: [published]
  push:
    branches:
      - master
    paths:
      - apischema/**
      - benchmark/**
      - docs/**
      - examples/**
      - mkdocs.yml
      - pyproject.toml
  pull_request:
    paths:
      - apischema/**
      - benchmark/**
      - docs/**
      - examples/**
      - mkdocs.yml

jobs:
  run_benchmark:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/cache@v4
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-pip-${{ hashFiles('tests/requirements.txt') }}
          restore-keys: |
            ${{ runner.os }}-pip-
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: '3.12'
      - name: Cythonize
        run: scripts/cythonize.sh
      - name: Install apischema
        run: pip install -e .
      - name: Install requirements
        run: pip install -r benchmark/requirements.txt
      - name: Run benchmark
        run: python benchmark/main.py
      - uses: actions/upload-artifact@v4
        with:
          name: benchmark_table
          path: examples/benchmark_table.md
      - uses: actions/upload-artifact@v4
        with:
          name: benchmark_chart_light
          path: docs/benchmark_chart_light.svg
      - uses: actions/upload-artifact@v4
        with:
          name: benchmark_chart_dark
          path: docs/benchmark_chart_dark.svg
  upload_doc:
    needs: [run_benchmark]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/cache@v4
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-pip-${{ hashFiles('tests/requirements.txt') }}
          restore-keys: |
            ${{ runner.os }}-pip-
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: '3.12'
      - uses: actions/download-artifact@v4
        with:
          name: benchmark_table
          path: examples
      - uses: actions/download-artifact@v4
        with:
          name: benchmark_chart_light
          path: docs
      - uses: actions/download-artifact@v4
        with:
          name: benchmark_chart_dark
          path: docs
      - name: Install requirements
        run: pip install -r docs/requirements.txt
      - name: Build documentation
        run: mkdocs build
      - uses: actions/upload-artifact@v4
        with:
          name: documentation
          path: site/**
  publish_doc:
    needs: [run_benchmark]
    runs-on: ubuntu-latest
    if: github.event_name == 'push' || github.event_name == 'release'
    steps:
      - uses: actions/cache@v4
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-pip-${{ hashFiles('tests/requirements.txt') }}
          restore-keys: |
            ${{ runner.os }}-pip-
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          # TODO bump to 3.12 when mike will support it
          python-version: '3.11'
      - uses: actions/download-artifact@v4
        with:
          name: benchmark_table
          path: examples
      - uses: actions/download-artifact@v4
        with:
          name: benchmark_chart_light
          path: docs
      - uses: actions/download-artifact@v4
        with:
          name: benchmark_chart_dark
          path: docs
      - name: Install requirements
        run: pip install -r docs/requirements.txt
      - name: Setup git
        run: |
          git config user.name github-actions
          git config user.email github-actions@github.com
          git fetch origin gh-pages --depth=1
      - name: Retrieve current version
        # TODO use a better thing that parsing pyproject.toml
        run: |
          echo "version=$(cat pyproject.toml | grep "version =" | cut -d' ' -f3 | cut -d'"' -f2 | cut -d. -f-2)" >> $GITHUB_ENV
          echo "revision=$(cat pyproject.toml | grep "version =" | cut -d' ' -f3 | cut -d'"' -f2 | cut -d. -f3)" >> $GITHUB_ENV
      - name: Deploy latest documentation
        if: github.event_name == 'release' && env.revision == '0'
        run: |
          mike retitle latest "$(mike list latest -j | jq .version -r)"
          mike deploy $version latest -t "$version (latest)" -u
      - name: Deploy patch documentation
        if: github.event_name == 'release' && env.revision != '0'
        run: mike deploy $version
      - name: Deploy dev documentation
        if: github.event_name == 'push'
        run: mike deploy dev
      - name: Publish documentation
        if: github.event_name == 'push' || github.event_name == 'release'
        run: |
          git switch gh-pages
          cat versions.json | jq '[.[-1], .[:-1][]]' -r | tee versions.json
          git add versions.json
          git commit -m "sort versions.json"
          git push origin gh-pages