Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
ci: add debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
hanspagel committed Feb 8, 2024
1 parent abb2030 commit 30e9952
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@ jobs:
run: pnpm turbo build
- name: Check types
run: pnpm turbo types:check
- name: Cache example files
id: cache-real-world-examples
uses: actions/cache@v4
with:
path: packages/openapi-parser/tests/files
key: real-world-examples
- if: steps.cache-real-world-examples != 'true'
name: 'Prepare test environment (fetch example files)'
# - name: Cache example files
# id: cache-real-world-examples
# uses: actions/cache@v4
# with:
# path: packages/openapi-parser/tests/files
# key: real-world-examples
- name: 'Prepare test environment (fetch example files)'
run: pnpm test:prepare
- name: Debug output
run: ls -la packages/openapi-parser/tests/files
- name: Run tests
run: pnpm turbo test
# TODO: Make repository public first
Expand Down
2 changes: 2 additions & 0 deletions packages/openapi-parser/tests/files.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const files = (
await glob('./packages/openapi-parser/tests/files/*.yaml')
).filter((file) => !invalidFiles.includes(file))

console.log('files', files)

/**
* This test suite parses a large number of real-world OpenAPI files
*/
Expand Down
20 changes: 9 additions & 11 deletions scripts/fetch-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,21 @@ console.log()
console.log('Start downloading …')

apis.forEach((api) => {
console.log(`Fetch ${api.swaggerYamlUrl}`)
console.log(`Fetch ${api.swaggerYamlUrl}`)

fetch(api.swaggerYamlUrl)
.then(async (response) => {
const content = await response.text()

const filename = `${slugger.slug(api.name)}.yaml`

fs.writeFile(
`./packages/openapi-parser/tests/files/${filename}`,
content,
(err) => {
if (err) {
throw err
}
},
)
const file = `./packages/openapi-parser/tests/files/${filename}`

console.log('Write', file)
fs.writeFile(file, content, (err) => {
if (err) {
throw err
}
})
})
.catch((err) => {
console.error(`[ERROR] Failed to fetch ${api.swaggerYamlUrl}`, err)
Expand Down

0 comments on commit 30e9952

Please sign in to comment.