Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI

on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review

permissions:
contents: read
id-token: write

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
build-and-test:
name: Build and Test
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main

- name: Enable Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@main

- name: Build
run: nix develop -c zig build -Dnix

- name: Test
run: nix develop -c zig build test -Dnix
135 changes: 135 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Release

on:
push:
branches:
- main
tags:
- "v*"

permissions:
contents: write
id-token: write

jobs:
release:
name: Release
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main

- name: Enable Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@main

- name: Resolve and Validate Release Version
id: version
run: |
# Grab the version from build.zig.zon.
base_version="$(sed -n 's/^[[:space:]]*\.version = "\(.*\)",/\1/p' build.zig.zon | head -n1)"
if [ -z "$base_version" ]; then
echo "Failed to parse version from build.zig.zon" >&2
exit 1
fi

# If triggered by a new tag.
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
expected_tag="v${base_version}"
actual_tag="${GITHUB_REF_NAME}"

if [ "$actual_tag" != "$expected_tag" ]; then
echo "Tag/version mismatch. build.zig.zon has ${base_version}, expected tag ${expected_tag}, got ${actual_tag}" >&2
exit 1
fi

release_tag="${actual_tag}"
release_version="${base_version}"
prerelease="false"
# Triggered by merge to main.
else
short_sha="$(git rev-parse --short=8 HEAD)"
release_version="${base_version}+g${short_sha}"
release_tag="nightly"
prerelease="true"
fi

echo "release_tag=${release_tag}" >> "$GITHUB_OUTPUT"
echo "release_version=${release_version}" >> "$GITHUB_OUTPUT"
echo "prerelease=${prerelease}" >> "$GITHUB_OUTPUT"

- name: Build and Test
run: |
nix develop -c bash -lc '
set -euo pipefail
echo "Release version: ${{ steps.version.outputs.release_version }}"
zig build -Dnix
zig build test -Dnix
'

- name: Build Release Binaries
run: nix develop -c zig build -Dappimage -Doptimize=ReleaseFast

# - name: Package Linux
# run: tar -czf spacecap-linux-x86_64.tar.gz -C zig-out linux

# - name: Package Windows
# run: zip -r spacecap-windows-x86_64.zip zig-out/windows

- name: Generate Checksums
run: |
# sha256sum spacecap-linux-x86_64.tar.gz > SHA256SUMS.txt
# sha256sum spacecap-windows-x86_64.zip >> SHA256SUMS.txt
sha256sum zig-out/linux/spacecap-linux-x86_64.AppImage >> SHA256SUMS.txt

- name: Upload Workflow Artifacts
uses: actions/upload-artifact@v4
with:
name: spacecap-release-assets
# spacecap-linux-x86_64.tar.gz is currently disabled.
# spacecap-windows-x86_64.zip is currently disabled.
path: |
zig-out/linux/spacecap-linux-x86_64.AppImage
SHA256SUMS.txt

- name: Move Nightly Tag
if: github.ref_type != 'tag'
run: |
git tag -f nightly "${GITHUB_SHA}"
git push --force origin refs/tags/nightly

- name: Check Existing Release
id: existing_release
env:
GH_TOKEN: ${{ github.token }}
run: |
if gh release view "${{ steps.version.outputs.release_tag }}" > /dev/null 2>&1; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi

- name: Delete Existing Nightly Release
if: github.ref_type != 'tag' && steps.existing_release.outputs.exists == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: gh release delete "${{ steps.version.outputs.release_tag }}" --yes

- name: Publish GitHub Release Assets
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.release_tag }}
target_commitish: ${{ github.sha }}
prerelease: ${{ steps.version.outputs.prerelease }}
generate_release_notes: ${{ github.ref_type != 'tag' || steps.existing_release.outputs.exists != 'true' }}
append_body: false
# spacecap-linux-x86_64.tar.gz is currently disabled.
# spacecap-windows-x86_64.zip is currently disabled.
files: |
zig-out/linux/spacecap-linux-x86_64.AppImage
SHA256SUMS.txt
60 changes: 57 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,64 @@ alternative to OBS for capturing video replays.

**NOTE:** I'm testing with an RTX 3080 GPU. I have no idea if AMD works. I don't have one to test on.

## How to compile and run
## Linux Requirements

Currently this only works on Linux with [Nix](https://nixos.org/download/#download-nix).
A GPU that supports Vulkan Video is required for recording.
- vulkan (and related graphics drivers)
- pipewire
- pipewire-pulse

### Installation

**NOTE:** A reboot may be required.

#### NixOS

There is currently not a Nix package published, but for now you can use
`appimage-run` to execute the appimage.

TODO: Add vulkan instructions.

```nix
{...}: {
security.rtkit.enable = true;

services.pipewire = {
enable = true;
alsa.enable = false;
pulse.enable = true;
wireplumber.enable = true;
};

environment.systemPackages = with pkgs; [
appimage-run
];
}
```

#### Arch

TODO: Add vulkan instructions.

```sh
sudo pacman -S --needed wireplumber pipewire pipewire-pulse pipewire-alsa fuse3
systemctl --user --now enable pipewire pipewire-pulse wireplumber
```

#### Ubuntu

TODO: Add vulkan instructions.

```sh
sudo apt update
sudo apt install wireplumber pipewire pipewire-pulse pipewire-alsa fuse3
systemctl --user --now enable pipewire pipewire-pulse wireplumber
```

## Development

[Nix](https://nixos.org/download/#download-nix) is required for development,
unless you want to install all dependencies manually. See `flake.nix` if you'd
like to do so.

```sh
# Build
Expand Down
Loading
Loading