mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 09:14:06 +02:00
ci
This commit is contained in:
parent
20efdbafe8
commit
a7fb16671a
2 changed files with 34 additions and 35 deletions
267
.forgejo/workflows/ci.yaml
Normal file
267
.forgejo/workflows/ci.yaml
Normal file
|
|
@ -0,0 +1,267 @@
|
|||
# SPDX-FileCopyrightText: 2021 Robin Appelman <robin@icewind.nl>
|
||||
# SPDX-License-Identifier: MIT
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
|
||||
name: CI
|
||||
|
||||
jobs:
|
||||
php-cs-fixer:
|
||||
name: PHP-CS-Fixer
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup PHP
|
||||
uses: https://github.com/shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.0'
|
||||
extensions: apcu
|
||||
- name: PHP-CS-Fixer
|
||||
uses: https://github.com/OskarStark/php-cs-fixer-ga@2.16.7
|
||||
with:
|
||||
args: --diff --dry-run --allow-risky yes --stop-on-violation --using-cache=no --path-mode=intersection
|
||||
|
||||
php-versions:
|
||||
runs-on: ubuntu-22.04
|
||||
name: Unit tests
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
backend:
|
||||
- smbclient
|
||||
- libsmbclient
|
||||
php-version:
|
||||
- "7.2"
|
||||
- "7.3"
|
||||
- "7.4"
|
||||
- "8.0"
|
||||
- "8.1"
|
||||
- "8.2"
|
||||
- "8.3"
|
||||
- "8.4"
|
||||
|
||||
services:
|
||||
samba:
|
||||
image: "servercontainers/samba"
|
||||
env:
|
||||
ACCOUNT_test: test
|
||||
UID_test: 1000
|
||||
SAMBA_VOLUME_CONFIG_test: "[test]; path=/tmp; valid users = test; guest ok = no; read only = no; browseable = yes"
|
||||
|
||||
steps:
|
||||
- name: Install packages
|
||||
run: |
|
||||
sudo apt-get install smbclient libsmbclient-dev
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup PHP
|
||||
uses: https://github.com/shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: "${{ matrix.php-version }}"
|
||||
extensions: apcu, smbclient
|
||||
coverage: pcov
|
||||
- name: Composer
|
||||
run: composer install
|
||||
- name: Config
|
||||
run: |
|
||||
IP=$(docker inspect ${{ job.services.samba.id }} | jq -r 'map(.NetworkSettings.Networks)[0] | .[].IPAddress')
|
||||
echo "Samba running at $IP"
|
||||
echo '{"host": "'$IP'","user": "test","password": "test","share": "test","root": ""}' > tests/config.json
|
||||
- name: PHPUnit Tests
|
||||
uses: https://github.com/nick-invision/retry@v2
|
||||
with:
|
||||
timeout_minutes: 2
|
||||
max_attempts: 3
|
||||
retry_on: timeout
|
||||
command: php ./vendor/bin/phpunit tests -c tests/phpunit.xml --coverage-clover=coverage.xml
|
||||
env:
|
||||
BACKEND: ${{ matrix.backend }}
|
||||
- uses: https://github.com/codecov/codecov-action@v3
|
||||
with:
|
||||
files: ./coverage.xml
|
||||
|
||||
smb-versions:
|
||||
runs-on: ubuntu-22.04
|
||||
name: Unit tests
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
client-version:
|
||||
- "4.21.4"
|
||||
- "4.20.4"
|
||||
- "4.19.5"
|
||||
- "4.18.1"
|
||||
- "4.17.7"
|
||||
- "4.16.10"
|
||||
- "4.15.13"
|
||||
- "4.14.9"
|
||||
- "4.11.17"
|
||||
server-version:
|
||||
- "latest"
|
||||
- "4.9.4"
|
||||
- "4.8.5"
|
||||
|
||||
services:
|
||||
samba:
|
||||
image: "servercontainers/samba:${{ matrix.server-version }}"
|
||||
env:
|
||||
ACCOUNT_test: test
|
||||
UID_test: 1000
|
||||
SAMBA_VOLUME_CONFIG_test: "[test]; path=/tmp; valid users = test; guest ok = no; read only = no; browseable = yes"
|
||||
|
||||
steps:
|
||||
- name: Setup smbclient
|
||||
run: |
|
||||
sudo apt install libjansson4 libcap2 libbsd0 libreadline8 libicu70
|
||||
sudo mkdir -p /etc/samba /var/lib/samba/private
|
||||
echo "[global]\nclient min protocol = SMB2\nclient max protocol = SMB3" | sudo tee /etc/samba/smb.conf
|
||||
sudo wget "https://github.com/icewind1991/smbclient-builder/releases/download/v0.2.0/smbclient-${{ matrix.client-version }}" -O /usr/local/bin/smbclient
|
||||
sudo chmod +x /usr/local/bin/smbclient
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup PHP
|
||||
uses: https://github.com/shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 8.0
|
||||
extensions: apcu, smbclient
|
||||
coverage: pcov
|
||||
- name: Composer
|
||||
run: composer install
|
||||
- name: Config
|
||||
run: |
|
||||
IP=$(docker inspect ${{ job.services.samba.id }} | jq -r 'map(.NetworkSettings.Networks)[0] | .[].IPAddress')
|
||||
echo "Samba running at $IP"
|
||||
echo '{"host": "'$IP'","user": "test","password": "test","share": "test","root": ""}' > tests/config.json
|
||||
- name: PHPUnit Tests
|
||||
uses: https://github.com/nick-invision/retry@v2
|
||||
with:
|
||||
timeout_minutes: 2
|
||||
max_attempts: 3
|
||||
retry_on: timeout
|
||||
command: php ./vendor/bin/phpunit tests -c tests/phpunit.xml --coverage-clover=coverage.xml
|
||||
env:
|
||||
BACKEND: smbclient
|
||||
- uses: https://github.com/codecov/codecov-action@v3
|
||||
with:
|
||||
files: ./coverage.xml
|
||||
|
||||
alpine-test:
|
||||
runs-on: ubuntu-latest
|
||||
name: Unit tests (alpine)
|
||||
|
||||
services:
|
||||
samba:
|
||||
image: "servercontainers/samba"
|
||||
env:
|
||||
ACCOUNT_test: test
|
||||
UID_test: 1000
|
||||
SAMBA_VOLUME_CONFIG_test: "[test]; path=/tmp; valid users = test; guest ok = no; read only = no; browseable = yes"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup PHP
|
||||
uses: https://github.com/shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 8.0
|
||||
- name: Composer
|
||||
run: composer install
|
||||
- name: Pull images
|
||||
run: |
|
||||
docker pull icewind1991/smbclient-php-alpine
|
||||
- name: Config
|
||||
run: |
|
||||
IP=$(docker inspect ${{ job.services.samba.id }} | jq -r 'map(.NetworkSettings.Networks)[0] | .[].IPAddress')
|
||||
echo "Samba running at $IP"
|
||||
echo '{"host": "'$IP'","user": "test","password": "test","share": "test","root": ""}' > tests/config.json
|
||||
- name: PHPUnit Tests
|
||||
run: |
|
||||
docker run --network "host" --rm -v $PWD:/smb icewind1991/smbclient-php-alpine /smb/vendor/bin/phpunit -c /smb/tests/phpunit.xml /smb/tests
|
||||
|
||||
kerberos-sso:
|
||||
runs-on: ubuntu-latest
|
||||
name: Kerberos SSO tests
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Composer
|
||||
run: composer install
|
||||
- name: Pull images
|
||||
run: |
|
||||
docker pull icewind1991/samba-krb-test-dc
|
||||
docker pull icewind1991/samba-krb-test-apache
|
||||
docker pull icewind1991/samba-krb-test-client
|
||||
- name: Setup AD-DC
|
||||
run: |
|
||||
tests/setup-krb.sh
|
||||
- name: Test kerberos auth
|
||||
run: |
|
||||
DC_IP=$(docker inspect dc --format '{{.NetworkSettings.IPAddress}}')
|
||||
LIST=$(docker run --rm --name client -v /tmp/shared:/shared --dns $DC_IP --hostname client.domain.test icewind1991/samba-krb-test-client \
|
||||
curl -s --negotiate -u testuser@DOMAIN.TEST: --delegation always http://httpd.domain.test/example-sso-kerberos.php)
|
||||
echo $LIST
|
||||
LIST=$(echo $LIST | tr -d '[:space:]')
|
||||
[[ $LIST == "test.txt" ]]
|
||||
- name: Apache logs
|
||||
if: always()
|
||||
run: |
|
||||
docker logs apache
|
||||
|
||||
static-psalm-analysis:
|
||||
runs-on: ubuntu-latest
|
||||
name: Psalm static analysis
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php-version:
|
||||
- "7.2"
|
||||
- "7.3"
|
||||
- "7.4"
|
||||
- "8.0"
|
||||
- "8.1"
|
||||
- "8.2"
|
||||
- "8.3"
|
||||
- "8.4"
|
||||
|
||||
steps:
|
||||
- name: krb5-dev
|
||||
run: sudo apt-get install -y libkrb5-dev libsmbclient-dev
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Set up php
|
||||
uses: https://github.com/shivammathur/setup-php@master
|
||||
with:
|
||||
php-version: "${{ matrix.php-version }}"
|
||||
tools: composer:v2
|
||||
coverage: none
|
||||
extensions: apcu, smbclient, krb5
|
||||
env:
|
||||
fail-fast: true
|
||||
- name: Install dependencies
|
||||
run: composer i
|
||||
- name: Run coding standards check
|
||||
run: composer run psalm
|
||||
|
||||
phpstan:
|
||||
name: PHPStan Static Analysis
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: krb5-dev
|
||||
run: sudo apt-get install -y libkrb5-dev
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup PHP
|
||||
uses: https://github.com/shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.0'
|
||||
extensions: apcu, smbclient, krb5
|
||||
env:
|
||||
fail-fast: true
|
||||
- name: Composer
|
||||
run: composer install
|
||||
- env:
|
||||
BACKEND: smbclient
|
||||
run: php ./vendor/bin/phpstan analyse --level 6 src
|
||||
15
.forgejo/workflows/reuse.yml
Normal file
15
.forgejo/workflows/reuse.yml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# SPDX-FileCopyrightText: 2022 Free Software Foundation Europe e.V. <https://fsfe.org>
|
||||
#
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
name: REUSE Compliance Check
|
||||
|
||||
on: pull_request
|
||||
|
||||
jobs:
|
||||
reuse-compliance-check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: https://github.com/actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
||||
- name: REUSE Compliance Check
|
||||
uses: https://github.com/fsfe/reuse-action@a46482ca367aef4454a87620aa37c2be4b2f8106 # v3.0.0
|
||||
Loading…
Add table
Add a link
Reference in a new issue