Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] proper docs testing with approvals and jbang #577

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 13 additions & 55 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ jobs:
- name: Test Java
run: mvn -B clean install

readme-ci:
docs-ci:
runs-on: ubuntu-latest
name: CI - Readme
name: CI - Docs
steps:
- name: checkout
uses: actions/checkout@v4
Expand All @@ -60,61 +60,19 @@ jobs:
distribution: 'temurin'
java-version: '17'
cache: maven
- name: set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'yarn'
cache-dependency-path: 'docs/yarn.lock'
- name: Build Chicory
run: mvn -B -Dquickly
env:
MAVEN_OPTS: "-Dmaven.repo.local=${{ github.workspace }}/repository"
# Test root Readme
- name: jbang
uses: jbangdev/jbang-action@36d4a384d215d91c2c7e74014a486cedfe09d760 # tag=v0.119.0
with:
script: README.md
env:
JBANG_REPO: "${{ github.workspace }}/repository"
- name: compare results
run: diff -r ./readmes/main/expected ./readmes/main/current
# Test wasi Readme
- name: jbang
uses: jbangdev/jbang-action@36d4a384d215d91c2c7e74014a486cedfe09d760 # tag=v0.119.0
with:
script: wasi/README.md
env:
JBANG_REPO: "${{ github.workspace }}/repository"
- name: compare results
run: diff -r ./readmes/wasi/expected ./readmes/wasi/current
# Test AOT Readme
- name: jbang
uses: jbangdev/jbang-action@36d4a384d215d91c2c7e74014a486cedfe09d760 # tag=v0.119.0
with:
script: aot/README.md
env:
JBANG_REPO: "${{ github.workspace }}/repository"
# Test WASM Readme
- name: jbang
uses: jbangdev/jbang-action@36d4a384d215d91c2c7e74014a486cedfe09d760 # tag=v0.119.0
with:
script: wasm/README.md
env:
JBANG_REPO: "${{ github.workspace }}/repository"

# Test docs index
- name: jbang
uses: jbangdev/jbang-action@36d4a384d215d91c2c7e74014a486cedfe09d760 # tag=v0.119.0
with:
script: docs/docs/index.md
env:
JBANG_REPO: "${{ github.workspace }}/repository"
- name: compare results
run: diff -r ./readmes/index/expected ./readmes/index/current
# Test docs memory
- name: jbang
uses: jbangdev/jbang-action@36d4a384d215d91c2c7e74014a486cedfe09d760 # tag=v0.119.0
with:
script: docs/docs/usage/memory.md
env:
JBANG_REPO: "${{ github.workspace }}/repository"
- name: compare results
run: diff -r ./readmes/memory/expected ./readmes/memory/current
- name: Test Docs
working-directory: docs
run: |
yarn install --frozen-lockfile
yarn test

test-results:
name: Test Results
Expand Down
2 changes: 1 addition & 1 deletion docs-lib/src/main/java/docs/FileOps.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static void copyFromWasmCorpus(String sourceName, String destName) throws
dest.toFile().delete();
}
Files.copy(
new File(".")
new File("..")
.toPath()
.resolve("wasm-corpus")
.resolve("src")
Expand Down
2 changes: 2 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ yarn-error.log*
.yarn

.pnp.*
*.wasm
*.result
2 changes: 1 addition & 1 deletion docs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ System.out.println("Result: " + result); // should print 120 (5!)

<!--
```java
docs.FileOps.writeResult("readmes/index/current", "factorial.result", "" + result);
docs.FileOps.writeResult("docs", "index.md.result", "" + result);
```
-->

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/usage/memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ assert(3L == result); // 3 vowels in Hello, World!

<!--
```java
docs.FileOps.writeResult("readmes/memory/current", "countVowels.result", "" + result);
docs.FileOps.writeResult("docs/usage", "memory.md.result", "" + result);
```
-->
7 changes: 7 additions & 0 deletions docs/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/** @type {import('ts-jest').JestConfigWithTsJest} **/
module.exports = {
testEnvironment: "node",
transform: {
"^.+.tsx?$": ["ts-jest",{}],
},
};
Loading
Loading