Skip to content

Commit 31475b7

Browse files
authored
Fix doc extraction (#1613)
* Shot in the dark to fix Jazzy doc extraction * Upgrade to latest macOS runner * Build the index page first, before permissions get messed up. * Put cacheing in the right place, before `swift` runs on our project
1 parent cc514ca commit 31475b7

File tree

1 file changed

+29
-30
lines changed

1 file changed

+29
-30
lines changed

.github/workflows/doc-extraction.yml

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ concurrency:
2626
jobs:
2727
build:
2828
if: github.repository == 'hylo-lang/hylo'
29-
runs-on: macos-14
29+
runs-on: macos-15
3030
env:
3131
llvm_url_prefix: https://github.com/hylo-lang/llvm-build/releases/download/20240303-215025
3232
llvm_package_basename: llvm-17.0.6-arm64-apple-darwin23.3.0-MinSizeRel
@@ -48,7 +48,7 @@ jobs:
4848
swift-version: ${{ env.swift-version }}
4949
cache-snapshot: false # Workaround for https://github.com/SwiftyLab/setup-swift/issues/315
5050

51-
- name: Install LLVM
51+
- name: Install LLVM and create its pkgconfig file
5252
# 7z doesn't support decompressing from a stream or we'd do this all as one statement. Maybe
5353
# we should find a way to use zstd on windows.
5454
run: >-
@@ -58,16 +58,25 @@ jobs:
5858
5959
tar -x --zstd -f ${{ env.llvm_package_basename }}.tar.zst
6060
61-
- name: Create LLVM pkgconfig file and make it findable
62-
run: >-
63-
set -ex -o pipefail
64-
6561
PATH="${{ github.workspace }}/${{ env.llvm_package_basename }}/bin:$PATH"
6662
./Tools/make-pkgconfig.sh llvm.pc
6763
68-
echo 'PKG_CONFIG_PATH=${{ github.workspace }}' >> $GITHUB_ENV
64+
- name: Prepare shell environment
65+
run: |
66+
echo "PKG_CONFIG_PATH=${{ github.workspace }}
67+
REPO_SANS_OWNER=${GITHUB_REPOSITORY##*/}
68+
REF_URL_COMPONENT=${GITHUB_REF##*/}
69+
HYLO_ENABLE_DOC_GENERATION=1
70+
" >> "${GITHUB_ENV}"
6971
70-
- name: Prepare Shell Environment
72+
- uses: actions/cache@v4
73+
with:
74+
path: .build
75+
key: ${{ runner.os }}-debug-spm-${{ hashFiles('./**/Package.resolved') }}
76+
restore-keys: |
77+
${{ runner.os }}-debug-spm-
78+
79+
- name: Compute the Extraction Targets
7180
# The format of the ${GITHUB_ENV} file is extremely restrictive; it apparently only supports
7281
# lines of the form:
7382
#
@@ -80,24 +89,23 @@ jobs:
8089

8190
# FIXME: REF_URL_COMPONENT computation is probably wrong for some refs.
8291
run: |
83-
echo "PKG_CONFIG_PATH=$PWD
84-
REPO_SANS_OWNER=${GITHUB_REPOSITORY##*/}
85-
REF_URL_COMPONENT=${GITHUB_REF##*/}
86-
EXTRACTION_TARGETS=$(
92+
echo "EXTRACTION_TARGETS=$(
8793
swift package dump-package |
8894
jq '.targets | map(select(.type | test("^(regular|executable)$"))) | .[].name' |
8995
xargs
9096
)
91-
HYLO_ENABLE_DOC_GENERATION=1
9297
" >> "${GITHUB_ENV}"
93-
94-
- uses: actions/cache@v4
95-
with:
96-
path: .build
97-
key: ${{ runner.os }}-debug-spm-${{ hashFiles('./**/Package.resolved') }}
98-
restore-keys: |
99-
${{ runner.os }}-debug-spm-
100-
98+
99+
- name: Generate Index Page
100+
run: |
101+
mkdir -p _site
102+
Tools/gyb.py \
103+
--line-directive '<!-- file: %(file)s line: %(line)s -->' \
104+
-DROOT_URL="https://hylo-lang.org/${REPO_SANS_OWNER}" \
105+
-DEXTRACTION_TARGETS="${EXTRACTION_TARGETS}" \
106+
-DGITHUB_REPOSITORY="${GITHUB_REPOSITORY}" \
107+
Tools/doc-index.html.gyb -o _site/index.html
108+
101109
- name: Extract with DocC
102110
run: |
103111
export PKG_CONFIG_PATH
@@ -131,15 +139,6 @@ jobs:
131139
--min-acl private
132140
done
133141
134-
- name: Generate Index Page
135-
run: |
136-
Tools/gyb.py \
137-
--line-directive '<!-- file: %(file)s line: %(line)s -->' \
138-
-DROOT_URL="https://hylo-lang.org/${REPO_SANS_OWNER}" \
139-
-DEXTRACTION_TARGETS="${EXTRACTION_TARGETS}" \
140-
-DGITHUB_REPOSITORY="${GITHUB_REPOSITORY}" \
141-
Tools/doc-index.html.gyb -o _site/index.html
142-
143142
- name: Setup Pages
144143
uses: actions/configure-pages@v5
145144

0 commit comments

Comments
 (0)