From 77dabe71547054547f725343eccc08fbf0dc8b11 Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Wed, 28 Aug 2024 19:52:03 +0200 Subject: [PATCH] github: trigger lit CI for current branch --- .github/workflows/main.yaml | 66 +++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 5f4de57c2..11979d99f 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -291,7 +291,69 @@ jobs: path: logs-itest-postgres.zip retention-days: 5 - # Notify about the completion of all coverage collecting jobs. + ######################## + # Trigger LiTd integration tests + ######################## + trigger-lit-ci: + name: trigger LiT itests + runs-on: ubuntu-latest + + steps: + - name: git checkout + uses: actions/checkout@v3 + + - name: Setup go environment + uses: ./.github/actions/setup-go + + - name: Get current Tap commit hash and branch name + run: | + echo "TAP_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV + echo "TAP_BRANCH=${GITHUB_REF_NAME}" >> $GITHUB_ENV + + - name: Clone Lit repository + run: | + git clone https://github.com/lightninglabs/lightning-terminal.git + cd lightning-terminal + git config user.name "github-actions" + git config user.email "github-actions@github.com" + + - name: Update go.mod to use the local Tap repository + run: | + cd lightning-terminal + go mod edit -replace=github.com/lightning-labs/taproot-assets=../ + go mod tidy + + - name: Push changes to a temporary branch in Lit + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cd lightning-terminal + git checkout -b tap-${{ env.TAP_BRANCH }} + git commit -am "Update Tap dependency for branch ${{ env.TAP_BRANCH }}" + git remote set-url origin https://github-actions:${GITHUB_TOKEN}@github.com/lightninglabs/lightning-terminal.git + git push origin tap-${{ env.TAP_BRANCH }} + + # git remote set-url origin git@github.com:lightninglabs/lightning-terminal.git + - name: Trigger Lit CI via GitHub API + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + curl -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + https://api.github.com/repos/lightninglabs/lightning-terminal/actions/workflows/main.yml/dispatches \ + -d '{"ref":"tap-${{ env.TAP_BRANCH }}"}' + + - name: Cleanup temporary branch in Lit + if: success() + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + curl -X DELETE \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + https://api.github.com/repos/lightninglabs/lightning-terminal/git/refs/heads/tap-${{ env.TAP_BRANCH }} + + # Notify about the completion of all coverage collecting jobs. finish: if: ${{ always() }} needs: [unit-test] @@ -299,4 +361,4 @@ jobs: steps: - uses: shogo82148/actions-goveralls@v1 with: - parallel-finished: true \ No newline at end of file + parallel-finished: true