-
-
Notifications
You must be signed in to change notification settings - Fork 29
170 lines (159 loc) · 6.06 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: build
on:
push:
branches: [ 'main', 'release-12.0.x', 'release-11.0.x', 'release-10.0.x' ]
tags:
- "**"
pull_request:
branches: [ 'main', 'release-12.0.x', 'release-11.0.x', 'release-10.0.x' ]
env:
CI_BUILD_DIRECTORY: '/home/runner/work/ext-tika/ext-tika/.Build'
TIKA_PATH: '/home/runner/work/ext-tika/ext-tika/.Build/data-tika-binaries'
SOLR_IMAGE_TAG: '13.0.x-dev'
SOLR_CONTAINER_NAME: 'solrci-container'
TESTING_SOLR_PORT: 8983
SOLR_VOLUME_NAME: 'solrci-volume'
SOLR_VOLUME_PATH: '/home/runner/work/ext-tika/ext-tika/.Build/data-solr'
jobs:
test-docs:
name: Test docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Test if the documentation will render without warnings
run: |
mkdir -p Documentation-GENERATED-temp \
&& docker run --rm --pull always -v $(pwd):/project \
ghcr.io/typo3-documentation/render-guides:latest --config=Documentation --no-progress --fail-on-log
tests:
runs-on: ubuntu-latest
strategy:
matrix:
PHP: [ '8.2', '8.3' ]
TYPO3: [ 'dev-main' ]
env:
TYPO3_DATABASE_NAME: 'typo3_ci'
TYPO3_DATABASE_HOST: '127.0.0.1'
TYPO3_DATABASE_USERNAME: 'root'
TYPO3_DATABASE_PASSWORD: 'root'
TYPO3_VERSION: ${{ matrix.TYPO3 }}
name: TYPO3 ${{ matrix.TYPO3 }} on PHP ${{ matrix.PHP }}
steps:
# Workaround for issue with actions/checkout@v4 wrong PR commit checkout: See https://github.com/actions/checkout/issues/299#issuecomment-677674415
-
name: Checkout current state of Pull Request
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
fetch-depth: 2
ref: ${{ github.event.pull_request.head.sha }}
-
name: Checkout current state of Branch
if: github.event_name == 'push'
uses: actions/checkout@v4
with:
fetch-depth: 2
# End: Workaround for issue with actions/checkout@v4 wrong PR commit checkout
-
name: Cache Apache Tika Binaries
id: tika-binaries
uses: actions/cache@v4
with:
path: $TIKA_PATH
key: tika-binaries
-
name: Mount RAMFS
run: |
sudo mkdir -p ${{ env.CI_BUILD_DIRECTORY }}
sudo mount -t tmpfs -o size=2560m none ${{ env.CI_BUILD_DIRECTORY }}
sudo mkdir -p ${{ env.CI_BUILD_DIRECTORY }}/data-{solr,mysql,tika-binaries} \
&& sudo chown $USER ${{ env.CI_BUILD_DIRECTORY }}/data-{mysql,tika-binaries} \
&& sudo chown 8983:8983 ${{ env.CI_BUILD_DIRECTORY }}/data-solr
-
name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.PHP }}
coverage: pcov
tools: composer:v2
-
name: 'Start Docker: Solr, Tika, MySQL'
run: |
docker run --name "MySQL-CI" -v ${{ env.CI_BUILD_DIRECTORY }}/data-mysql:/var/lib/mysql -p 3306:3306 \
-e MYSQL_DATABASE=$TYPO3_DATABASE_NAME \
-e MYSQL_ROOT_PASSWORD=$TYPO3_DATABASE_PASSWORD \
-d mysql:8.0 mysqld --default-authentication-plugin=mysql_native_password
sudo chmod g+w "$SOLR_VOLUME_PATH"
docker volume create --name "$SOLR_VOLUME_NAME" --opt type=none --opt device="$SOLR_VOLUME_PATH" --opt o=bind
docker run --rm --name="$SOLR_CONTAINER_NAME" -d -p 127.0.0.1:8983:8983 -v "$SOLR_VOLUME_NAME":"/var/solr" "typo3solr/ext-solr:$SOLR_IMAGE_TAG"
docker run -d -p 9998:9998 apache/tika:$(composer tika:req:tika)"-full"
docker ps
-
name: CI-Bootstrap
run: |
composer info
composer tests:setup && composer tests:setup:global-require
echo "Current Size of EXT:tika build Artefacts: " \
&& sudo du -sh "${{ env.CI_BUILD_DIRECTORY }}"
-
name: CI-Build
run: |
./.Build/vendor/apache-solr-for-typo3/solr/Build/Test/cibuild.sh
echo "Current Size of EXT:tika build Artefacts: " \
&& sudo du -sh $CI_BUILD_DIRECTORY/ \
&& sudo du -sh $CI_BUILD_DIRECTORY/*
publish:
name: Publish new version to TER
needs: tests
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-20.04
env:
TYPO3_API_TOKEN: ${{ secrets.TYPO3_API_TOKEN }}
steps:
-
name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
-
name: Check tag
run: |
if ! [[ ${{ github.ref }} =~ ^refs/tags/[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$ ]]; then
exit 1
fi
-
name: Get version
id: get-version
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}
-
name: Get comment
id: get-comment
run: |
readonly local comment=$(git tag -n99 -l ${{ steps.get-version.outputs.version }} | sed "s/^[0-9.]*[ ]*//g")
if [[ -z "${comment// }" ]]; then
echo ::set-output name=comment::Released version ${{ steps.get-version.outputs.version }} of EXT:tika
else
echo ::set-output name=comment::$comment
fi
-
name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: intl, mbstring, json, zip, curl
tools: composer:v2
-
name: Install tailor
run: composer global require typo3/tailor --prefer-dist --no-progress
-
name: Publish EXT:tika to TER
run: |
export RELEASE_VERSION=${GITHUB_REF/refs\/tags\//}
export TER_COMMENT=$(git tag -n99 -l "$RELEASE_VERSION" | sed "s/^[0-9.]*[ ]*//g")
if [[ -z "${TER_COMMENT// }" ]]; then
export TER_COMMENT="Released version $RELEASE_VERSION of EXT:tika"
fi
echo "Following message will be printed in TER as release description:"
echo -e "$TER_COMMENT"
php ~/.composer/vendor/bin/tailor ter:publish --comment "$TER_COMMENT" "$RELEASE_VERSION"