Skip to content
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

feat: adds build and integrate targets #55

Merged
merged 2 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions .github/workflows/dogfood.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,40 @@ permissions:

jobs:
check:
uses: ./.github/workflows/check.yml
uses: ./.github/workflows/run.yml
with:
aws_role_arn: arn:aws:iam::332405224602:role/ci
aws_region: eu-central-1
ci_cli_version: 1.3.1
target: check
secrets:
earthly_runner_address: ${{ secrets.EARTHLY_SATELLITE_ADDRESS }}
earthly_runner_secret: ${{ secrets.EARTHLY_RUNNER_SECRET }}
build:
uses: ./.github/workflows/run.yml
needs: [check]
with:
aws_role_arn: arn:aws:iam::332405224602:role/ci
aws_region: eu-central-1
ci_cli_version: 1.3.1
target: build
secrets:
earthly_runner_address: ${{ secrets.EARTHLY_SATELLITE_ADDRESS }}
earthly_runner_secret: ${{ secrets.EARTHLY_RUNNER_SECRET }}
integrate:
uses: ./.github/workflows/run.yml
needs: [build, check]
with:
aws_role_arn: arn:aws:iam::332405224602:role/ci
aws_region: eu-central-1
ci_cli_version: 1.3.1
target: integrate
secrets:
earthly_runner_address: ${{ secrets.EARTHLY_SATELLITE_ADDRESS }}
earthly_runner_secret: ${{ secrets.EARTHLY_RUNNER_SECRET }}
release:
uses: ./.github/workflows/release.yml
needs: [check]
needs: [build, check, integrate]
with:
aws_role_arn: arn:aws:iam::332405224602:role/ci
aws_region: eu-central-1
Expand All @@ -30,7 +53,7 @@ jobs:
earthly_runner_secret: ${{ secrets.EARTHLY_RUNNER_SECRET }}
publish:
uses: ./.github/workflows/publish.yml
needs: [release]
needs: [build, check, integrate]
with:
aws_ecr_registry: 332405224602.dkr.ecr.eu-central-1.amazonaws.com
aws_role_arn: arn:aws:iam::332405224602:role/ci
Expand Down
99 changes: 99 additions & 0 deletions .github/workflows/run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# WARNING: If you modify this workflow, please update the documentation

on:
workflow_call:
inputs:
target:
description: |
The target to run.
required: true
type: string
aws_role_arn:
description: |
The ARN of the AWS role that will be assumed by the workflow. Only
required when configuring a remote Earthly runner.
required: false
type: string
aws_region:
description: |
The AWS region that will be used by the workflow. Only required when
configuring a remote Earthly runner.
required: false
type: string
ci_cli_version:
description: |
The version of the CI CLI to use.
required: false
type: string
default: latest
earthly_version:
description: The version of Earthly to use.
required: false
type: string
default: latest
secrets:
earthly_runner_address:
description: |
The address of the Earthly runner that will be used to build the
Earthly files.
required: false
earthly_runner_secret:
description: |
The ID of the AWS secret holding Earthly remote runner credentials.
This secret must contain the runner address and the necessary TLS
certificates required to authenticate with it. If omitted, a remote
Earthly runner will not be configured.
required: false

jobs:
discover:
runs-on: ubuntu-latest
outputs:
json: ${{ steps.check.outputs.json }}
steps:
- uses: actions/checkout@v3
- name: Setup CI
uses: input-output-hk/catalyst-ci/actions/setup@master
with:
cli_version: ${{ inputs.ci_cli_version }}
earthly_skip_install: "true"
- name: Discover Earthly files
uses: input-output-hk/catalyst-ci/actions/discover@master
id: discover
with:
targets: ${{ inputs.target }}
- name: Check for empty output
id: check
run: |
output=$(echo '${{ steps.discover.outputs.json }}' | jq -rc)
if [ "$output" == "null" ]; then
echo "json=[]" >> $GITHUB_OUTPUT
else
echo "json=$output" >> $GITHUB_OUTPUT
fi

build:
runs-on: ubuntu-latest
needs: [discover]
if: needs.discover.outputs.json != '[]'
strategy:
fail-fast: false
matrix:
earthfile: ${{ fromJson(needs.discover.outputs.json) }}
steps:
- uses: actions/checkout@v3
- name: Setup CI
uses: input-output-hk/catalyst-ci/actions/setup@master
with:
aws_role_arn: ${{ inputs.aws_role_arn }}
aws_region: ${{ inputs.aws_region }}
cli_version: ${{ inputs.ci_cli_version }}
earthly_version: ${{ inputs.earthly_version }}
earthly_runner_secret: ${{ secrets.earthly_runner_secret }}
- name: Run
uses: input-output-hk/catalyst-ci/actions/run@master
id: build
with:
earthfile: ${{ matrix.earthfile }}
target: ${{ inputs.target }}
runner_address: ${{ secrets.earthly_runner_address }}