Skip to content

Commit f932204

Browse files
committed
[FEATURE] Add arm64 and ppc64le platforms to docker-images
This PR also updates all required actions in .github/workflow/ci.yml and adds a new publish-docker-hub job to the pipeline. Fixes: TYPO3-Solr#2891 Replaces: TYPO3-Solr#3501
1 parent 3245c13 commit f932204

File tree

1 file changed

+84
-145
lines changed

1 file changed

+84
-145
lines changed

.github/workflows/ci.yml

Lines changed: 84 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ name: build
22

33
on:
44
push:
5-
branches: [ main, release-13.0.x, release-12.0.x, release-11.6.x, release-11.5.x, task/*_compatibility ]
5+
branches: [ main, release-13.0.x, release-12.0.x ]
66
tags:
77
- "**"
88
pull_request:
9-
branches: [ main, release-13.0.x, release-12.0.x, release-11.6.x, release-11.5.x, task/*_compatibility ]
9+
branches: [ main, release-13.0.x, release-12.0.x ]
1010

1111
# Run tests daily at 19:23 to get TYPO3 changes and fix them immediately.
1212
# @todo:
@@ -91,166 +91,105 @@ jobs:
9191
name: solrci-logs
9292
path: /tmp/docker_image_logs_**/
9393

94-
test_documentation:
95-
name: test Documentation
94+
publish-docker-hub:
95+
name: Publish docker-image to docker-hub
96+
#needs: tests
97+
if: |
98+
(
99+
github.ref == 'refs/heads/main' ||
100+
startsWith(github.ref, 'refs/heads/release-') ||
101+
startsWith(github.ref, 'refs/tags/')
102+
)
96103
runs-on: ubuntu-latest
104+
env:
105+
DOCKER_PLATFORMS: "linux/amd64,linux/arm64,linux/ppc64le"
106+
# @todo: replace with orig. ext-solr data
107+
DOCKER_HUB_IMAGE_NAME: "${{ secrets.DOCKERHUB_USERNAME }}/ext-solr"
108+
DOCKER_GITHUB_IMAGE_NAME: "ghcr.io/${{github.repository_owner}}/${{ github.event.repository.name }}"
109+
#DOCKER_IMAGE_NAME: "${{ secrets.DOCKERHUB_USERNAME }}/ext-solr"
110+
# is overridden below
111+
DOCKER_IMAGE_TAGS: ""
97112
steps:
98-
# Workaround for issue with actions/checkout "wrong PR commit checkout". See: ci_bootstrapping job
99-
- name: Checkout current state of Pull Request
100-
if: github.event_name == 'pull_request'
113+
- name: Checkout
101114
uses: actions/checkout@v4
102-
with:
103-
fetch-depth: 2
104-
ref: ${{ github.event.pull_request.head.sha }}
105-
- name: Checkout current state of Branch
106-
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
107-
uses: actions/checkout@v4
108-
with:
109-
fetch-depth: 2
110-
# End: Workaround for issue with actions/checkout...
111115

112-
- name: Test if the documentation will render without warnings
116+
- name: enrich Environment Variables
117+
id: env
113118
run: |
114-
Build/generate_documentation.sh --no-progress
119+
echo "NOW=$(date +'%F %Z %T')" >> $GITHUB_ENV
120+
echo "BRANCH_TAG=$(jq -r '.extra."branch-alias" | to_entries | .[0].key' composer.json)" >> $GITHUB_ENV
121+
echo "BRANCH_ALIAS_TAG=$(jq -r '.extra."branch-alias" | to_entries | .[0].value' composer.json)" >> $GITHUB_ENV
115122
116-
tests:
117-
runs-on: ubuntu-latest
118-
needs: ci_bootstrapping
119-
continue-on-error: ${{ contains(matrix.TYPO3, '-dev') }}
120-
strategy:
121-
matrix: ${{ fromJson(needs.ci_bootstrapping.outputs.matrix) }}
122-
env:
123-
TYPO3_DATABASE_NAME: 'typo3_ci'
124-
TYPO3_DATABASE_HOST: '127.0.0.1'
125-
TYPO3_DATABASE_USERNAME: 'root'
126-
TYPO3_DATABASE_PASSWORD: 'root'
127-
TYPO3_VERSION: ${{ matrix.TYPO3 }}
123+
- name: Debugging temp. MUST BE REMOVED before merging to EXT:solr
124+
# main branch without tags must become following tags:
125+
## * dev-main
126+
## * 13.0.x-dev
127+
# release-12.0.x branch without tags must become following tags:
128+
## * dev-release-12.0.x
129+
## * 12.0.x-dev
130+
run: |
131+
echo "NOW="${{ env.NOW }}
132+
echo "DOCKER_HUB_IMAGE_NAME="${{ env.DOCKER_HUB_IMAGE_NAME }}
133+
echo "DOCKER_GITHUB_IMAGE_NAME="${{ env.DOCKER_GITHUB_IMAGE_NAME }}
134+
echo "BRANCH_TAG="${{ env.BRANCH_TAG }}
135+
echo "BRANCH_ALIAS_TAG="${{ env.BRANCH_ALIAS_TAG }}
128136
129-
name: TYPO3 ${{ matrix.TYPO3 }} on PHP ${{ matrix.PHP }}
130-
steps:
131-
# Workaround for issue with actions/checkout "wrong PR commit checkout". See: ci_bootstrapping job
132-
-
133-
name: Checkout current state of Pull Request
134-
if: github.event_name == 'pull_request'
135-
uses: actions/checkout@v4
137+
- name: Docker metadata
138+
id: meta
139+
uses: docker/metadata-action@v5
136140
with:
137-
fetch-depth: 2
138-
ref: ${{ github.event.pull_request.head.sha }}
139-
-
140-
name: Checkout current state of Branch
141-
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
142-
uses: actions/checkout@v4
143-
with:
144-
fetch-depth: 2
145-
# End: Workaround for issue with actions/checkout...
141+
# list of Docker images to use as base name for tags
142+
images: |
143+
${{ env.DOCKER_HUB_IMAGE_NAME }}
144+
145+
# The newest major EXT:solr branch can become the latest tag.
146+
# So if main branch becomes dev state for next TYPO3 LTS, the latest must be set to false.
147+
flavor: |
148+
latest=true
149+
tags: |
150+
type=raw,value=${{ env.BRANCH_TAG }}
151+
type=raw,value=${{ env.BRANCH_ALIAS_TAG }}
152+
type=semver,pattern={{version}}
153+
type=semver,pattern={{major}}.{{minor}}
154+
labels: |
155+
org.opencontainers.image.title=${{github.event.repository.name}}
156+
org.opencontainers.image.description=Docker image for Apache Solr for TYPO3 CMS EXT:solr extension
157+
org.opencontainers.image.vendor=${{github.repository_owner}}
158+
org.opencontainers.image.licenses=GPL-3.0,APACHE
159+
org.opencontainers.image.version=${{github.ref_name}}
160+
org.opencontainers.image.created=${{ env.NOW }}
161+
org.opencontainers.image.source=${{github.server_url}}/${{github.repository}}
162+
org.opencontainers.image.revision=${{github.sha}}
163+
org.opencontainers.image.url=https://docs.typo3.org/p/apache-solr-for-typo3/solr/main/en-us/Appendix/DockerTweaks.html
164+
org.opencontainers.image.documentation=https://docs.typo3.org/p/apache-solr-for-typo3/solr/main/en-us/Index.html
165+
146166
-
147-
name: Mount RAMFS
148-
run: |
149-
mkdir -p ${{ env.CI_BUILD_DIRECTORY }}
150-
sudo mount -t tmpfs -o size=1G none ${{ env.CI_BUILD_DIRECTORY }}
151-
sudo mkdir -p ${{ env.CI_BUILD_DIRECTORY }}/data-{solr,mysql} \
152-
&& sudo chown $USER ${{ env.CI_BUILD_DIRECTORY }}/data-mysql \
153-
&& sudo chown 8983:8983 ${{ env.CI_BUILD_DIRECTORY }}/data-solr
167+
name: Set up QEMU
168+
uses: docker/setup-qemu-action@v2
169+
154170
-
155171
name: Set up Docker Buildx
156172
uses: docker/setup-buildx-action@v3
157-
-
158-
name: Download solrci-image from "ci_bootstrapping" job
159-
uses: actions/download-artifact@v4
160-
with:
161-
name: solrci-image
162-
path: /tmp
163-
-
164-
name: 'Start Docker: Solr, MySQL'
165-
run: |
166-
docker load --input /tmp/solrci-image.tar
167-
docker run --name "MySQL-CI" -v ${{ env.CI_BUILD_DIRECTORY }}/data-mysql:/var/lib/mysql -p 3306:3306 \
168-
-e MYSQL_DATABASE=$TYPO3_DATABASE_NAME \
169-
-e MYSQL_ROOT_PASSWORD=$TYPO3_DATABASE_PASSWORD \
170-
-d mysql:8.0 mysqld --default-authentication-plugin=mysql_native_password
171-
sudo chmod g+w "$LOCAL_VOLUME_PATH"
172-
docker volume create --name "$LOCAL_VOLUME_NAME" --opt type=none --opt device="$LOCAL_VOLUME_PATH" --opt o=bind
173-
docker run --rm --name="$LOCAL_CONTAINER_NAME" -d -p 127.0.0.1:8983:8983 -v "$LOCAL_VOLUME_NAME":"/var/solr" "$LOCAL_IMAGE_NAME"
174-
docker ps
175-
rm /tmp/solrci-image.tar
176-
-
177-
name: Setup PHP
178-
uses: shivammathur/setup-php@v2
179-
with:
180-
php-version: ${{ matrix.PHP }}
181-
coverage: pcov
182-
tools: composer:v2
183-
-
184-
name: CI-Bootstrap
185-
run: |
186-
./Build/Test/bootstrap.sh --skip-solr-install
187-
echo "Current Size of EXT:Solr build Artefacts before run: " \
188-
&& sudo du -sh "${{ env.CI_BUILD_DIRECTORY }}"
189-
-
190-
name: CI-Build
191-
run: |
192-
./Build/Test/cibuild.sh
193-
echo "Current Size of EXT:Solr build Artefacts after run: " \
194-
&& sudo du -sh "${{ env.CI_BUILD_DIRECTORY }}" \
195-
&& sudo du -sh ${{ env.CI_BUILD_DIRECTORY }}/*
196-
-
197-
name: Clean up
198-
run: |
199-
docker stop "MySQL-CI" 2>&1
200-
docker stop "$LOCAL_CONTAINER_NAME" 2>&1
201-
sudo rm -Rf ${{ env.CI_BUILD_DIRECTORY }}/Web/typo3temp/* \
202-
${{ env.CI_BUILD_DIRECTORY }}/data-mysql \
203-
${{ env.CI_BUILD_DIRECTORY }}/data-solr
204173

205-
publish:
206-
name: Publish new version to TER
207-
needs: tests
208-
if: startsWith(github.ref, 'refs/tags/')
209-
runs-on: ubuntu-latest
210-
env:
211-
TYPO3_API_TOKEN: ${{ secrets.TYPO3_API_TOKEN }}
212-
steps:
213174
-
214-
name: Checkout repository
215-
uses: actions/checkout@v4
175+
name: Login to Docker Hub
176+
uses: docker/login-action@v2
216177
with:
217-
ref: ${{ github.event.pull_request.head.sha }}
218-
-
219-
name: Check tag
220-
run: |
221-
TAGGED_VERSION=$(echo "${{ github.ref }}" | awk '{print tolower($0)}')
222-
if ! [[ "${TAGGED_VERSION}" =~ ^refs/tags/[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}((-pre)?-(alpha|beta|rc)(-?[0-9]{1,3})?)?$ ]]; then
223-
>&2 echo -e "Non-stable releases can not be published to TER. The tag ${TAGGED_VERSION} is invalid for TER."
224-
exit 0
225-
fi
226-
-
227-
name: Resolve PHP version to use
228-
run: |
229-
export PHP_VERSION_TO_USE=$(cat Resources/Private/Php/ComposerLibraries/composer.json | jq --raw-output '.config.platform.php')
230-
echo "PHP_VERSION_TO_USE=$PHP_VERSION_TO_USE" >> $GITHUB_ENV
178+
username: ${{ secrets.DOCKERHUB_USERNAME }}
179+
password: ${{ secrets.DOCKERHUB_TOKEN }}
180+
231181
-
232-
name: Setup PHP
233-
uses: shivammathur/setup-php@v2
182+
name: Build and push
183+
uses: docker/build-push-action@v6
234184
with:
235-
php-version: ${{ env.PHP_VERSION_TO_USE }}
236-
extensions: intl, mbstring, json, zip, curl
237-
tools: composer:v2
238-
-
239-
name: Install tailor
240-
run: composer global require typo3/tailor --prefer-dist --no-progress
185+
context: .
186+
file: ./Docker/SolrServer/Dockerfile
187+
platforms: ${{ env.DOCKER_PLATFORMS }}
188+
push: true
189+
tags: ${{ steps.meta.outputs.tags }}
190+
labels: ${{ steps.meta.outputs.labels }}
241191

242192
-
243-
name: Publish EXT:solr to TER
193+
name: Inspect all images
244194
run: |
245-
export RELEASE_VERSION=${GITHUB_REF/refs\/tags\//}
246-
export TER_COMMENT=$(git tag -n99 -l "$RELEASE_VERSION" | sed "s/^[0-9.]*[ ]*//g")
247-
if [[ -z "${TER_COMMENT// }" ]]; then
248-
export TER_COMMENT="Released version $RELEASE_VERSION of EXT:solr"
249-
fi
250-
echo "Following message will be printed in TER as release description:"
251-
echo -e "$TER_COMMENT"
252-
if ! composer extension-build; then
253-
>&2 echo -e "Something went wrong on building EXT:solr for NON-Composer mode. Please look in the job."
254-
exit 13
255-
fi
256-
php ~/.composer/vendor/bin/tailor ter:publish --comment "$TER_COMMENT" "$RELEASE_VERSION"
195+
docker image inspect ${DOCKER_IMAGE_TAGS//,/ }

0 commit comments

Comments
 (0)