Skip to content

Commit

Permalink
build: Tweak approval tests for ci
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanmenzel committed Dec 6, 2024
1 parent 204a9f1 commit bc17df9
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,5 @@ jobs:
pipx install algokit --python 3.12.6
algokit localnet reset --update
pipx install git+https://github.com/algorandfoundation/puya --python 3.12.6
test-script: npm run test:ci
output-test-results: true
2 changes: 1 addition & 1 deletion .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ jobs:

#Requires permissions.checks: write
- name: Publish test results
if: ${{ inputs.output-test-results }}
if: ${{ inputs.output-test-results && always() }}
uses: phoenix-actions/test-reporting@v10
with:
name: Test results
Expand Down
20 changes: 20 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"test:approvals": "vitest run tests/approvals.spec.ts",
"test:expected-output": "vitest run tests/expected-output.spec.ts",
"test:coverage": "vitest run --coverage",
"test:ci": "vitest run --coverage --reporter junit --outputFile test-results.xml",
"test:ci": "cross-env NODE_ENV=ci vitest run --coverage",
"install-local-packages": "npm run algo-ts",
"watch-local-packages": "npm run algo-ts:build:watch",
"algo-ts": "run-s algo-ts:*",
Expand Down Expand Up @@ -60,6 +60,7 @@
"better-npm-audit": "3.11.0",
"conventional-changelog-conventionalcommits": "^8.0.0",
"copyfiles": "2.4.1",
"cross-env": "^7.0.3",
"eslint": "9.15.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
Expand Down
11 changes: 7 additions & 4 deletions tests/approvals.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { buildCompileOptions } from '../src/compile-options'
import { isErrorOrCritical, LoggingContext, LogLevel } from '../src/logger'
import { defaultPuyaOptions } from '../src/puya/options'
import { invariant } from '../src/util'
import { Environment } from './constants'

describe('Approvals', async () => {
await rimraf('tests/approvals/out')
Expand Down Expand Up @@ -55,10 +56,12 @@ describe('Approvals', async () => {
})

it('There should be no differences to committed changes', () => {
// // Run git add to force line ending changes
// sync('git', ['add', '.'], {
// stdio: 'inherit',
// })
if (Environment.IsCi) {
// Run git add to force line ending changes
sync('git', ['add', '.'], {
stdio: 'inherit',
})
}
const result = sync('git', ['status', '--porcelain'], {
stdio: 'pipe',
})
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions tests/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const Environment = {
IsCi: process.env.NODE_ENV === 'ci',
} as const

0 comments on commit bc17df9

Please sign in to comment.