Skip to content

ci: add Earthfile target for CI and update GitHub workflow #499

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

Closed
wants to merge 3 commits into from
Closed
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
51 changes: 14 additions & 37 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Dirty:
Earthly:
runs-on: "ubuntu-latest"
steps:
- uses: 'actions/checkout@v4'
Expand All @@ -39,47 +39,24 @@ jobs:
--allow-privileged
--secret SPEAKEASY_API_KEY=$SPEAKEASY_API_KEY
${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }}
+pre-commit
env:
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}
- name: Get changed files
id: changed-files
shell: bash
run: |
hasChanged=$(git status --porcelain)
if (( $(echo ${#hasChanged}) != 0 )); then
git status
echo "There are changes in the repository"
exit 1
fi

Tests:
runs-on: "ubuntu-latest"
needs:
- Dirty
steps:
- uses: 'actions/checkout@v4'
with:
fetch-depth: 0
- name: Setup Env
uses: ./.github/actions/env
with:
token: ${{ secrets.NUMARY_GITHUB_TOKEN }}
- run: >
earthly
--no-output
--allow-privileged
--secret SPEAKEASY_API_KEY=$SPEAKEASY_API_KEY
${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }}
+tests
github.com/formancehq/earthly+run-ci --project=ledger --commit=$COMMIT
env:
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}
COMMIT: ${{ github.sha }}
# - name: Get changed files
# id: changed-files
# shell: bash
# run: |
# hasChanged=$(git status --porcelain)
# if (( $(echo ${#hasChanged}) != 0 )); then
# git status
# echo "There are changes in the repository"
# exit 1
# fi

GoReleaser:
runs-on: "ubuntu-latest"
if: contains(github.event.pull_request.labels.*.name, 'build-images') || github.ref == 'refs/heads/main' || github.event_name == 'merge_group'
needs:
- Dirty
steps:
- uses: earthly/actions-setup@v1
with:
Expand Down Expand Up @@ -120,7 +97,7 @@ jobs:
environment: staging
needs:
- GoReleaser
- Tests
- Earthly
steps:
- uses: earthly/actions-setup@v1
with:
Expand Down
Loading