diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b04ff38 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,72 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Test + runs-on: macos-15 + steps: + - uses: actions/checkout@v4 + + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: "16" + + - name: Run tests + run: swift test --package-path Packages/CrowCore + + build: + name: Build + runs-on: macos-15 + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: "16" + + - uses: mlugg/setup-zig@v2 + with: + version: 0.15.2 + + - name: Get Ghostty submodule SHA + id: ghostty-sha + run: echo "sha=$(git -C vendor/ghostty rev-parse HEAD)" >> "$GITHUB_OUTPUT" + + - name: Cache Ghostty framework + id: ghostty-cache + uses: actions/cache@v4 + with: + path: Frameworks + key: ghostty-${{ runner.os }}-${{ runner.arch }}-${{ steps.ghostty-sha.outputs.sha }} + + - name: Build Ghostty + if: steps.ghostty-cache.outputs.cache-hit != 'true' + run: | + unset ZIG_LOCAL_CACHE_DIR ZIG_GLOBAL_CACHE_DIR + make ghostty + + - name: Cache SPM dependencies + uses: actions/cache@v4 + with: + path: .build + key: spm-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('Package.swift', 'Packages/*/Package.swift') }} + restore-keys: | + spm-${{ runner.os }}-${{ runner.arch }}- + + - name: Generate build info + run: bash scripts/generate-build-info.sh + + - name: Build + run: swift build