nextcloudpi/.github/workflows/build-docker.yml
Tobias Knöppler b675d61e61
Upgrade to PHP 8.1 when installing NC >= 24 (#1554)
* Update nextcloud to 24.0.4
* ncp-update-nc: Upgrade php to version 8.1 when installing NC >= 24
* ncp-update-nc: Use /etc/shadow workaround for installing systemd
* ncp-update-nc: Run nc-limits after php upgrade
* ncp-update-nc: Rollback after failed php upgrade
* ncp-update-nc: Add success message
* ncp-update-nc: Prevent installation of NC >= 24 on debian 10/PHP <= 7.3
* lamp.sh: Install php8.1 from sury.org
* lamp.sh: Use /etc/shadow workaround for installing systemd
* Dockerfile: Install wget, ca-certificates, lsb-release and procps before installing lamp.sh
* Dockerfile: Make sure, ncp-templates are available when installing lamp.sh
* Migrate all scripts to use template for writing opcache.ini and get_nc_config_value for retrieving datadir
* nc-nextcloud.sh Fix crash if nc-datadir has not been installed yet
* opcache.ini.sh: Don't try to get tmpl values from nc-datadir in containers
2022-09-15 17:31:15 +02:00

147 lines
4.9 KiB
YAML

# https://www.docker.com/blog/docker-v2-github-action-is-now-ga/
# https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/
# https://docs.github.com/en/actions/guides/publishing-docker-images
name: 'Docker Integration Tests and Release'
on:
workflow_call:
inputs:
git_ref:
required: true
type: string
push:
branches:
- master
- devel
pull_request:
branches:
- master
- devel
jobs:
build:
if: ${{ github.repository == 'nextcloud/nextcloudpi' }}
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- x86
- armhf
- arm64
fail-fast: false
env:
VERSION: "${{ inputs.git_ref || github.ref }}"
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Checkout code
uses: actions/checkout@v3
with:
ref: "${{ env.VERSION }}"
- name: Login to docker
run: |
echo "${{ secrets.DOCKER_PASSWORD_INTERNAL }}" | docker login -u "${{ secrets.DOCKER_LOGIN_INTERNAL }}" --password-stdin
- name: Build images
id: build-container
run: |
./build/build-docker.sh "${{ matrix.arch }}"
docker tag "ownyourbits/nextcloudpi-${{ matrix.arch }}:latest" "thecalcaholic/ncp-internal-${{ matrix.arch }}:${{ github.run_id }}"
testing_image="ownyourbits/nextcloudpi-${{ matrix.arch }}:latest"
[[ "${{ matrix.arch }}" == "arm64" ]] && testing_image="ownyourbits/ncp-qemu-fix-${{ matrix.arch }}:latest"
docker tag "${testing_image}" "thecalcaholic/ncp-internal-${{ matrix.arch }}:${{ github.run_id }}-testing"
docker push "thecalcaholic/ncp-internal-${{ matrix.arch }}:${{ github.run_id }}"
docker push "thecalcaholic/ncp-internal-${{ matrix.arch }}:${{ github.run_id }}-testing"
test:
needs:
- build
runs-on: ubuntu-latest
env:
VERSION: "${{ inputs.git_ref || github.ref }}"
strategy:
matrix:
arch:
- armhf
- x86
- arm64
fail-fast: false
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Login to docker
run: |
echo "${{ secrets.DOCKER_PASSWORD_INTERNAL }}" | docker login -u "${{ secrets.DOCKER_LOGIN_INTERNAL }}" --password-stdin
- name: Start ncp container
run: |
docker run -d --rm -p 8443:443 -p 4443:4443 --name nextcloudpi thecalcaholic/ncp-internal-${{ matrix.arch }}:${{ github.run_id }}-testing
- name: Checkout code
uses: actions/checkout@v3
with:
ref: "${{ env.VERSION }}"
- name: Setup Firefox
uses: browser-actions/setup-firefox@latest
- name: Setup GeckoDriver
uses: browser-actions/setup-geckodriver@latest
- name: Setup Selenium
run: pip install selenium
- name: Integration Tests
working-directory: ./tests
run: |
docker logs -f | ( echo -n "CONTAINER::"; cat )
docker exec nextcloudpi bash -c 'tail -f /var/log/ncp.log' |& awk '{ print "NCP::" $0 }' &
cmd=(python activation_tests.py --no-gui localhost 8443 4443)
[[ "${{ matrix.arch }}" == "x86" ]] || cmd+=(--timeout 300)
"${cmd[@]}" || {
tail -n 20 geckodriver.log >&2 || true
echo "======================="
echo "Activation test failed!"
echo "Container logs:"
echo "==========================================="
docker logs nextcloudpi
echo "Last lines of ncp.log:"
echo "==========================================="
docker exec nextcloudpi tail /var/log/ncp.log;
exit 1
}
echo "Activation test successful"
python system_tests.py --no-ping --non-interactive || {
echo "System test failed!"
echo "Container logs:"
echo "==========================================="
docker logs nextcloudpi
echo "Last lines of ncp.log:"
echo "==========================================="
docker exec nextcloudpi tail /var/log/ncp.log;
exit 1
exit 1
}
echo "System test successful"
python nextcloud_tests.py --no-gui localhost 8443 4443 || {
tail -n 20 geckodriver.log >&2 || true
echo "======================="
echo "Nextcloud test failed!"
echo "Container logs:"
echo "==========================================="
docker logs nextcloudpi
echo "Last lines of ncp.log:"
echo "==========================================="
docker exec nextcloudpi tail /var/log/ncp.log;
exit 1
}
echo "Nextcloud test successful"