Skip to content

Commit f5fbb6f

Browse files
committed
Test
1 parent f0f6155 commit f5fbb6f

File tree

2 files changed

+157
-85
lines changed

2 files changed

+157
-85
lines changed

.github/workflows/main.yml

Lines changed: 115 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,105 @@
11
name: CI
22
on:
33
pull_request:
4+
push:
45
merge_group:
56

67
env:
78
MDBOOK_VERSION: 0.4.40
89

910
jobs:
10-
code-tests:
11-
runs-on: ubuntu-latest
12-
steps:
13-
- uses: actions/checkout@master
14-
- name: Update rustup
15-
run: rustup self update
16-
- name: Install Rust
17-
run: |
18-
rustup set profile minimal
19-
rustup toolchain install nightly
20-
rustup default nightly
21-
- name: Install mdbook
22-
run: |
23-
mkdir bin
24-
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
25-
echo "$(pwd)/bin" >> $GITHUB_PATH
26-
- name: Report versions
27-
run: |
28-
rustup --version
29-
rustc -Vv
30-
mdbook --version
31-
- name: Run tests
32-
run: mdbook test
11+
# code-tests:
12+
# runs-on: ubuntu-latest
13+
# steps:
14+
# - uses: actions/checkout@master
15+
# - name: Update rustup
16+
# run: rustup self update
17+
# - name: Install Rust
18+
# run: |
19+
# rustup set profile minimal
20+
# rustup toolchain install nightly
21+
# rustup default nightly
22+
# - name: Install mdbook
23+
# run: |
24+
# mkdir bin
25+
# curl -sSL https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
26+
# echo "$(pwd)/bin" >> $GITHUB_PATH
27+
# - name: Report versions
28+
# run: |
29+
# rustup --version
30+
# rustc -Vv
31+
# mdbook --version
32+
# - name: Run tests
33+
# run: mdbook test
34+
35+
# style-tests:
36+
# runs-on: ubuntu-latest
37+
# steps:
38+
# - uses: actions/checkout@master
39+
# - name: Update rustup
40+
# run: rustup self update
41+
# - name: Install Rust
42+
# run: |
43+
# rustup set profile minimal
44+
# rustup toolchain install nightly -c rust-docs,rustfmt
45+
# rustup default nightly
46+
# - name: Install mdbook
47+
# run: |
48+
# mkdir bin
49+
# curl -sSL https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
50+
# echo "$(pwd)/bin" >> $GITHUB_PATH
51+
# - name: Report versions
52+
# run: |
53+
# rustup --version
54+
# rustc -Vv
55+
# mdbook --version
56+
# - name: Verify the book builds
57+
# env:
58+
# SPEC_DENY_WARNINGS: 1
59+
# run: mdbook build
60+
# - name: Style checks
61+
# working-directory: style-check
62+
# run: cargo run --locked -- ../src
63+
# - name: Style fmt
64+
# working-directory: style-check
65+
# run: cargo fmt --check
66+
# - name: Check for broken links
67+
# run: |
68+
# curl -sSLo linkcheck.sh \
69+
# https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh
70+
# sh linkcheck.sh --all reference
71+
72+
# mdbook-spec:
73+
# runs-on: ubuntu-latest
74+
# steps:
75+
# - uses: actions/checkout@master
76+
# - name: Update rustup
77+
# run: rustup self update
78+
# - name: Install Rust
79+
# run: |
80+
# rustup set profile minimal
81+
# rustup toolchain install nightly -c rustfmt
82+
# rustup default nightly
83+
# - name: Install mdbook
84+
# run: |
85+
# mkdir bin
86+
# curl -sSL https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
87+
# echo "$(pwd)/bin" >> $GITHUB_PATH
88+
# - name: Report versions
89+
# run: |
90+
# rustup --version
91+
# rustc -Vv
92+
# - name: Verify mdbook-spec lockfile is current
93+
# working-directory: ./mdbook-spec
94+
# run: cargo update -p mdbook-spec --locked
95+
# - name: Test mdbook-spec
96+
# working-directory: ./mdbook-spec
97+
# run: cargo test
98+
# - name: Rustfmt check
99+
# working-directory: ./mdbook-spec
100+
# run: cargo fmt --check
33101

