@dougefresh/ci 0.1.15 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/defaults.d.ts +13 -0
  2. package/dist/defaults.d.ts.map +1 -0
  3. package/dist/defaults.js +95 -0
  4. package/dist/defaults.js.map +1 -0
  5. package/dist/index.d.ts +34 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +119 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/types.d.ts +79 -0
  10. package/dist/types.d.ts.map +1 -0
  11. package/dist/types.js +9 -0
  12. package/dist/types.js.map +1 -0
  13. package/package.json +6 -1
  14. package/.checkov.yml +0 -7
  15. package/.env.example +0 -61
  16. package/.gitattributes +0 -3
  17. package/.github/actions/install-yq/action.yaml +0 -80
  18. package/.github/actions/install-yq/scripts/unixish.sh +0 -112
  19. package/.github/actions/install-yq/scripts/windowsish.ps1 +0 -99
  20. package/.github/actions/jobtaker/action.yml +0 -29
  21. package/.github/actions/rust-config/action.yml +0 -34
  22. package/.github/actions/rust-init/action.yml +0 -75
  23. package/.github/additional-prompt.md +0 -62
  24. package/.github/ci-configs/dummy.yml +0 -24
  25. package/.github/ci-configs/rust/ai.yml +0 -65
  26. package/.github/ci-configs/rust-default.yml +0 -115
  27. package/.github/ci-configs/test/01.yml +0 -9
  28. package/.github/dependabot.yml +0 -26
  29. package/.github/prompts/create-release-notes.prompt.md +0 -29
  30. package/.github/prompts/unit-test.prompt.md +0 -77
  31. package/.github/rust-ci.ts +0 -5
  32. package/.github/workflows/action-ci.yml +0 -39
  33. package/.github/workflows/action-review.yml +0 -57
  34. package/.github/workflows/dummy-release.yml +0 -32
  35. package/.github/workflows/dummy-test.yml +0 -16
  36. package/.github/workflows/pages.yml +0 -59
  37. package/.github/workflows/pr-review.yml +0 -59
  38. package/.github/workflows/release.yml +0 -36
  39. package/.github/workflows/rust-release.yml +0 -133
  40. package/.github/workflows/rust.yml +0 -247
  41. package/.node-version +0 -1
  42. package/AGENTS.md +0 -28
  43. package/Cargo.toml +0 -6
  44. package/action.yml +0 -50
  45. package/biome.json +0 -108
  46. package/bun.lock +0 -39
  47. package/docs/SUMMARY.md +0 -3
  48. package/docs/book.toml +0 -49
  49. package/docs/index.md +0 -32
  50. package/pre-commit +0 -2
  51. package/prompt-template.md +0 -180
  52. package/scripts/bump-version.ts +0 -16
  53. package/scripts/generate-rust.ts +0 -9
