From e043a09f0759bd6a1d287e9d921e91aeaa919f01 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 19 Sep 2021 16:48:40 +0200 Subject: [PATCH] Improve layout of Flex endpoint --- .github/workflows/create-project.yml | 4 ++-- .github/workflows/flex-endpoint.yml | 36 ++++++++-------------------- .github/workflows/pr-cleanup.yml | 11 +++------ .github/workflows/qa.yml | 25 +++++++------------ 4 files changed, 24 insertions(+), 52 deletions(-) diff --git a/.github/workflows/create-project.yml b/.github/workflows/create-project.yml index 7dc246fa..be1a2897 100644 --- a/.github/workflows/create-project.yml +++ b/.github/workflows/create-project.yml @@ -1,4 +1,4 @@ -name: Q&A +name: Run updated recipes on: pull_request: @@ -10,7 +10,7 @@ defaults: jobs: create-project: - name: Create-project + name: Run updated recipes runs-on: Ubuntu-20.04 steps: diff --git a/.github/workflows/flex-endpoint.yml b/.github/workflows/flex-endpoint.yml index b33d86ed..e55420ed 100644 --- a/.github/workflows/flex-endpoint.yml +++ b/.github/workflows/flex-endpoint.yml @@ -1,4 +1,4 @@ -name: Flex +name: Update Flex endpoint on: push: @@ -12,7 +12,7 @@ defaults: jobs: update: - name: Update endpoint + name: Update Flex endpoint runs-on: Ubuntu-20.04 steps: @@ -29,35 +29,19 @@ jobs: git config --global user.email "" git config --global user.name "github-action bot" cd .github - wget -q -O - https://github.com/splitsh/lite/releases/download/v1.0.1/lite_linux_amd64.tar.gz | tar -zxp wget -q -O recipes-checker.zip https://codeload.github.com/symfony-tools/recipes-checker/zip/refs/heads/main unzip recipes-checker.zip cd recipes-checker-main composer install --ansi --no-dev - - - name: Cache Splitsh-lite - uses: actions/cache@v2 - with: - path: .git/splitsh.db - key: ${{ runner.os }}-main-${{ github.sha }} - restore-keys: ${{ runner.os }}-main- - - name: Update Flex endpoint run: | - find -mindepth 2 -maxdepth 2 -not -wholename './.*' | cut -c 3- | xargs -r -n1 -I{} .github/splitsh-lite --prefix={} --target=refs/heads/flex-main/{} || rm .git/splitsh.db - [ -e .git/splitsh.db ] || find -mindepth 2 -maxdepth 2 -not -wholename './.*' | cut -c 3- | xargs -r -n1 -I{} .github/splitsh-lite --prefix={} --target=refs/heads/flex-main/{} - - git ls-tree HEAD */*/* | php .github/recipes-checker-main/run generate:flex-index ${{ github.repository }} flex-main > flex-index.json - git switch 'flex/main' - mv flex-index.json index.json - git add index.json - git commit -m 'Update Flex index' || true - git switch - - - git branch --list 'flex-main/*' | xargs -r git push origin -f flex/main - git branch -r --list 'origin/flex-main/*' \ - | sed 's/[^/]*\//:/' \ - | grep -Fxv "$(find -mindepth 2 -maxdepth 2 -not -wholename './.*' | sed 's/../:flex-main\//')" \ - | xargs -r git push origin || true + mkdir .github/flex-endpoint + git ls-tree HEAD */*/* | php .github/recipes-checker-main/run generate:flex-endpoint ${{ github.repository }} master flex/main .github/flex-endpoint + git switch flex/main + git rm -q *.json + mv .github/flex-endpoint/*.json . + git add *.json + git commit -m 'Update Flex endpoint' || true + git push origin -f flex/main diff --git a/.github/workflows/pr-cleanup.yml b/.github/workflows/pr-cleanup.yml index 4f278d75..69f8e8f3 100644 --- a/.github/workflows/pr-cleanup.yml +++ b/.github/workflows/pr-cleanup.yml @@ -1,4 +1,4 @@ -name: Closing PR +name: Cleanup Flex testing endpoint on: pull_request_target: @@ -11,20 +11,15 @@ defaults: jobs: cleanup: - name: Cleanup + name: Cleanup Flex testing endpoint runs-on: Ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v2 - id: checkout - with: - fetch-depth: 0 - name: Cleanup Flex testing endpoint run: | - git branch -r --list 'origin/flex-pull-${{ github.event.number }}/*' \ - | sed 's/[^/]*\//:/' \ - | xargs -r git push origin :flex/pull-${{ github.event.number }} || true + git push origin :flex/pull-${{ github.event.number }} || true diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml index 871a04da..35c1e5f2 100644 --- a/.github/workflows/qa.yml +++ b/.github/workflows/qa.yml @@ -1,4 +1,4 @@ -name: Q&A +name: Run checks on: pull_request_target: @@ -10,7 +10,7 @@ defaults: jobs: tests: - name: Checks + name: Run checks runs-on: Ubuntu-20.04 steps: @@ -28,7 +28,6 @@ jobs: git config --global user.email "" git config --global user.name "github-action bot" cd .github - wget -q -O - https://github.com/splitsh/lite/releases/download/v1.0.1/lite_linux_amd64.tar.gz | tar -zxp wget -q -O recipes-checker.zip https://codeload.github.com/symfony-tools/recipes-checker/zip/refs/heads/main unzip recipes-checker.zip cd recipes-checker-main @@ -46,29 +45,23 @@ jobs: run: | .github/recipes-checker-main/run list-unpatched-packages $GITHUB_EVENT_PATH ${{ secrets.GITHUB_TOKEN }} | xargs -r -n10 rm -rf - - name: Generate Flex testing endpoint if: "always() && steps.checkout.outcome == 'success' && github.base_ref == 'master'" run: | - find -mindepth 2 -maxdepth 2 -not -wholename './.*' | cut -c 3- | xargs -r -n1 -I{} .github/splitsh-lite --prefix={} --target=refs/heads/flex-pull-${{ github.event.number }}/{} - - git ls-tree HEAD */*/* | php .github/recipes-checker-main/run generate:flex-index ${{ github.repository }} flex-pull-${{ github.event.number }} > index.json + mkdir .github/flex-endpoint + git ls-tree HEAD */*/* | php .github/recipes-checker-main/run generate:flex-endpoint ${{ github.repository }} master flex/pull-${{ github.event.number }} .github/flex-endpoint git stash git switch -c pr - git switch --orphan 'flex/pull-${{ github.event.number }}' + git switch --orphan flex/pull-${{ github.event.number }} git reset --hard -q - git add index.json - git commit -m 'Create Flex index' || true + mv .github/flex-endpoint/*.json . + git add *.json + git commit -m 'Create Flex endpoint' || true + git push origin -f flex/pull-${{ github.event.number }} git switch pr git stash pop -q - git branch --list 'flex-pull-${{ github.event.number }}/*' | xargs -r git push origin -f flex/pull-${{ github.event.number }} - git branch -r --list 'origin/flex-pull-${{ github.event.number }}/*' \ - | sed 's/[^/]*\//:/' \ - | grep -Fxv "$(find -mindepth 2 -maxdepth 2 -not -wholename './.*' | sed 's/../:flex-pull-${{ github.event.number }}\//')" \ - | xargs -r git push origin || true - - name: Compute diff between recipe versions if: "always() && steps.checkout.outcome == 'success'"