name: Build AIP on: workflow_dispatch: pull_request: branches: [ main ] paths: [ 'aip/**' ] push: branches: [ main ] paths: [ 'aip/**' ] jobs: build: runs-on: ubuntu-latest defaults: run: working-directory: aip steps: - name: Checkout code uses: actions/checkout@v4 - name: Install Nix uses: DeterminateSystems/nix-installer-action@main with: logger: pretty - name: Setup Nix cache uses: DeterminateSystems/magic-nix-cache-action@main - name: Check flake run: nix flake check - name: Build Rust binary run: nix build .#aip - name: Build Docker image run: nix build .#aipImg - name: Load Docker image run: docker load < result - name: Test Docker image run: | # Start the container in the background with temp volume docker run -d --name aip-test -p 8080:8080 \ -e EXTERNAL_BASE=http://localhost:8080 \ -e DPOP_NONCE_SEED=test-seed-for-ci \ -e DATABASE_URL=sqlite:///data/aip.db \ -v /tmp/aip-test:/data \ aip:latest # Wait for the service to start sleep 15 # Test the root endpoint curl -f http://localhost:8080 || exit 1 # Stop the test container docker stop aip-test docker rm aip-test - name: Save Docker image as artifact # if: github.ref == 'refs/heads/main' run: docker save aip:latest | gzip > aip-image.tar.gz - name: Upload Docker image artifact # if: github.ref == 'refs/heads/main' uses: actions/upload-artifact@v4 with: name: aip-docker-image path: aip/aip-image.tar.gz retention-days: 1