wip: testing #1
Workflow file for this run
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
on: | ||
workflow_call: | ||
inputs: | ||
forge_version: | ||
description: | | ||
The version of the forge CLI to install (use 'local' for testing) | ||
type: string | ||
required: false | ||
default: latest | ||
secrets: | ||
earthly_token: | ||
description: Optional Earthly token used to login to Earthly cloud during local builds of Forge CLI | ||
required: false | ||
env: | ||
FORGE_REGEX_CHECK: ^check(-.*)?$ | ||
FORGE_REGEX_BUILD: ^build(-.*)?$ | ||
FORGE_REGEX_PACKAGE: ^package(-.*)?$ | ||
FORGE_REGEX_TEST: ^test(-.*)?$ | ||
FORGE_REGEX_RELEASE: ^release(-.*)?$ | ||
FORGE_REGEX_PUBLISH: ^publish(-.*)?$ | ||
jobs: | ||
discover: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
result: ${{ steps.discovery.outputs.result }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Forge | ||
uses: input-output-hk/catalyst-forge/actions/install@master | ||
if: ${{ inputs.forge_version != 'local' }} | ||
with: | ||
version: ${{ inputs.forge_version }} | ||
- name: Install Local Forge | ||
uses: input-output-hk/catalyst-forge/actions/install-local@master | ||
if: ${{ inputs.forge_version == 'local' }} | ||
with: | ||
earthly_token: ${{ secrets.earthly_token }} | ||
- name: Check forge version | ||
id: local | ||
run: | | ||
forge version | ||
if [[ "${{ inputs.forge_version }}" == "local" ]]; then | ||
echo "skip=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "skip=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Setup CI | ||
uses: input-output-hk/catalyst-forge/actions/setup@master | ||
with: | ||
skip_docker: 'true' | ||
skip_github: 'true' | ||
skip_earthly: ${{ steps.local.outputs.skip }} | ||
- name: Discovery | ||
id: discovery | ||
uses: input-output-hk/catalyst-forge/actions/discovery@master | ||
with: | ||
filters: | | ||
^check(-.*)?$ | ||
^build(-.*)?$ | ||
^package(-.*)?$ | ||
^test(-.*)?$ | ||
^release(-.*)?$ | ||
^publish(-.*)?$ | ||
check: | ||
uses: ./.github/workflows/run.yml | ||
needs: [discover] | ||
if: (fromJson(needs.discover.outputs.result)['^check(-.*)?$'] != null) && !failure() && !cancelled() | ||
with: | ||
earthfiles: ${{ toJson(fromJson(needs.discover.outputs.result)['^check(-.*)?$']) }} | ||
forge_version: ${{ inputs.forge_version }} | ||
secrets: | ||
earthly_token: ${{ secrets.earthly_token }} | ||
build: | ||
uses: ./.github/workflows/run.yml | ||
needs: [discover, check] | ||
if: (fromJson(needs.discover.outputs.result)['^build(-.*)?$'] != null) && !failure() && !cancelled() | ||
with: | ||
earthfiles: ${{ toJson(fromJson(needs.discover.outputs.result)['^build(-.*)?$']) }} | ||
forge_version: ${{ inputs.forge_version }} | ||
secrets: | ||
earthly_token: ${{ secrets.earthly_token }} | ||
package: | ||
uses: ./.github/workflows/run.yml | ||
needs: [discover, check, build] | ||
if: (fromJson(needs.discover.outputs.result)['^package(-.*)?$'] != null) && !failure() && !cancelled() | ||
with: | ||
earthfiles: ${{ toJson(fromJson(needs.discover.outputs.result)['^package(-.*)?$']) }} | ||
forge_version: ${{ inputs.forge_version }} | ||
secrets: | ||
earthly_token: ${{ secrets.earthly_token }} | ||
test: | ||
uses: ./.github/workflows/run.yml | ||
needs: [discover, check, build, package] | ||
if: (fromJson(needs.discover.outputs.result)['^test(-.*)?$'] != null) && !failure() && !cancelled() | ||
with: | ||
earthfiles: ${{ toJson(fromJson(needs.discover.outputs.result)['^test(-.*)?$']) }} | ||
forge_version: ${{ inputs.forge_version }} | ||
secrets: | ||
earthly_token: ${{ secrets.earthly_token }} | ||
publish: | ||
uses: ./.github/workflows/publish.yml | ||
needs: [discover, check, build, test] | ||
if: (fromJson(needs.discover.outputs.result)['^publish(-.*)?$'] != null) && !failure() && !cancelled() | ||
with: | ||
earthfiles: ${{ toJson(fromJson(needs.discover.outputs.result)['^publish(-.*)?$']) }} | ||
forge_version: ${{ inputs.forge_version }} | ||
secrets: | ||
earthly_token: ${{ secrets.earthly_token }} | ||
release: | ||
uses: ./.github/workflows/release.yml | ||
needs: [discover, check, build, test] | ||
if: (fromJson(needs.discover.outputs.result)['^release(-.*)?$'] != null) && !failure() && !cancelled() | ||
with: | ||
earthfiles: ${{ toJson(fromJson(needs.discover.outputs.result)['^release(-.*)?$']) }} | ||
forge_version: ${{ inputs.forge_version }} | ||
secrets: | ||
earthly_token: ${{ secrets.earthly_token }} | ||
final: | ||
needs: [check, build, package, test, publish, release] | ||
if: !failure() && !cancelled() | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Final | ||
run: echo "All done" |