test proxy implementation #69
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Test | |
| on: | |
| push: | |
| branches: [main, master, mp/cache-proxy] | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| test-python-module: | |
| name: Test Python Module | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | |
| - name: Install mise | |
| uses: jdx/mise-action@9dc7d5dd454262207dea3ab5a06a3df6afc8ff26 # v3.4.1 | |
| with: | |
| version: 2025.11.2 | |
| - name: Install dependencies | |
| run: poetry install --no-interaction | |
| - name: Run tests | |
| run: poetry run pytest | |
| - name: Check code can be imported | |
| run: poetry run python -c "from ccache_s3_proxy import server, handler; print('Import successful')" | |
| test-action: | |
| name: Test GitHub Action | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | |
| - name: Start ccache S3 proxy | |
| uses: ./ | |
| id: proxy | |
| with: | |
| s3-prefix: 'test-cache/' | |
| proxy-port: '8080' | |
| - name: Check proxy | |
| run: | | |
| set -x | |
| echo "proxy-url: ${{ steps.proxy.outputs.proxy-url }}" | |
| echo "hello world!" > file.txt | |
| curl -s -X POST --data-binary file.txt http://${{ steps.proxy.outputs.proxy-url }}/file-txt | |
| curl -s -X HEAD http://${{ steps.proxy.outputs.proxy-url }}/file-txt | |
| if [ $? -ne 0 ]; then | |
| echo "Proxy is not working" | |
| exit 1 | |
| fi | |
| curl -s http://${{ steps.proxy.outputs.proxy-url }}/file-txt > file-txt | |
| diff file.txt file-txt | |
| if [ $? -ne 0 ]; then | |
| echo "Proxy is not working" | |
| exit 1 | |
| fi | |
| curl -s -X DELETE http://${{ steps.proxy.outputs.proxy-url }}/file-txt | |
| if [ $? -ne 0 ]; then | |
| echo "Proxy is not working" | |
| exit 1 | |
| fi | |
| curl -s -X HEAD http://${{ steps.proxy.outputs.proxy-url }}/file-txt | |
| if [ $? -eq 0 ]; then | |
| echo "Proxy is not working" | |
| exit 1 | |
| fi | |
| - name: Show proxy log | |
| if: always() | |
| run: cat proxy.log | |
| - name: Verify proxy is running | |
| run: | | |
| curl -f http://localhost:8080/ || echo "Proxy endpoint returned expected error" |