From 570744d15a0377f8e9ca1604827d8cdc318fecb3 Mon Sep 17 00:00:00 2001 From: Maxence Maireaux Date: Fri, 27 Sep 2024 13:35:24 +0200 Subject: [PATCH 1/3] ci: add Earthfile target for CI and update GitHub workflow - Add `ci` target to Earthfile for local builds and tests - Rename workflow job `Dirty` to `Earthly` - Replace `+pre-commit` with `+ci` in GitHub workflow - Remove separate `Tests` job in GitHub workflow - Update job dependencies in GitHub workflow --- .github/workflows/main.yml | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 94af18a823..777323b82c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,7 +24,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - Dirty: + Earthly: runs-on: "ubuntu-latest" steps: - uses: 'actions/checkout@v4' @@ -39,7 +39,7 @@ jobs: --allow-privileged --secret SPEAKEASY_API_KEY=$SPEAKEASY_API_KEY ${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }} - +pre-commit + +ci env: SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }} - name: Get changed files @@ -53,33 +53,9 @@ jobs: 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 - env: - SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }} - 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: @@ -120,7 +96,7 @@ jobs: environment: staging needs: - GoReleaser - - Tests + - Earthly steps: - uses: earthly/actions-setup@v1 with: From 9c71b3afbe743711e1367861bfe99b92a29799dc Mon Sep 17 00:00:00 2001 From: Maxence Maireaux Date: Fri, 27 Sep 2024 16:15:18 +0200 Subject: [PATCH 2/3] refactor(Earthfile): remove ci section to streamline build process ci(github): update workflow to use Earthly run-ci with specific commit Remove redundant 'Get changed files' step from workflow --- .github/workflows/main.yml | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 777323b82c..c90402cc84 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,9 +27,6 @@ jobs: Earthly: runs-on: "ubuntu-latest" steps: - - uses: 'actions/checkout@v4' - with: - fetch-depth: 0 - name: Setup Env uses: ./.github/actions/env with: @@ -39,19 +36,20 @@ jobs: --allow-privileged --secret SPEAKEASY_API_KEY=$SPEAKEASY_API_KEY ${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }} - +ci + github.com/formancehq/earthly+run-ci --project=ledger --commit=$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 + 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" From 995be9d4874c63fa9c67324218b843a38e0f35b3 Mon Sep 17 00:00:00 2001 From: Maxence Maireaux Date: Fri, 27 Sep 2024 16:17:10 +0200 Subject: [PATCH 3/3] refactor(Earthfile): remove ci section to streamline build process ci(github): update workflow to use Earthly run-ci with specific commit Remove redundant 'Get changed files' step from workflow --- .github/workflows/main.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c90402cc84..a9305fabbf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,6 +27,9 @@ jobs: Earthly: runs-on: "ubuntu-latest" steps: + - uses: 'actions/checkout@v4' + with: + fetch-depth: 0 - name: Setup Env uses: ./.github/actions/env with: