diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5de9eba --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,66 @@ +name: CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + + steps: + # ------------------------- + # Checkout Repository + # ------------------------- + - name: Checkout repository + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac + + # ------------------------- + # Setup Python + # ------------------------- + - name: Set up Python + uses: actions/setup-python@82c7b7d3d8a1e3a0f5bd8b7cbdeb18f0d33bd44b + with: + python-version: "3.11" + + # ------------------------- + # Cache pip + # ------------------------- + - name: Cache pip + uses: actions/cache@0c45773b623bea8c8e75f6c3e2c9a6d6f8a6f6e + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + # ------------------------- + # Install dependencies + # ------------------------- + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + + # ------------------------- + # Run tests (optional) + # ------------------------- + - name: Run tests + run: | + if [ -d tests ]; then pytest -q; else echo "No tests found."; fi + + # ------------------------- + # Upload build artifacts + # ------------------------- + - name: Upload artifacts + uses: actions/upload-artifact@26f96dfa697d77e81fd6a52f08c5e3d5c4d7e4a9 + with: + name: build-output + path: | + dist/ + build/