34-
style-tests:
102+
preview:
35103
runs-on: ubuntu-latest
36104
steps:
37105
- uses: actions/checkout@master
@@ -40,78 +108,40 @@ jobs:
40108
- name: Install Rust
41109
run: |
42110
rustup set profile minimal
43-
rustup toolchain install nightly -c rust-docs,rustfmt
111+
rustup toolchain install nightly
44112
rustup default nightly
45113
- name: Install mdbook
46114
run: |
47115
mkdir bin
48116
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
49117
echo "$(pwd)/bin" >> $GITHUB_PATH
50-
- name: Report versions
51-
run: |
52-
rustup --version
53-
rustc -Vv
54-
mdbook --version
55-
- name: Verify the book builds
118+
- name: Build the book
56119
env:
57-
SPEC_DENY_WARNINGS: 1
120+
SPEC_RELATIVE: 0
58121
run: mdbook build
59-
- name: Style checks
60-
working-directory: style-check
61-
run: cargo run --locked -- ../src
62-
- name: Style fmt
63-
working-directory: style-check
64-
run: cargo fmt --check
65-
- name: Check for broken links
66-
run: |
67-
curl -sSLo linkcheck.sh \
68-
https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh
69-
sh linkcheck.sh --all reference
70-
71-
mdbook-spec:
72-
runs-on: ubuntu-latest
73-
steps:
74-
- uses: actions/checkout@master
75-
- name: Update rustup
76-
run: rustup self update
77-
- name: Install Rust
78-
run: |
79-
rustup set profile minimal
80-
rustup toolchain install nightly -c rustfmt
81-
rustup default nightly
82-
- name: Install mdbook
83-
run: |
84-
mkdir bin
85-
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
86-
echo "$(pwd)/bin" >> $GITHUB_PATH
87-
- name: Report versions
88-
run: |
89-
rustup --version
90-
rustc -Vv
91-
- name: Verify mdbook-spec lockfile is current
92-
working-directory: ./mdbook-spec
93-
run: cargo update -p mdbook-spec --locked
94-
- name: Test mdbook-spec
95-
working-directory: ./mdbook-spec
96-
run: cargo test
97-
- name: Rustfmt check
98-
working-directory: ./mdbook-spec
99-
run: cargo fmt --check
122+
- name: Upload artifact
123+
# if: github.event_name == 'pull_request'
124+
uses: actions/upload-artifact@v4
125+
with:
126+
# name: preview-${{ github.event.pull_request.number }}
127+
name: preview-1234
128+
overwrite: true
129+
path: book/**
100130

101131
# The success job is here to consolidate the total success/failure state of
102132
# all other jobs. This job is then included in the GitHub branch protection
103133
# rule which prevents merges unless all other jobs are passing. This makes
104134
# it easier to manage the list of jobs via this yml file and to prevent
105135
# accidentally adding new jobs without also updating the branch protections.
106-
success:
107-
name: Success gate
108-
if: always()
109-
needs:
110-
- code-tests
111-
- style-tests
112-
- mdbook-spec
113-
runs-on: ubuntu-latest
114-
steps:
115-
- run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
116-
- name: Done
117-
run: exit 0
136+
# success:
137+
# name: Success gate
138+
# if: always()
139+
# needs:
140+
# - code-tests
141+
# - style-tests
142+
# - mdbook-spec
143+
# runs-on: ubuntu-latest
144+
# steps:
145+
# - run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
146+
# - name: Done
147+
# run: exit 0

.github/workflows/preview.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Publish Preview
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
pr_num:
6+
description: "PR number"
7+
type: number
8+
required: true
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
publish:
15+
name: Publish preview to GitHub Pages
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
steps:
20+
- uses: actions/checkout@master
21+
# - name: Download preview
22+
# uses: actions/download-artifact@v4
23+
# with:
24+
# name: preview-1234
25+
#github-token: ...
26+
#run-id: ...
27+
- name: Update GitHub Pages
28+
env:
29+
GH_TOKEN: ${{ github.token }}
30+
run: |
31+
git config user.name "Deploy from CI"
32+
git config user.email ""
33+
git worktree add --orphan -B gh-pages gh-pages
34+
rm -rf gh-pages/pr-1234
35+
mkdir gh-pages/pr-1234
36+
gh run download --name preview-1234 --dir gh-pages/pr-1234
37+
# unzip -n pr-1234.zip -d gh-pages/pr-1234
38+
# cd gh-pages
39+
git add -A
40+
git commit -m 'Preview pr-1234'
41+
git push origin +gh-pages
42+
# cd ../..

0 commit comments

Comments
 (0)