name: CI on: push: branches: [main] pull_request: branches: [main] jobs: build-linux: runs-on: ubuntu-latest strategy: matrix: compiler: [gcc, clang] steps: - name: Checkout uses: actions/checkout@v4 - name: Install dependencies run: | sudo apt-get update sudo apt-get install -y build-essential libsqlite3-dev libssl-dev uuid-dev - name: Build with Make run: make CC=${{ matrix.compiler }} - name: Run basic tests run: | ./nwedav --version ./webdavctl --help - name: Build with CMake run: | mkdir -p build && cd build cmake -DCMAKE_C_COMPILER=${{ matrix.compiler }} .. make build-macos: runs-on: macos-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Install dependencies run: brew install sqlite openssl - name: Build run: make - name: Verify binaries run: | ./nwedav --version ./webdavctl --help static-analysis: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Install dependencies run: | sudo apt-get update sudo apt-get install -y cppcheck - name: Run cppcheck run: | cppcheck --enable=warning,style,performance \ --suppress=missingIncludeSystem \ --error-exitcode=1 \ --inline-suppr \ -I include -I src \ src/ integration-test: runs-on: ubuntu-latest needs: build-linux steps: - name: Checkout uses: actions/checkout@v4 - name: Install dependencies run: | sudo apt-get update sudo apt-get install -y build-essential libsqlite3-dev libssl-dev uuid-dev curl - name: Build run: make - name: Initialize and start server run: | mkdir -p /tmp/nwedav_test ./webdavctl init -d /tmp/nwedav_test ./nwedav -d /tmp/nwedav_test -p 8888 & sleep 2 - name: Test HTTP endpoints run: | curl -s -o /dev/null -w "%{http_code}" http://localhost:8888/ | grep -E "401|404" curl -s -X OPTIONS http://localhost:8888/ -I | grep "DAV: 1, 2" curl -s -X PROPFIND http://localhost:8888/ -H "Depth: 0" -o /dev/null -w "%{http_code}" | grep -E "401|404|207" - name: Stop server run: pkill nwedav || true release: runs-on: ubuntu-latest needs: [build-linux, build-macos, static-analysis, integration-test] if: github.event_name == 'push' && github.ref == 'refs/heads/main' steps: - name: Checkout uses: actions/checkout@v4 - name: Install dependencies run: | sudo apt-get update sudo apt-get install -y build-essential libsqlite3-dev libssl-dev uuid-dev - name: Build release run: make CFLAGS="-O3 -DNDEBUG" - name: Create release archive run: | VERSION=$(grep NWEDAV_VERSION_STRING include/nwedav.h | cut -d'"' -f2) mkdir -p release/nwedav-${VERSION} cp nwedav webdavctl release/nwedav-${VERSION}/ cp nwedav.conf.sample release/nwedav-${VERSION}/ cp README.md LICENSE release/nwedav-${VERSION}/ 2>/dev/null || true cd release && tar -czvf nwedav-${VERSION}-linux-x86_64.tar.gz nwedav-${VERSION}