Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: migrate to Nix Flake build system #33

Merged
merged 7 commits into from
Dec 12, 2024
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
105 changes: 34 additions & 71 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,39 @@ on: [push, pull_request]
jobs:
ci:
name: ci
runs-on: macos-13
# https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md
runs-on: macos-15
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install requirements
run: brew install go meson ninja nasm
- uses: DeterminateSystems/nix-installer-action@v14
with:
extra-conf: |
sandbox = true
sandbox-fallback = false

- name: Nix version
run: nix --version

- name: Show Nix config
run: nix config show

- name: Xcode version
run: /Applications/Xcode_16.1.0.app/Contents/Developer/usr/bin/xcodebuild -version

# See ${workspace}/nix/overlays/xcode.md
- name: Set up Xcode in Nix store
run: |
XCODE_APP=$(realpath /Applications/Xcode_16.1.0.app)
NIX_STORE_PATH="/nix/store/v92p4w6nxhyhq6lv0maq5cbb59mbxw5b-Xcode.app"
HASH="sha256:d63c91255c8e98603b7f1470067c5225ab673850eed35449f5a0105c936e581c"

sudo cp -a $XCODE_APP $NIX_STORE_PATH
sudo sqlite3 /nix/var/nix/db/db.sqlite "INSERT INTO ValidPaths (path,hash,registrationTime) VALUES ('$NIX_STORE_PATH','$HASH',$(date +%s))"

- name: Print tool versions
run: make tool-versions
- uses: DeterminateSystems/magic-nix-cache-action@v8

- name: Determine version
id: version
Expand All @@ -34,80 +55,22 @@ jobs:
echo ${VERSION}

- name: Build
# macOS runners have unknown resource limits (timeout or number of open
# files…) that prevent the execution of a single Makefile rule that
# manages all builds. So the time per rule must be limited.
run: |
VERSION=${{ steps.version.outputs.version }}
make build/output/libmpv-libs_${VERSION}_ios-arm64-audio-default.tar.gz
make build/output/libmpv-libs_${VERSION}_ios-arm64-audio-full.tar.gz
make build/output/libmpv-libs_${VERSION}_ios-arm64-audio-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_ios-arm64-video-default.tar.gz
make build/output/libmpv-libs_${VERSION}_ios-arm64-video-full.tar.gz
make build/output/libmpv-libs_${VERSION}_ios-arm64-video-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-amd64-audio-default.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-amd64-audio-full.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-amd64-audio-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-amd64-video-default.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-amd64-video-full.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-amd64-video-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-arm64-audio-default.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-arm64-audio-full.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-arm64-audio-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-arm64-video-default.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-arm64-video-full.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-arm64-video-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-universal-audio-default.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-universal-audio-full.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-universal-audio-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-universal-video-default.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-universal-video-full.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-universal-video-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-amd64-audio-default.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-amd64-audio-full.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-amd64-audio-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-amd64-video-default.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-amd64-video-full.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-amd64-video-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-arm64-audio-default.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-arm64-audio-full.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-arm64-audio-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-arm64-video-default.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-arm64-video-full.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-arm64-video-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-universal-audio-default.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-universal-audio-full.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-universal-audio-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-universal-video-default.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-universal-video-full.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-universal-video-encodersgpl.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_ios-universal-audio-default.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_ios-universal-audio-full.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_ios-universal-audio-encodersgpl.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_ios-universal-video-default.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_ios-universal-video-full.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_ios-universal-video-encodersgpl.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_macos-universal-audio-default.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_macos-universal-audio-full.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_macos-universal-audio-encodersgpl.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_macos-universal-video-default.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_macos-universal-video-full.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_macos-universal-video-encodersgpl.tar.gz
make build/output/debug.zip
echo \"$VERSION\" > nix/utils/default/version.nix
nix build -v

- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
path: |
build/output/debug.zip
build/output/*.tar.gz
result/*.tar.gz

- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
fail_on_unmatched_files: true
files: |
build/output/debug.zip
build/output/*.tar.gz
result/*.tar.gz
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
build
result
10 changes: 0 additions & 10 deletions .tool-versions

This file was deleted.

3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"recommendations": [
"redhat.vscode-yaml",
"bierner.markdown-mermaid",
"foxundermoon.shell-format"
"foxundermoon.shell-format",
"jnoortheen.nix-ide"
]
}
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,18 @@
"editor.formatOnSave": true,
"[yaml]": {
"editor.defaultFormatter": "redhat.vscode-yaml"
},
"nix.serverPath": "nixd",
"nix.enableLanguageServer": true,
"nix.formatterPath": "nixfmt",
"nix.serverSettings": {
"nixd": {
"nixpkgs": {
"expr": "import <nixpkgs> { }",
},
"formatting": {
"command": [ "nixfmt" ],
},
}
}
}
Loading