-
Notifications
You must be signed in to change notification settings - Fork 0
cleanup & fixes & general improvements #1
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,70 @@ | ||
| name: test-action | ||
| on: [pull_request,workflow_dispatch] | ||
| on: [pull_request, workflow_dispatch] | ||
|
|
||
| jobs: | ||
| func: | ||
| test-default: | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest,windows-latest,macos-latest] | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup func CLI | ||
| uses: ./ | ||
| - run: func version | ||
|
|
||
| test-custom-version: | ||
gauron99 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| runs-on: ubuntu-latest | ||
| env: | ||
| TEST_VERSION: '1.19.0' | ||
| VERSION_OFFSET: 27 # internal version = minor + offset (v1.19 → v0.46) | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup func CLI with custom version | ||
| uses: ./ | ||
| with: | ||
| version: 'v${{ env.TEST_VERSION }}' | ||
| - name: Verify version | ||
| run: | | ||
| MINOR=$(echo "$TEST_VERSION" | cut -d. -f2) | ||
| INTERNAL=$((MINOR + VERSION_OFFSET)) | ||
| func version | grep -q "v0.${INTERNAL}" | ||
|
|
||
| test-custom-name: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup func CLI with custom name | ||
| uses: ./ | ||
| with: | ||
| name: 'my-func' | ||
| - run: my-func version | ||
|
|
||
| test-custom-destination: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup func CLI with custom destination | ||
| uses: ./ | ||
| with: | ||
| destination: '/tmp/func-bin' | ||
| - run: func version | ||
| - name: Verify func using path | ||
| run: /tmp/func-bin/func version | ||
|
|
||
| test-invalid-version: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: functions-dev/action@main | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup func CLI with non-existing version (should fail) | ||
| id: invalid-version | ||
| uses: ./ | ||
| with: | ||
| version: 'v99.99.99' | ||
| continue-on-error: true | ||
| - name: Verify action failed | ||
| run: | | ||
| if [ "${{ steps.invalid-version.outcome }}" != "failure" ]; then | ||
| echo "Expected action to fail with invalid version" | ||
| exit 1 | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,21 @@ | ||
| # Functions as Github Action! | ||
| Functions' Github Action, so you can get Functions in your workflows! | ||
| Automatically determines what os the GH Runner has to get the right binary. | ||
| You can change where you want the `func` to be downloaded with `destination` - regardless, it will be in `$PATH`! | ||
| By default, uses latest version, but you can specify which one you want using `version`. | ||
| # Func Action | ||
|
|
||
| GitHub Action to download and setup the func CLI. Automatically detects OS and architecture. | ||
|
|
||
| ## Usage | ||
|
|
||
| `action.yml` -- action yaml with descriptions | ||
| ```yaml | ||
| name: 'Func Action' | ||
| description: 'This action does custom stuff for it is custom' | ||
| inputs: | ||
| name: | ||
| description: '(optional) Name of the Function binary. It will be available in the runner under this name(defaults to "func")' | ||
| binary: | ||
| description: '(optional) Binary you want to download (exact string expected), otherwise will be determined via the OS of GH Runner' | ||
| version: | ||
| description: '(optional) Provide version to download. Any version in release pages works https://github.com/knative/func/tags' | ||
| destination: | ||
| description: '(optional) Provide a path where to move the desired downloaded binary, otherwise cwd is used' | ||
| runs: | ||
| using: 'node20' | ||
| main: 'index.js' | ||
| - uses: functions-dev/action@main | ||
| with: | ||
| version: 'v1.20.0' # optional | ||
| name: 'func' # optional | ||
| ``` | ||
|
|
||
| ## Inputs | ||
|
|
||
| | Input | Description | Default | | ||
| |-------|-------------|---------| | ||
| | `version` | Version to download (e.g. `v1.20.0`) | recent stable | | ||
| | `name` | Binary name | `func` | | ||
| | `binary` | Specific binary to download | auto-detected | | ||
| | `destination` | Download directory | cwd | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,16 @@ | ||
| name: 'Func Action' | ||
| description: 'This action does custom stuff for it is custom' | ||
| description: 'Downloads and sets up the func CLI for Functions' | ||
| inputs: | ||
| name: | ||
| description: '(optional) Name of the Function binary. It will be available in the runner under this name(defaults to "func")' | ||
| description: '(optional) Name of the binary (defaults to "func")' | ||
| binary: | ||
| description: '(optional) Binary you want to download (exact string expected), otherwise will be determined via the OS of GH Runner' | ||
| version: | ||
| description: '(optional) Provide version to download. Any version in release pages works https://github.com/knative/func/tags' | ||
| destination: | ||
| description: '(optional) Provide a path where to move the desired downloaded binary, otherwise cwd is used' | ||
| binarySource: | ||
| description: '(optional) Base URL for downloading binaries. Defaults to GitHub releases. Pattern: <url-base>/<version>/<os-bin-name>' | ||
| runs: | ||
| using: 'node20' | ||
| main: 'index.js' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.