Skip to content

Commit 4b3c1ef

Browse files
Generate Flex endpoint
1 parent 0aadfa1 commit 4b3c1ef

File tree

4 files changed

+124
-2
lines changed

4 files changed

+124
-2
lines changed

.github/workflows/create-project.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
name: Create-project with skeleton ^4
3939
if: "always() && steps.config.outcome == 'success'"
4040
run: |
41+
set -x
4142
composer create-project --ansi "symfony/skeleton:^4" v4
4243
cd v4
4344
composer config minimum-stability dev
@@ -47,6 +48,7 @@ jobs:
4748
name: Create-project with skeleton ^5
4849
if: "always() && steps.config.outcome == 'success'"
4950
run: |
51+
set -x
5052
composer create-project --ansi "symfony/skeleton:^5" v5
5153
cd v5
5254
composer config minimum-stability dev

.github/workflows/flex-endpoint.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Flex
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
defaults:
9+
run:
10+
shell: bash
11+
12+
jobs:
13+
14+
update:
15+
name: Update endpoint
16+
runs-on: Ubuntu-20.04
17+
18+
steps:
19+
-
20+
name: Checkout
21+
uses: actions/checkout@v2
22+
id: checkout
23+
with:
24+
fetch-depth: 0
25+
26+
-
27+
name: Install tools
28+
run: |
29+
git config --global user.email ""
30+
git config --global user.name "github-action bot"
31+
cd .github
32+
wget -q -O - https://github.com/splitsh/lite/releases/download/v1.0.1/lite_linux_amd64.tar.gz | tar -zxp
33+
wget -q -O recipes-checker.zip https://codeload.github.com/symfony-tools/recipes-checker/zip/refs/heads/main
34+
unzip recipes-checker.zip
35+
cd recipes-checker-main
36+
composer install --ansi --no-dev
37+
38+
-
39+
name: Cache Splitsh-lite
40+
uses: actions/cache@v2
41+
with:
42+
path: .git/splitsh.db
43+
key: ${{ runner.os }}-main-${{ github.sha }}
44+
restore-keys: ${{ runner.os }}-main-
45+
46+
-
47+
name: Update Flex endpoint
48+
run: |
49+
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
50+
[ -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/{}
51+
52+
git ls-tree HEAD */*/* | php .github/recipes-checker-main/run generate:flex-index ${{ github.repository }} flex-main > flex-index.json
53+
git switch 'flex/main'
54+
mv flex-index.json index.json
55+
git add index.json
56+
git commit -m 'Update Flex index' || true
57+
git switch -
58+
59+
git branch --list 'flex-main/*' | xargs -r git push origin -f flex/main
60+
git branch -r --list 'origin/flex-main/*' \
61+
| sed 's/[^/]*\//:/' \
62+
| grep -Fxv "$(find -mindepth 2 -maxdepth 2 -not -wholename './.*' | sed 's/../:flex-main\//')" \
63+
| xargs -r git push origin || true

.github/workflows/pr-cleanup.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Closing PR
2+
3+
on:
4+
pull_request_target:
5+
types: [ closed ]
6+
7+
defaults:
8+
run:
9+
shell: bash
10+
11+
jobs:
12+
13+
cleanup:
14+
name: Cleanup
15+
runs-on: Ubuntu-20.04
16+
17+
steps:
18+
-
19+
name: Checkout
20+
uses: actions/checkout@v2
21+
id: checkout
22+
with:
23+
fetch-depth: 0
24+
25+
-
26+
name: Cleanup Flex testing endpoint
27+
run: |
28+
git branch -r --list 'origin/flex-pull-${{ github.event.number }}/*' \
29+
| sed 's/[^/]*\//:/' \
30+
| xargs -r git push origin :flex/pull-${{ github.event.number }} || true

.github/workflows/qa.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,16 @@ jobs:
1919
uses: actions/checkout@v2
2020
id: checkout
2121
with:
22+
fetch-depth: 0
2223
ref: 'refs/pull/${{ github.event.number }}/merge'
2324

2425
-
2526
name: Install tools
2627
run: |
28+
git config --global user.email ""
29+
git config --global user.name "github-action bot"
2730
cd .github
31+
wget -q -O - https://github.com/splitsh/lite/releases/download/v1.0.1/lite_linux_amd64.tar.gz | tar -zxp
2832
wget -q -O recipes-checker.zip https://codeload.github.com/symfony-tools/recipes-checker/zip/refs/heads/main
2933
unzip recipes-checker.zip
3034
cd recipes-checker-main
@@ -40,14 +44,37 @@ jobs:
4044
name: Remove non-patched packages
4145
if: "always() && steps.checkout.outcome == 'success'"
4246
run: |
43-
.github/recipes-checker-main/run list-unpatched-packages $GITHUB_EVENT_PATH ${{ secrets.GITHUB_TOKEN }} | xargs -n10 rm -rf
47+
.github/recipes-checker-main/run list-unpatched-packages $GITHUB_EVENT_PATH ${{ secrets.GITHUB_TOKEN }} | xargs -r -n10 rm -rf
48+
49+
50+
-
51+
name: Generate Flex testing endpoint
52+
if: "always() && steps.checkout.outcome == 'success' && github.base_ref == 'master'"
53+
run: |
54+
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 }}/{}
55+
56+
git ls-tree HEAD */*/* | php .github/recipes-checker-main/run generate:flex-index ${{ github.repository }} flex-pull-${{ github.event.number }} > index.json
57+
git stash
58+
git switch -c pr
59+
git switch --orphan 'flex/pull-${{ github.event.number }}'
60+
git reset --hard -q
61+
git add index.json
62+
git commit -m 'Create Flex index' || true
63+
git switch pr
64+
git stash pop -q
65+
66+
git branch --list 'flex-pull-${{ github.event.number }}/*' | xargs -r git push origin -f flex/pull-${{ github.event.number }}
67+
git branch -r --list 'origin/flex-pull-${{ github.event.number }}/*' \
68+
| sed 's/[^/]*\//:/' \
69+
| grep -Fxv "$(find -mindepth 2 -maxdepth 2 -not -wholename './.*' | sed 's/../:flex-pull-${{ github.event.number }}\//')" \
70+
| xargs -r git push origin || true
4471
4572
-
4673
name: Compute diff between recipe versions
4774
if: "always() && steps.checkout.outcome == 'success'"
4875
run: |
4976
find * -mindepth 1 -maxdepth 1 -type d | sort \
50-
| .github/recipes-checker-main/run diff-recipe-versions \
77+
| .github/recipes-checker-main/run diff-recipe-versions https://github.com/${{ github.repository }}/raw/flex/pull-${{ github.event.number }}/index.json \
5178
> .github/diff-recipe-versions.md
5279
5380
-

0 commit comments

Comments
 (0)