-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds discover and run actions (#13)
- Loading branch information
Showing
33 changed files
with
26,752 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
forge_version: | ||
description: | | ||
The version of the forge CLI to install (use 'local' for testing) | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
discover: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
result: ${{ steps.discovery.outputs.result }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup | ||
uses: ./forge/actions/setup | ||
with: | ||
forge_version: ${{ inputs.forge_version }} | ||
- name: Discovery | ||
id: discovery | ||
uses: ./forge/actions/discovery | ||
with: | ||
filters: | | ||
^build.* | ||
^check.* | ||
^test.* | ||
check: | ||
uses: ./.github/workflows/run.yml | ||
needs: [discover] | ||
with: | ||
earthfiles: ${{ toJson(fromJson(needs.discover.outputs.result)['^check.*']) }} | ||
forge_version: ${{ inputs.forge_version }} | ||
|
||
build: | ||
uses: ./.github/workflows/run.yml | ||
needs: [discover, check] | ||
with: | ||
earthfiles: ${{ toJson(fromJson(needs.discover.outputs.result)['^build.*']) }} | ||
forge_version: ${{ inputs.forge_version }} | ||
|
||
test: | ||
uses: ./.github/workflows/run.yml | ||
needs: [discover, check, build] | ||
with: | ||
earthfiles: ${{ toJson(fromJson(needs.discover.outputs.result)['^test.*']) }} | ||
forge_version: ${{ inputs.forge_version }} |
This file contains 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Dogfood | ||
|
||
on: | ||
push: | ||
|
||
permissions: | ||
id-token: write | ||
contents: write | ||
packages: write | ||
|
||
jobs: | ||
ci: | ||
uses: ./.github/workflows/ci.yml | ||
with: | ||
forge_version: local |
This file contains 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
earthfiles: | ||
description: | | ||
A JSON list of Earthfile paths+targets to run | ||
required: true | ||
type: string | ||
forge_version: | ||
description: | | ||
The version of the forge CLI to install (use 'local' for testing) | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
run: | ||
name: ${{ matrix.earthfile }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
earthfile: ${{ fromJson(inputs.earthfiles) }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup CI | ||
uses: ./forge/actions/setup | ||
with: | ||
forge_version: ${{ inputs.forge_version }} | ||
- name: Run | ||
uses: ./forge/actions/run | ||
with: | ||
path: ${{ matrix.earthfile }} |
This file contains 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Node | ||
node_modules |
This file contains 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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
env: | ||
commonjs: true | ||
es6: true | ||
jest: true | ||
node: true | ||
|
||
globals: | ||
Atomics: readonly | ||
SharedArrayBuffer: readonly | ||
|
||
ignorePatterns: | ||
- 'node_modules/' | ||
- 'dist/' | ||
- 'coverage/' | ||
- '*.json' | ||
|
||
parser: '@babel/eslint-parser' | ||
|
||
parserOptions: | ||
ecmaVersion: 2023 | ||
sourceType: module | ||
requireConfigFile: false | ||
babelOptions: | ||
babelrc: false | ||
configFile: false | ||
presets: | ||
- jest | ||
|
||
plugins: | ||
- jest | ||
|
||
extends: | ||
- eslint:recommended | ||
- plugin:github/recommended | ||
- plugin:jest/recommended | ||
|
||
rules: | ||
{ | ||
'camelcase': 'off', | ||
'eslint-comments/no-use': 'off', | ||
'eslint-comments/no-unused-disable': 'off', | ||
'i18n-text/no-en': 'off', | ||
'import/no-commonjs': 'off', | ||
'import/no-namespace': 'off', | ||
'no-console': 'off', | ||
'no-unused-vars': 'off', | ||
'prettier/prettier': 'error', | ||
'semi': 'off' | ||
} |
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
20.14.0 |
This file contains 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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Discover Action | ||
|
||
The discover action acts as a wrapper over the `forge scan` command from the Forge CLI. | ||
It provides inputs that map to their respective flags. | ||
The result from running the command is returned in the `result` output. | ||
By default, the `--enumerate` flag is passed as this is usually the desired output format in CI. | ||
|
||
For more information on the `scan` command, refer to the Forge CLI documentation. | ||
|
||
## Usage | ||
|
||
```yaml | ||
name: Run Setup | ||
on: | ||
push: | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
jobs: | ||
setup: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup | ||
uses: input-output-hk/catalyst-forge/forge/actions/setup@master | ||
- name: Discover | ||
id: discovery | ||
uses: input-output-hk/catalyst-forge/forge/actions/discover@master | ||
with: | ||
filters: | | ||
^check.* | ||
^test.* | ||
- name: Show result | ||
run: echo "${{ steps.discovery.outputs.result }} | ||
``` | ||
## Inputs | ||
| Name | Description | Required | Default | | ||
| --------- | --------------------------------------------- | -------- | --------- | | ||
| absolute | Output absolute paths | No | `"false"` | | ||
| enumerate | Enumerate results into Earthfile+Target pairs | No | `"true"` | | ||
| filters | A newline separated list of filters to apply | No | `""` | | ||
| path | The path to search from | No | `"."` | |
This file contains 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Discovery | ||
description: Discovers Earthfiles | ||
inputs: | ||
absolute: | ||
description: Output absolute paths | ||
default: "false" | ||
enumerate: | ||
description: Enumerate results into Earthfile+Target pairs | ||
default: "true" | ||
filters: | ||
description: A newline separated list of filters to apply | ||
default: "" | ||
path: | ||
description: The path to search from | ||
default: "." | ||
outputs: | ||
result: | ||
description: The result of the discovery | ||
|
||
runs: | ||
using: node20 | ||
main: dist/index.js |
Oops, something went wrong.