@@ -1,99 +0,0 @@
1
- $ErrorActionPreference = 'Stop'
2
- Set-StrictMode -Version Latest
3
-
4
- Write-Host "::group::Prep"
5
-
6
- # validate input and prepare some vars
7
-
8
- switch ($Env:RUNNER_ARCH)
9
- {
10
- "X86" {
11
- $_arch = "386"
12
- }
13
- "X64" {
14
- $_arch = "amd64"
15
- }
16
- default {
17
- Write-Host "Cannot handle arch of type $Env:RUNNER_ARCH"
18
- Write-Host "Expected one of: [ X86 X64 ]"
19
- exit 1
20
- }
21
- }
22
-
23
- $_base_url = "https://github.com/mikefarah/yq/releases/download"
24
-
25
- $_root_name = "yq_windows_${_arch}"
26
- $_bin_name = "${_root_name}.exe"
27
-
28
- Write-Host "Creating temporary directory $Env:RUNNER_TEMP\${_root_name}\"
29
- New-Item "$Env:RUNNER_TEMP\${_root_name}\" -ItemType Directory -Force
30
-
31
- if ($Env:DL_COMPRESSED -eq "true")
32
- {
33
- $_dl_name = "${_root_name}.zip"
34
- $_dl_path = "$Env:RUNNER_TEMP\${_dl_name}"
35
- }
36
- else
37
- {
38
- $_dl_name = "${_bin_name}"
39
- $_dl_path = "$Env:RUNNER_TEMP\${_root_name}\${_dl_name}"
40
- Write-Host "Creating temporary directory $Env:RUNNER_TEMP\${_root_name}\"
41
- New-Item "$Env:RUNNER_TEMP\${_root_name}\" -ItemType Directory -Force
42
- }
43
-
44
- $_version = "$Env:YQ_VERSION"
45
-
46
- # default to _something_...
47
- if ($_version -eq "")
48
- {
49
- $_version = "v4.44.3"
50
- }
51
-
52
- $_dl_url = "${_base_url}/${_version}/${_dl_name}"
53
-
54
- Write-Host "::endgroup::"
55
-
56
- # download artifact
57
-
58
- Write-Host "::group::Downloading yq ${_version}"
59
-
60
- Write-Host "Src: ${_dl_url}"
61
- Write-Host "Dst: ${_dl_path}"
62
-
63
- Invoke-WebRequest -Uri "${_dl_url}" -OutFile "${_dl_path}"
64
-
65
- Write-Host "::endgroup::"
66
-
67
- # expand archive, if necessary
68
-
69
- if ($Env:DL_COMPRESSED -eq "true")
70
- {
71
- Write-Host "::group::Expanding archive"
72
-
73
- Expand-Archive -LiteralPath "${_dl_path}" -DestinationPath "$Env:RUNNER_TEMP\${_root_name}\"
74
-
75
- Write-Host "Removing ${_dl_path}"
76
- Remove-Item -Force -Path "${_dl_path}"
77
-
78
- Write-Host "::endgroup::"
79
- }
80
-
81
- # install into tool cache
82
-
83
- Write-Host "::group::Copying to tool cache"
84
-
85
- Write-Host "Creating tool cache directory $Env:RUNNER_TOOL_CACHE\yq\"
86
- New-Item "$Env:RUNNER_TOOL_CACHE\yq\" -ItemType Directory -Force
87
-
88
- Write-Host "Installing into tool cache:"
89
- Write-Host "Src: $Env:RUNNER_TEMP\${_root_name}\${_bin_name}"
90
- Write-Host "Dst: $Env:RUNNER_TOOL_CACHE\yq\yq.exe"
91
- Move-Item -Force -LiteralPath "$Env:RUNNER_TEMP\${_root_name}\${_bin_name}" -Destination "$Env:RUNNER_TOOL_CACHE\yq\yq.exe"
92
-
93
- Write-Host "Removing $Env:RUNNER_TEMP\${_root_name}"
94
- Remove-Item -Force -Recurse -Path "$Env:RUNNER_TEMP\${_root_name}"
95
-
96
- Write-Host "Adding $Env:RUNNER_TOOL_CACHE\yq\ to path..."
97
- Add-Content "$Env:GITHUB_PATH" "$Env:RUNNER_TOOL_CACHE\yq\"
98
-
99
- Write-Host "::endgroup::"
@@ -1,29 +0,0 @@
1
- name: 'Jobtaker Review'
2
- description: 'Runs Claude Code jobtaker with provided config'
3
- inputs:
4
- config:
5
- description: 'JSON config from rust-config action'
6
- required: true
7
- anthropic_api_key:
8
- description: 'Anthropic API key'
9
- required: true
10
-
11
- runs:
12
- using: 'composite'
13
- steps:
14
- - name: jobtaker
15
- if: ${{ fromJSON(inputs.config).ai.enabled }}
16
- uses: anthropics/claude-code-action@v1
17
- with:
18
- anthropic_api_key: ${{ inputs.anthropic_api_key }}
19
- trigger_phrase: '@jobtaker'
20
- allowed_bots: ${{ fromJSON(inputs.config).ai.allowed_bots }}
21
- prompt_file: claude-prompt.md
22
- claude_args: ${{ fromJSON(inputs.config).ai.claude_args }}
23
- use_sticky_comment: ${{ fromJSON(inputs.config).ai.use_sticky_comment }}
24
- track_progress: "${{ fromJSON(inputs.config).ai.track_progress }}"
25
- path_to_claude_code_executable: ''
26
- path_to_bun_executable: ''
27
- show_full_output: 'false'
28
- plugins: ''
29
- plugin_marketplaces: ''
@@ -1,34 +0,0 @@
1
- name: Rust CI Config
2
- description: Merge Rust CI Config
3
- inputs:
4
- git_token:
5
- description: 'Token to authenticate for git'
6
- required: false
7
- arm64:
8
- default: "ubicloud-standard-8-arm"
9
- required: false
10
- amd64:
11
- default: "ubicloud-standard-4"
12
- required: false
13
- outputs:
14
- config:
15
- description: 'Configuration JSON output'
16
- value: ${{ steps.config.outputs.config }}
17
- runs:
18
- using: composite
19
- steps:
20
- - name: Checkout code
21
- uses: actions/checkout@v6
22
- with:
23
- token: ${{ inputs.git_token || github.token }}
24
- - name: generate
25
- id: generate
26
- uses: dougefresh/ci@main
27
- - name: replace runners
28
- id: config
29
- shell: bash
30
- run: |
31
- CONFIG="$(echo '${{ steps.generate.outputs.config }}' | sed \
32
- -e 's/vars.RUNNER_ARM64/${{ inputs.arm64 }}/g' \
33
- -e 's/vars.RUNNER_AMD64/${{ inputs.amd64 }}/g')"
34
- echo "config=$CONFIG" >> $GITHUB_OUTPUT
@@ -1,75 +0,0 @@
1
- name: Rust Init
2
- description: Initialize a Rust project with a basic structure and dependencies.
3
- inputs:
4
- git_token:
5
- description: 'Token to authenticate for git'
6
- required: false
7
- packages:
8
- description: 'Packages to install per OS, see .github/ci-configs/rust-default.yml'
9
- required: false
10
- default: ''
11
- ref:
12
- description: 'Ref to checkout'
13
- required: false
14
- default: ''
15
- runs:
16
- using: composite
17
- steps:
18
- - name: Checkout code
19
- uses: actions/checkout@v6
20
- with:
21
- token: ${{ inputs.git_token || github.token }}
22
- ref: ${{ inputs.ref }}
23
- - name: cache
24
- uses: ubicloud/rust-cache@v2
25
- with:
26
- cache-on-failure: 'true'
27
- - uses: actions-rust-lang/setup-rust-toolchain@v1
28
- with:
29
- toolchain: stable,nightly
30
- components: rustfmt,clippy
31
- # - name: Install nightyly
32
- # id: toolchain-nightly
33
- # uses: dtolnay/rust-toolchain@nightly
34
- # with:
35
- # components: "rustfmt,clippy"
36
- # - name: Install stable
37
- # id: toolchain-stable
38
- # shell: bash
39
- # run: |
40
- # rustup toolchain install stable --component clippy --profile minimal --no-self-update
41
- # rustup default stable
42
- # echo "name=stable" >> $GITHUB_OUTPUT
43
- - name: Debug versions
44
- shell: bash
45
- run: |
46
- cargo +nightly --version
47
- cargo +stable --version
48
-
49
- - name: packages
50
- shell: bash
51
- if: ${{ inputs.packages }}
52
- run: |
53
- set -x
54
- packages=""
55
- case $RUNNER_OS in
56
- Linux)
57
- packages="${{ fromJSON(inputs.packages).Linux }}"
58
- ;;
59
- macOS)
60
- packages="${{ fromJSON(inputs.packages).macOS }}"
61
- ;;
62
- *)
63
- echo "Cannot handle OS of type $RUNNER_OS"
64
- echo "Expected one of: [ Linux macOS ]"
65
- exit 0
66
- ;;
67
- esac
68
-
69
- if [ -z "$packages" ]; then
70
- echo "No packages to install"
71
- exit 0
72
- fi
73
-
74
- echo "Installing packages: $packages"
75
- sudo $packages
@@ -1,62 +0,0 @@
1
- # Configuration Validation
2
-
3
- Before performing code review, validate your environment and permissions:
4
-
5
- ## Tool Access
6
-
7
- Verify you can execute these commands:
8
- - `cargo check` / `cargo test` / `cargo clippy`
9
- - `bun run build` / `bun test`
10
- - `tsgo` (TypeScript compiler wrapper)
11
-
12
- If any tool fails, note it in your review.
13
-
14
- ## Permission Audit
15
-
16
- Examine `claude_args` in `./src/defaults.ts` (variable: `DEFAULT_AI`):
17
-
18
- 1. **Tool allowlist**: Verify the comma-separated list is syntactically correct
19
- 2. **Security review**: Assess each allowed tool pattern for potential abuse:
20
- - `Bash(*)` patterns: What commands could be chained?
21
- - `mcp__github_inline_comment__*`: What GitHub API access is granted?
22
- - File system access: Can sensitive files be read/modified?
23
-
24
- 3. **Risk assessment**: For each concern, provide:
25
- - Attack vector example
26
- - Likelihood (high/medium/low)
27
- - Mitigation suggestion
28
-
29
- Only flag **high likelihood** issues as blocking. Document medium/low risks for awareness.
30
-
31
- ## Configuration Sync
32
-
33
- Compare workflow inputs in `.github/workflows/pr-review.yml` against `DEFAULT_AI` schema:
34
- - Are all `fromJSON(needs.config.outputs.config).ai.*` fields defined in `DEFAULT_AI`?
35
- - Do boolean/string types match between workflow and TypeScript?
36
-
37
- Report mismatches as configuration bugs.
38
-
39
- ## User Config Validation
40
-
41
- If `.github/rust-ci.ts` exists, validate it:
42
-
43
- 1. **Syntax**: Does it export a default function returning a `RustWorkflow`?
44
- 2. **Logic**: Check for contradictions:
45
- - Jobs disabled but referenced in other configs
46
- - Empty matrices (no OS/toolchains/features)
47
- - Invalid arch values (not in `Arch` enum)
48
- 3. **Workflow impact**: What jobs will actually run? Flag if all jobs are disabled.
49
-
50
- ## Workflow Integrity
51
-
52
- Validate `.github/workflows/pr-review.yml`:
53
-
54
- 1. **Job dependencies**: Does `needs: [config]` chain correctly? Are outputs referenced before they exist?
55
- 2. **Conditional logic**: Do all `if:` conditions reference valid event properties?
56
- 3. **Secret validation**: Is `ANTHROPIC_API_KEY` checked before use?
57
- 4. **Action versions**: Are pinned versions used (`@v1`, `@main`)? Flag unpinned refs.
58
- 5. **Runner variables**: Are `vars.RUNNER*` placeholders resolved by the config action?
59
- 6. **Input/output flow**: Trace `config.outputs.config` → `fromJSON()` → action inputs. Are all paths valid JSON?
60
-
61
- Flag any broken references, missing dependencies, or unreachable code paths.
62
-
@@ -1,24 +0,0 @@
1
- '$schema': https://github.com/CarteraMesh/ci/raw/refs/heads/main/schemas/rust-ci-config.schema.json
2
-
3
- release:
4
- cargo-publish: false
5
- debian: false
6
- profile: release
7
- bin: dummy
8
- os:
9
- - target: 'aarch64-unknown-linux-gnu'
10
- os: 'ubicloud-standard-8-arm64'
11
-
12
- jobs:
13
- semver:
14
- if: false
15
- continue-on-error: true
16
- extra:
17
- if: true
18
- continue-on-error: false
19
- name: extra-dummy
20
- run: echo "Running extra job"
21
-
22
- pages:
23
- mdbook:
24
- if: true
@@ -1,65 +0,0 @@
1
- ai:
2
- enabled: true
3
- allowed_bots: '*'
4
- claude_args: ''
5
- use_sticky_comment: false
6
- track_progress: true
7
- prompt: |
8
- Perform a comprehensive code review with the following focus areas:
9
- Provide detailed feedback using inline comments for ONLY issues, no praise inline comments.
10
- Use top-level comments for general observations or praise
11
- Do not be shy, I am a big boy and can handle criticism gracefully. I welcome feedback and suggestions.
12
-
13
- Review this PR against our team checklist:
14
-
15
- ## Code Quality
16
- - [ ] Code follows our style guide
17
- - [ ] No commented-out code
18
- - [ ] Meaningful variable names
19
- - [ ] DRY principle followed
20
-
21
- ## Testing
22
- - [ ] Unit tests for new functions
23
- - [ ] Integration tests for new endpoints
24
- - [ ] Edge cases covered
25
- - [ ] Test coverage > 80%
26
-
27
- ## Documentation
28
- - [ ] README updated if needed
29
- - [ ] API docs updated
30
- - [ ] Inline comments for complex logic
31
- - [ ] CHANGELOG.md updated
32
-
33
- ## Security
34
- - [ ] No hardcoded credentials
35
- - [ ] Input validation implemented
36
- - [ ] Proper error handling
37
- - [ ] No sensitive data in logs
38
-
39
- For each item, check if it is satisfied and comment on any that need attention.
40
- Post a summary comment with checklist results.
41
- # https://code.claude.com/docs/en/settings
42
- # https://www.schemastore.org/claude-code-settings.json
43
- settings:
44
- attribution:
45
- commit: 'Generated with JobsTaker'
46
- pr: ''
47
- permissions:
48
- allow:
49
- - mcp__github_inline_comment__create_inline_comment,
50
- - Bash(gh pr comment:*),
51
- - Bash(gh pr diff:*),
52
- - Bash(gh pr view:*),
53
- - Bash(grep .*),
54
- - Bash(rg .*),
55
- - Bash(npm run lint)
56
- - Bash(npm run test:*)
57
- - Bash(cargo .*)
58
- deny:
59
- - Bash(cargo publis.*)
60
- # - Read(./.env)
61
- # - Read(./.env.*)
62
- # - Read(./secrets/**)
63
- env:
64
- CLAUDE_CODE_ENABLE_TELEMETRY: '0'
65
- OTEL_METRICS_EXPORTER: otlp
@@ -1,115 +0,0 @@
1
- global:
2
- # to match $RUNNER_OS
3
- packages:
4
- Linux: ''
5
- macOS: ''
6
- Windows: ''
7
- toolchains:
8
- - stable
9
- - nightly
10
- features:
11
- - default
12
- rustlog: info
13
- fireblocks:
14
- enabled: false
15
- set-env-vars: true
16
-
17
- pages:
18
- mdbook:
19
- if: false
20
- path: docs
21
- version: latest
22
- command: mdbook build
23
-
24
- release:
25
- cargo-publish: true # release to cargo, otherwise just tag
26
- debian: false
27
- profile: 'release'
28
- os:
29
- - target: aarch64-unknown-linux-gnu
30
- os: ubicloud-standard-8-arm
31
- - target: x86_64-unknown-linux-gnu
32
- os: ubicloud-standard-4
33
- - target: aarch64-apple-darwin
34
- os: macos-latest
35
- # - target: x86_64-pc-windows-msvc
36
- # os: windows-latest
37
- jobs:
38
- coverage:
39
- if: true
40
- continue-on-error: false
41
- args:
42
- test: ''
43
- llvm: ''
44
- run: |
45
- cmd="cargo llvm-cov ${LLVM_ARGS} --locked --lcov --output-path lcov-${FEATURES}.info --no-fail-fast"
46
- if [ "$FEATURES" == "default" ]; then
47
- $cmd -- --no-capture $CARGO_ARGS
48
- else
49
- $cmd --features "$FEATURES" -- --no-capture $CARGO_ARGS
50
- fi
51
- matrix:
52
- os: []
53
- toolchains:
54
- - stable
55
- features:
56
- - default
57
- fmt:
58
- if: true
59
- continue-on-error: false
60
- run: cargo +nightly fmt --check --all
61
- clippy:
62
- if: true
63
- continue-on-error: false
64
- flags: ''
65
- matrix:
66
- os: []
67
- toolchains:
68
- - stable
69
- features:
70
- - default
71
-
72
- semver:
73
- if: true
74
- continue-on-error: false
75
- hack:
76
- if: true
77
- continue-on-error: false
78
- run: cargo hack --feature-powerset check
79
- doc:
80
- if: true
81
- continue-on-error: false
82
- run: cargo +nightly docs-rs
83
-
84
- cargo-sort:
85
- if: true
86
- continue-on-error: false
87
- run: |
88
- if [ -f ./scripts/cargo-sort.sh ]; then
89
- ./scripts/cargo-sort.sh
90
- else
91
- cargo sort -c -g
92
- fi
93
- dependencies:
94
- if: true
95
- continue-on-error: false
96
- run: cargo machete --with-metadata
97
-
98
- sanitizers:
99
- enabled: true
100
- matrix:
101
- os: []
102
- features:
103
- - default
104
- address:
105
- if: true
106
- continue-on-error: false
107
- run: cargo test --lib --tests --no-fail-fast --target x86_64-unknown-linux-gnu -- --no-capture
108
- leak:
109
- if: true
110
- continue-on-error: false
111
- run: cargo test --target x86_64-unknown-linux-gnu -- --no-capture
112
- thread:
113
- if: false
114
- continue-on-error: false
115
- run: cargo test --target x86_64-unknown-linux-gnu -- --test-threads=1
@@ -1,9 +0,0 @@
1
- global:
2
- packages:
3
- Linux: 'curl'
4
- rustlog: debug
5
- fireblocks:
6
- enabled: true
7
- jobs:
8
- coverage:
9
- if: false
@@ -1,26 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: github-actions
4
- directory: /
5
- schedule:
6
- interval: weekly
7
- groups:
8
- actions-minor:
9
- update-types:
10
- - minor
11
- - patch
12
-
13
- - package-ecosystem: npm
14
- directory: /
15
- schedule:
16
- interval: weekly
17
- groups:
18
- npm-development:
19
- dependency-type: development
20
- update-types:
21
- - minor
22
- - patch
23
- npm-production:
24
- dependency-type: production
25
- update-types:
26
- - patch
@@ -1,29 +0,0 @@
1
- # Create Release Notes
2
-
3
- You are an expert technical writer tasked with creating release notes for updates to this repository. Your specific task
4
- is to generate release notes that are clear, concise, and useful for developers and users of the project.
5
-
6
- ## Guidelines
7
-
8
- Ensure you adhere to the following guidelines when creating release notes:
9
-
10
- - Use a clear and consistent format for the release notes
11
- - Include a summary of the changes made in the release
12
- - Highlight any new features, improvements, or bugfixes
13
- - If applicable, include instructions for upgrading or migrating to the new version
14
- - Use technical language that is appropriate for the audience, but avoid jargon that may not be understood by all users
15
- - Ensure that the release notes are easy to read and navigate
16
- - Include relevant issue or PR numbers where applicable
17
- - Use proper Markdown formatting
18
- - Use code blocks for commands, configuration examples, or code changes
19
- - Use note and warning callouts for important information
20
-
21
- ## Versioning
22
-
23
- GitHub Actions are versioned using branch and tag names. The version in the project's `package.json` should reflect the
24
- changes made in the codebase and follow [Semantic Versioning](https://semver.org/) principles. Depending on the nature
25
- of the changes, please make sure to adjust the release notes accordingly:
26
-
27
- - For **major** changes, include a detailed description of the breaking changes and how users can adapt to them
28
- - For **minor** changes, highlight new features and improvements
29
- - For **patch** changes, focus on bugfixes and minor improvements
@@ -1,77 +0,0 @@
1
- # Create Unit Test(s)
2
-
3
- You are an expert software engineer tasked with creating unit tests for the repository. Your specific task is to
4
- generate unit tests that are clear, concise, and useful for developers working on the project.
5
-
6
- ## Guidelines
7
-
8
- Ensure you adhere to the following guidelines when creating unit tests:
9
-
10
- - Use a clear and consistent format for the unit tests
11
- - Include a summary of the functionality being tested
12
- - Use descriptive test names that clearly convey their purpose
13
- - Ensure tests cover both the main path of success and edge cases
14
- - Use proper assertions to validate the expected outcomes
15
- - Use `jest` for writing and running tests
16
- - Place unit tests in the `__tests__` directory
17
- - Use fixtures for any necessary test data, placed in the `__fixtures__` directory
18
-
19
- ## Example
20
-
21
- Use the following as an example of how to structure your unit tests:
22
-
23
- ```typescript
24
- /**
25
- * Unit tests for the action's main functionality, src/main.ts
26
- */
27
- import { jest } from '@jest/globals';
28
- import * as core from '../__fixtures__/core.js';
29
- import { wait } from '../__fixtures__/wait.js';
30
-
31
- // Mocks should be declared before the module being tested is imported.
32
- jest.unstable_mockModule('@actions/core', () => core);
33
- jest.unstable_mockModule('../src/wait.js', () => ({ wait }));
34
-
35
- // The module being tested should be imported dynamically. This ensures that the
36
- // mocks are used in place of any actual dependencies.
37
- const { run } = await import('../src/main.js');
38
-
39
- describe('main.ts', () => {
40
- beforeEach(() => {
41
- // Set the action's inputs as return values from core.getInput().
42
- core.getInput.mockImplementation(() => '500');
43
-
44
- // Mock the wait function so that it does not actually wait.
45
- wait.mockImplementation(() => Promise.resolve('done!'));
46
- });
47
-
48
- afterEach(() => {
49
- jest.resetAllMocks();
50
- });
51
-
52
- it('Sets the time output', async () => {
53
- await run();
54
-
55
- // Verify the time output was set.
56
- expect(core.setOutput).toHaveBeenNthCalledWith(
57
- 1,
58
- 'time',
59
- // Simple regex to match a time string in the format HH:MM:SS.
60
- expect.stringMatching(/^\d{2}:\d{2}:\d{2}/),
61
- );
62
- });
63
-
64
- it('Sets a failed status', async () => {
65
- // Clear the getInput mock and return an invalid value.
66
- core.getInput.mockClear().mockReturnValueOnce('this is not a number');
67
-
68
- // Clear the wait mock and return a rejected promise.
69
- wait.mockClear().mockRejectedValueOnce(new Error('milliseconds is not a number'));
70
-
71
- await run();
72
-
73
- // Verify that the action was marked as failed.
74
- expect(core.setFailed).toHaveBeenNthCalledWith(1, 'milliseconds is not a number');
75
- });
76
- });
77
- ```
@@ -1,5 +0,0 @@
1
- import { createRustWorkflow } from '@dougefresh/ci';
2
-
3
- export default function () {
4
- return createRustWorkflow().extra('test-extra', 'echo hello').semver(false).disableSanitizers().build();
5
- }