提高单一仓库的开发者体验
作者: mattste创建于 2022年12月6日更新于 2026年4月6日
Approach 1: Earthly top-level
Repo Structure
# Earthfile
all:
WAIT
BUILD +test
END
WAIT
IF [ $DEPLOY_ENABLED == "true" ]
BUILD +deploy
END
END
deploy:
# These deploys should only happen if we actually made changes to their respective targets
BUILD ./apps/app1+deploy
BUILD ./apps/app2+deploy
BUILD ./apps/app3+deploy
test:
BUILD ./apps/app1+test
BUILD ./apps/app2+test
BUILD ./apps/app3+test# apps/app1/Earthfile
test:
BUILD +test-self
test-self:
FROM earthly/dind:alpine
... # Full stack integration tests# apps/app2/Earthfile
test:
BUILD +test-self
BUILD ../../packages/package1+test
BUILD ../../packages/package2+test
test-self:
FROM earthly/dind:alpine
... # Full stack integration tests# apps/app3/Earthfile
test:
BUILD +test-self
BUILD ../../packages/package1+test
BUILD ../../packages/package3+test
test-self:
FROM earthly/dind:alpine
... # Full stack integration tests# .GitHub/workflows/ci.yml
name: CI
on:
- push
jobs:
all:
name: +all
env:
DEPLOY_ENABLED: ${{ GitHub.ref == format('refs/heads/{0}', GitHub.event.repository.default_branch) }}
runs-on: ubuntu-latest
steps:
# set-up steps here
- name: Run test and deploy
run: |
earthly \
--push -P
+all --DEPLOY_ENABLED=$DEPLOY_ENABLEDAnalysis
This set-up allows Earthly to construct a DAG and theoretically do the minimal work
内容来源: earthly/earthly