Timesheetpy #12
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: Test and Build | |
| on: | |
| pull_request: | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" | |
| jobs: | |
| test-and-build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v5 | |
| - name: Set up Java | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: "21" | |
| - name: Set up Clojure CLI | |
| run: | | |
| curl -fsSL -O https://download.clojure.org/install/linux-install-1.12.4.1602.sh | |
| chmod +x linux-install-1.12.4.1602.sh | |
| sudo ./linux-install-1.12.4.1602.sh | |
| - name: Cache Clojure dependencies | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.gitlibs | |
| ~/.m2/repository | |
| key: ${{ runner.os }}-clojure-${{ hashFiles('deps.edn') }} | |
| restore-keys: | | |
| ${{ runner.os }}-clojure- | |
| - name: Download PocketBase | |
| env: | |
| POCKETBASE_VERSION: "0.36.6" | |
| run: | | |
| curl -fsSL -o /tmp/pocketbase.zip \ | |
| "https://github.com/pocketbase/pocketbase/releases/download/v${POCKETBASE_VERSION}/pocketbase_${POCKETBASE_VERSION}_linux_amd64.zip" | |
| unzip -q /tmp/pocketbase.zip -d /tmp/pocketbase | |
| chmod +x /tmp/pocketbase/pocketbase | |
| - name: Initialize PocketBase superuser | |
| env: | |
| PB_SUPERUSER_EMAIL: admin@example.org | |
| PB_SUPERUSER_PASSWORD: change-me | |
| run: | | |
| mkdir -p /tmp/pb_ci_data | |
| /tmp/pocketbase/pocketbase superuser create "$PB_SUPERUSER_EMAIL" "$PB_SUPERUSER_PASSWORD" --dir /tmp/pb_ci_data || \ | |
| /tmp/pocketbase/pocketbase superuser upsert "$PB_SUPERUSER_EMAIL" "$PB_SUPERUSER_PASSWORD" --dir /tmp/pb_ci_data | |
| - name: Start PocketBase | |
| run: | | |
| /tmp/pocketbase/pocketbase serve \ | |
| --http 127.0.0.1:8090 \ | |
| --dir /tmp/pb_ci_data \ | |
| >/tmp/pocketbase.log 2>&1 & | |
| echo $! > /tmp/pocketbase.pid | |
| - name: Wait for PocketBase health | |
| run: | | |
| for _ in $(seq 1 30); do | |
| if curl -fsS http://127.0.0.1:8090/api/health >/dev/null; then | |
| exit 0 | |
| fi | |
| sleep 1 | |
| done | |
| cat /tmp/pocketbase.log | |
| exit 1 | |
| - name: Initialize PocketBase users collection | |
| env: | |
| AGILADMIN_CONF: doc/agiladmin.pocketbase.yaml | |
| run: clojure -M -m agiladmin.pocketbase-init | |
| - name: Run tests | |
| run: make test CLOJURE=clojure | |
| - name: Run PocketBase integration tests | |
| env: | |
| AGILADMIN_PB_IT: "1" | |
| AGILADMIN_PB_BASE_URL: http://127.0.0.1:8090 | |
| AGILADMIN_PB_SUPERUSER_EMAIL: admin@example.org | |
| AGILADMIN_PB_SUPERUSER_PASSWORD: change-me | |
| AGILADMIN_PB_IT_USER_EMAIL: agiladmin-it@example.org | |
| AGILADMIN_PB_IT_USER_PASSWORD: agiladmin-it-secret | |
| run: make test-pocketbase-integration CLOJURE=clojure | |
| - name: Build uberjar | |
| run: make build CLOJURE=clojure | |
| - name: Print PocketBase log on failure | |
| if: failure() | |
| run: | | |
| test -f /tmp/pocketbase.log && cat /tmp/pocketbase.log || true |