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
1 change: 1 addition & 0 deletions .envrc.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
39 changes: 39 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CI/CD
on:
workflow_call:
push:
branches:
- main
pull_request:
workflow_dispatch:

# https://stackoverflow.com/a/72408109
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
check-inputs:
runs-on: ubuntu-24.11
outputs:
is-default-branch: ${{ steps.set-is-default-branch.outputs.CI_IS_DEFAULT_BRANCH }}

steps:
- name: Set is-default-branch
id: set-is-default-branch
run: |
CI_IS_DEFAULT_BRANCH="${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}"
echo "CI_IS_DEFAULT_BRANCH=${CI_IS_DEFAULT_BRANCH}" >> $GITHUB_OUTPUT
echo "CI_IS_DEFAULT_BRANCH=${CI_IS_DEFAULT_BRANCH}" >> $GITHUB_ENV
echo "CI_IS_DEFAULT_BRANCH=${CI_IS_DEFAULT_BRANCH}"

nix:
name: Nix
needs: check-inputs
uses: ./.github/workflows/nix.yaml
secrets: inherit

csharp:
name: C#
needs: check-inputs
uses: ./.github/workflows/csharp.yaml
14 changes: 14 additions & 0 deletions .github/workflows/csharp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: C#
on:
workflow_dispatch:
workflow_call:

jobs:
build_upm:
name: Build Unity Packages
runs-on: ubuntu-24.11
steps:
- uses: actions/checkout@v4
- name: Build
runs: |
just build
19 changes: 19 additions & 0 deletions .github/workflows/nix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Nix CI
on:
workflow_call:
secrets:
CACHIX_AUTH_TOKEN:
required: true

jobs:
fmt:
name: Check Nix Formatting
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v30
# - uses: cachix/cachix-action@v15
# with:
# name: basis-ci
# authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- run: nix develop -c nixpkgs-fmt --check .
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,7 @@ crashlytics-build.properties
# Temporary auto-generated Android Assets
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*

# nix stuff
.direnv/
.envrc
78 changes: 78 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
description = "BasisVR/UpmBuilds repo";

inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/release-24.11";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};

outputs = inputs-raw@{ flake-utils, ... }:
let
# All systems we may care about evaluating nixpkgs for
systems = with flake-utils.lib.system; [ x86_64-linux aarch64-linux aarch64-darwin x86_64-darwin ];
perSystem = (system: rec {
inputs = inputs-raw;
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [
((import nix/overlays/nixpkgs-unstable.nix) { inherit inputs; })
];
config = {
# allowUnfree = true;
permittedInsecurePackages = [
# Needed for roslyn-ls, see
# https://github.com/NixOS/nixpkgs/blob/4989a246/pkgs/by-name/ro/roslyn-ls/package.nix#L21
"dotnet-sdk-6.0.428"
];
};
};
});
# This `s` helper variable caches each system we care about in one spot
inherit (flake-utils.lib.eachSystem systems (system: { s = perSystem system; })) s;
in
# System-specific stuff goes in here, by using the flake-utils helper functions
flake-utils.lib.eachSystem systems
(system:
let
inherit (s.${system}) pkgs inputs;
in
{
formatter = pkgs.nixpkgs-fmt;
devShells = import ./nix/devShells.nix { inherit system pkgs inputs; };
}
);
}
3 changes: 3 additions & 0 deletions msbuild/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Packages from MSBuild

These packages are built from msbuild, and turned into Unity Packages.
25 changes: 25 additions & 0 deletions msbuild/SimpleBase/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
git_repo := "https://github.com/ssg/SimpleBase.git"
git_ref := "4.0.2"
dll_name := "SimpleBase.dll"
out_dir := invocation_directory()

working_dir := `mktemp -d`
repo_dir := working_dir / "repo"
dotnet_artifact_dir := working_dir / "dotnet_artifacts"

default:
just --list

# Clean build outputs
clean:
dotnet clean {{repo_dir}} || true
rm -rf {{repo_dir}}/**/bin {{repo_dir}}/**/obj

clone:
git clone --single-branch --branch {{git_ref}} {{git_repo}} {{repo_dir}}

restore:
dotnet restore {{repo_dir}} --artifacts-path {{dotnet_artifact_dir}}

build: restore
dotnet build --configuration Release {{repo_dir}} -o {{dotnet_artifact_dir}}
7 changes: 7 additions & 0 deletions msbuild/SimpleBase/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "org.basisvr.simplebase",
"version": "4.0.2",
"displayName": "SimpleBase",
"description": "Base16, Base32, Base58, Base85 encoding/decoding library",
"documentationUrl": "https://github.com/ssg/SimpleBase"
}
26 changes: 26 additions & 0 deletions nix/devShells.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Defines all devShells for the flake
{ system, pkgs, inputs }:
let
dotnet = (with pkgs.dotnetCorePackages;
# Multiple dotnet sdks can be provided here
combinePackages [
sdk_9_0
]);
in
{
default = pkgs.mkShell {
# These programs be available to the dev shell
buildInputs = (with pkgs; [
dotnet
just
nixpkgs-fmt
roslyn-ls
]) ++ pkgs.lib.optional pkgs.stdenv.isDarwin [
pkgs.libiconv
];

# Hook the shell to set custom env vars
shellHook = ''
'';
};
}
7 changes: 7 additions & 0 deletions nix/overlays/nixpkgs-unstable.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{ inputs, ... }:
final: _prev: {
unstable = import inputs.nixpkgs-unstable {
system = final.system;
config = final.config;
};
}