| 1 | # Runs the h2spec RFC 9113 / 7541 conformance suite against the net.http HTTP/2 |
| 2 | # server on every change to the h2 code. Uses a PINNED h2spec release binary |
| 3 | # (no `go install`, no @latest) so results are reproducible. The gate compares |
| 4 | # the failing cases against vlib/net/http/h2spec/h2spec_expected_failures.txt and |
| 5 | # fails only on a regression (a case that newly fails). |
| 6 | name: h2spec conformance |
| 7 | |
| 8 | on: |
| 9 | push: |
| 10 | paths: &h2paths |
| 11 | - 'vlib/net/http/h2_*.v' |
| 12 | - 'vlib/net/http/server*.v' |
| 13 | - 'vlib/net/http/http*.v' |
| 14 | - 'vlib/net/http/h2spec/**' |
| 15 | # `**` (not `*.v`): mbedtls.c.v #inserts mbedtls_helpers.h / mbedtls_threading.h, |
| 16 | # so TLS/ALPN behavior can change via the headers too (Codex P2). |
| 17 | - 'vlib/net/mbedtls/**' |
| 18 | - '.github/workflows/h2spec.yml' |
| 19 | pull_request: |
| 20 | paths: *h2paths |
| 21 | |
| 22 | concurrency: |
| 23 | group: h2spec-${{ github.workflow }}-${{ github.ref }} |
| 24 | cancel-in-progress: true |
| 25 | |
| 26 | jobs: |
| 27 | h2spec: |
| 28 | runs-on: ubuntu-latest |
| 29 | env: |
| 30 | H2SPEC_VERSION: v2.6.0 |
| 31 | H2SPEC_SHA256: 157ee0de702e01ad40e752dbf074b366027e550c8e7504f9450da2809e279318 |
| 32 | steps: |
| 33 | - uses: actions/checkout@v7 |
| 34 | |
| 35 | - name: Build the V compiler |
| 36 | run: | |
| 37 | make |
| 38 | ./v -o vnew cmd/v |
| 39 | |
| 40 | - name: Fetch pinned h2spec release |
| 41 | run: | |
| 42 | url="https://github.com/summerwind/h2spec/releases/download/${H2SPEC_VERSION}/h2spec_linux_amd64.tar.gz" |
| 43 | curl -fsSL "$url" -o h2spec.tar.gz |
| 44 | echo "${H2SPEC_SHA256} h2spec.tar.gz" | sha256sum -c - |
| 45 | tar -xzf h2spec.tar.gz |
| 46 | sudo install -m 0755 h2spec /usr/local/bin/h2spec |
| 47 | h2spec --version |
| 48 | |
| 49 | - name: Run h2spec conformance gate |
| 50 | env: |
| 51 | # VEXE: ./vnew |
| 52 | VFLAGS_CC: -cc gcc # mbedtls needs a real C compiler, not tcc |
| 53 | run: bash vlib/net/http/h2spec/run_h2spec.sh |
| 54 | |
| 55 | - name: Upload h2spec report |
| 56 | if: always() |
| 57 | uses: actions/upload-artifact@v7 |
| 58 | with: |
| 59 | name: h2spec-report |
| 60 | path: | |
| 61 | vlib/net/http/h2spec/h2spec_report.xml |
| 62 | vlib/net/http/h2spec/h2spec_failed_now.txt |
| 63 | |