Document and test cross-compilation #48
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
| on: [push, pull_request] | |
| name: CI | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref_name != 'main' && github.ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| fmt: | |
| runs-on: namespace-profile-ghostty-xsm | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup Cache | |
| uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9 # v1.4.2 | |
| with: | |
| path: /nix | |
| - name: Setup Nix | |
| uses: cachix/install-nix-action@616559265b40713947b9c190a8ff4b507b5df49b # v31.10.4 | |
| with: | |
| nix_path: nixpkgs=channel:nixos-unstable | |
| - name: Check formatting | |
| run: nix develop -c sh -c 'test -z "$(gofmt -l .)"' | |
| test: | |
| runs-on: namespace-profile-ghostty-sm | |
| env: | |
| ZIG_LOCAL_CACHE_DIR: /zig/local-cache | |
| ZIG_GLOBAL_CACHE_DIR: /zig/global-cache | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup Cache | |
| uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9 # v1.4.2 | |
| with: | |
| path: | | |
| /nix | |
| /zig | |
| - name: Setup Nix | |
| uses: cachix/install-nix-action@616559265b40713947b9c190a8ff4b507b5df49b # v31.10.4 | |
| with: | |
| nix_path: nixpkgs=channel:nixos-unstable | |
| - name: Build libghostty | |
| run: nix develop -c make build | |
| - name: Test | |
| run: nix develop -c make test | |
| list-examples: | |
| runs-on: namespace-profile-ghostty-xsm | |
| outputs: | |
| examples: ${{ steps.list.outputs.examples }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - id: list | |
| name: List example directories | |
| run: | | |
| examples=$(ls -d examples/*/main.go 2>/dev/null | xargs -n1 dirname | xargs -n1 basename | jq -R -s -c 'split("\n") | map(select(. != ""))') | |
| echo "$examples" | jq . | |
| echo "examples=$examples" >> "$GITHUB_OUTPUT" | |
| examples: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| example: ${{ fromJSON(needs.list-examples.outputs.examples) }} | |
| name: Example ${{ matrix.example }} | |
| runs-on: namespace-profile-ghostty-sm | |
| needs: [list-examples] | |
| env: | |
| ZIG_LOCAL_CACHE_DIR: /zig/local-cache | |
| ZIG_GLOBAL_CACHE_DIR: /zig/global-cache | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup Cache | |
| uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9 # v1.4.2 | |
| with: | |
| path: | | |
| /nix | |
| /zig | |
| - name: Setup Nix | |
| uses: cachix/install-nix-action@616559265b40713947b9c190a8ff4b507b5df49b # v31.10.4 | |
| with: | |
| nix_path: nixpkgs=channel:nixos-unstable | |
| - name: Build libghostty | |
| run: nix develop -c make build | |
| - name: Run example | |
| run: nix develop -c go run ./examples/${{ matrix.example }}/ | |
| cross: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: | |
| - linux-amd64 | |
| - linux-arm64 | |
| - macos-amd64 | |
| - macos-arm64 | |
| - windows-amd64 | |
| - windows-arm64 | |
| name: Cross ${{ matrix.target }} | |
| runs-on: namespace-profile-ghostty-sm | |
| env: | |
| ZIG_LOCAL_CACHE_DIR: /zig/local-cache | |
| ZIG_GLOBAL_CACHE_DIR: /zig/global-cache | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup Cache | |
| uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9 # v1.4.2 | |
| with: | |
| path: | | |
| /nix | |
| /zig | |
| - name: Setup Nix | |
| uses: cachix/install-nix-action@616559265b40713947b9c190a8ff4b507b5df49b # v31.10.4 | |
| with: | |
| nix_path: nixpkgs=channel:nixos-unstable | |
| - name: Cross-compile | |
| run: nix develop -c make cross-${{ matrix.target }} | |
| build-shared: | |
| runs-on: namespace-profile-ghostty-sm | |
| env: | |
| ZIG_LOCAL_CACHE_DIR: /zig/local-cache | |
| ZIG_GLOBAL_CACHE_DIR: /zig/global-cache | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup Cache | |
| uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9 # v1.4.2 | |
| with: | |
| path: | | |
| /nix | |
| /zig | |
| - name: Setup Nix | |
| uses: cachix/install-nix-action@616559265b40713947b9c190a8ff4b507b5df49b # v31.10.4 | |
| with: | |
| nix_path: nixpkgs=channel:nixos-unstable | |
| - name: Build libghostty | |
| run: nix develop -c make build | |
| - name: Build (shared) | |
| run: nix develop -c go build ./... | |
| build-static: | |
| runs-on: namespace-profile-ghostty-sm | |
| env: | |
| ZIG_LOCAL_CACHE_DIR: /zig/local-cache | |
| ZIG_GLOBAL_CACHE_DIR: /zig/global-cache | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup Cache | |
| uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9 # v1.4.2 | |
| with: | |
| path: | | |
| /nix | |
| /zig | |
| - name: Setup Nix | |
| uses: cachix/install-nix-action@616559265b40713947b9c190a8ff4b507b5df49b # v31.10.4 | |
| with: | |
| nix_path: nixpkgs=channel:nixos-unstable | |
| - name: Build libghostty | |
| run: nix develop -c make build | |
| - name: Build (static) | |
| run: nix develop -c go build -tags static ./... | |
| pinact: | |
| name: "GitHub Actions Pins" | |
| runs-on: namespace-profile-ghostty-xsm | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup Cache | |
| uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9 # v1.4.2 | |
| with: | |
| path: /nix | |
| - uses: cachix/install-nix-action@616559265b40713947b9c190a8ff4b507b5df49b # v31.10.4 | |
| with: | |
| nix_path: nixpkgs=channel:nixos-unstable | |
| - name: pinact check | |
| run: nix develop -c pinact run --check | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |