Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/run-tests/mysql/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN apt-get update >/dev/null && \
apt-get clean

HEALTHCHECK --interval=1s --timeout=1s --retries=24 \
CMD mysqladmin ping --silent --socket /run/mysqld/mysqld.sock -ppass_root
CMD mysqladmin ping --silent -h 127.0.0.1 -ppass_root

COPY docker-entrypoint.sh /usr/local/bin
# CMD ["eatmydata", "mysqld"]
46 changes: 45 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,19 +210,63 @@ jobs:
--http-server ${{ matrix.httpServer }}
--php-version ${{ matrix.phpVersion }}

- name: Compute the fixture cache key
id: fixtureKey
env:
FILES_HASH: ${{ hashFiles('lib/Migration/**', 'appinfo/info.xml', '.github/actions/run-tests/*.py', '.github/actions/run-tests/docker-compose.yml', '.github/actions/run-tests/*.env', '.github/actions/run-tests/mysql/**', '.github/actions/run-tests/postgres/**', '.github/actions/run-tests/test_runner/*.py', '.github/actions/run-tests/scripts/**', '.github/actions/run-tests/tests/**') }}
run: >-
sha="$(git ls-remote https://github.com/nextcloud/server refs/heads/stable${{ matrix.coreVersion }} | cut -f1)" &&
prefix="fixture-tar-${{ matrix.database }}-${{ matrix.coreVersion }}-${{ matrix.phpVersion }}-$FILES_HASH-$(date -u +%G-%V)-" &&
echo "prefix=$prefix" >> "$GITHUB_OUTPUT" &&
echo "key=$prefix$sha" >> "$GITHUB_OUTPUT"
Comment thread
coderabbitai[bot] marked this conversation as resolved.

- name: Restore the cached fixtures
id: fixtureCache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
with:
path: ${{ runner.temp }}/fixture.tar
key: ${{ steps.fixtureKey.outputs.key }}
restore-keys: ${{ steps.fixtureKey.outputs.prefix }}

- name: Check if the cached fixtures can be used
id: fixtureHit
run: >-
echo "hit=${{ steps.fixtureCache.outputs.cache-hit == 'true' || (github.event_name == 'pull_request' && steps.fixtureCache.outputs.cache-matched-key != '') }}" >> "$GITHUB_OUTPUT"
Comment thread
coderabbitai[bot] marked this conversation as resolved.

- name: Extract the cached fixtures
if: steps.fixtureHit.outputs.hit == 'true'
run: >-
mkdir -p .github/actions/run-tests/volumes/dumps &&
sudo tar -xpf "$RUNNER_TEMP/fixture.tar" -C .github/actions/run-tests/volumes/dumps

- name: Create the fixtures for the tests
id: fixtures
run: >-
if [ "${{matrix.database}}" = 'pgsql' ]; then PARAM=''; else PARAM='--use-db-dump'; fi &&
cd .github/actions/run-tests &&
if [ "${{ steps.fixtureHit.outputs.hit }}" = 'true' ]; then mkdir -p volumes/nextcloud/custom_apps/cookbook volumes/nextcloud/data && PARAM='--start-helpers'; else PARAM="$PARAM --create-fixture default stable${{ matrix.coreVersion }}"; fi &&
./run-locally.py
$PARAM
--create-fixture default stable${{ matrix.coreVersion }}
--activate-fixture default
--input-db ${{ matrix.database }}
--http-server ${{ matrix.httpServer }}
--php-version ${{ matrix.phpVersion }}

- name: Archive the fixtures
id: fixtureArchive
if: steps.fixtureHit.outputs.hit != 'true'
run: >-
echo "key=${{ steps.fixtureKey.outputs.prefix }}$(git -c safe.directory="*" -C .github/actions/run-tests/volumes/nextcloud rev-parse HEAD)" >> "$GITHUB_OUTPUT" &&
sudo tar -cf "$RUNNER_TEMP/fixture.tar" -C .github/actions/run-tests/volumes/dumps version.json fixtures/default &&
sudo chown "$USER" "$RUNNER_TEMP/fixture.tar"

- name: Cache the fixtures
if: steps.fixtureHit.outputs.hit != 'true'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
Comment thread
TheTisiboth marked this conversation as resolved.
with:
path: ${{ runner.temp }}/fixture.tar
key: ${{ steps.fixtureArchive.outputs.key }}

- name: Run the unit tests
if: ${{ !cancelled() && steps.fixtures.outcome == 'success' }}
run: >-
Expand Down
Loading