Skip to content

Commit c05fc3a

Browse files
committed
Split stub build
1 parent 4330f8f commit c05fc3a

File tree

3 files changed

+53
-4
lines changed

3 files changed

+53
-4
lines changed

.github/workflows/build-docker.yml

-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ jobs:
9595
PLATFORM: ${{ matrix.image }}
9696
run: |
9797
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
98-
bin/stubs/build_docker.sh
9998
php bin/ci/build-docker.php
10099
101100
merge-docker:

.github/workflows/build-stubs.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Build docker image for stubs
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
on:
8+
push:
9+
branches:
10+
- master
11+
- 6.x
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
pre_job:
18+
permissions:
19+
actions: write
20+
runs-on: ubuntu-latest
21+
outputs:
22+
should_skip: ${{ steps.skip_check.outputs.should_skip }}
23+
steps:
24+
- id: skip_check
25+
uses: fkirc/skip-duplicate-actions@v5.3.1
26+
with:
27+
cancel_others: true
28+
do_not_skip: '["release"]'
29+
paths: '[".github/**", "bin/**"]'
30+
31+
build-stubs-docker:
32+
permissions:
33+
packages: write
34+
needs: pre_job
35+
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- name: Set up Docker Buildx
41+
id: buildx
42+
uses: docker/setup-buildx-action@v3
43+
44+
- name: Upload docker image
45+
env:
46+
EVENT_NAME: ${{ github.event_name }}
47+
REF: ${{ github.ref }}
48+
ACTOR: ${{ github.repository_owner }}
49+
run: |
50+
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
51+
bin/stubs/build_docker.sh
52+

bin/stubs/build_docker.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
#!/bin/bash -e
22

3-
if [ "$PLATFORM" != "ubuntu-latest" ]; then exit 0; fi
4-
53
VERSIONS="7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4"
64

75
for f in $VERSIONS; do
86
{
9-
docker build --build-arg VERSION=$f . -f bin/stubs/Dockerfile_$f -t ghcr.io/$ACTOR/psalm:internal_stubs_$f
7+
docker buildx build --push --cache-to type=inline --cache-from type=registry,ref=ghcr.io/$ACTOR/psalm:internal_stubs_$f --build-arg VERSION=$f . -f bin/stubs/Dockerfile_$f -t ghcr.io/$ACTOR/psalm:internal_stubs_$f
108
} &
119
if [ "$f" == "7.1" ] || [ "$f" == "7.3" ] || [ "$f" == "8.0" ] || [ "$f" == "8.2" ] || [ "$f" == "8.4" ]; then wait; fi
1210
done

0 commit comments

Comments
 (0)