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
169 changes: 169 additions & 0 deletions .github/workflows/taimihud-datasources.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
env:
CI_ALLOW_ROOT: '1'
CI_CONFIG: ./ci/config.nix
CI_PLATFORM: gh-actions
jobs:
ci-check:
name: taimihud-datasources check
runs-on: ubuntu-latest
steps:
- id: checkout
name: git clone
uses: actions/checkout@v4
with:
submodules: true
- id: nix-install
name: nix install
uses: arcnmx/ci/actions/nix/install@v0.7
- id: ci-action-build
name: nix build ci.gh-actions.configFile
uses: arcnmx/ci/actions/nix/build@v0.7
with:
attrs: ci.gh-actions.configFile
out-link: .ci/workflow.yml
- id: ci-action-compare
name: gh-actions compare
uses: arcnmx/ci/actions/nix/run@v0.7
with:
args: -u .github/workflows/taimihud-datasources.yml .ci/workflow.yml
attrs: nixpkgs.diffutils
command: diff
main:
name: taimihud-datasources-main
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- id: checkout
name: git clone
uses: actions/checkout@v4
with:
submodules: true
- id: nix-install
name: nix install
uses: arcnmx/ci/actions/nix/install@v0.7
- id: ci-setup
name: nix setup
uses: arcnmx/ci/actions/nix/run@v0.7
with:
attrs: ci.job.main.run.bootstrap
quiet: false
- id: ci-dirty
name: nix test dirty
uses: arcnmx/ci/actions/nix/run@v0.7
with:
attrs: ci.job.main.run.test
command: ci-build-dirty
quiet: false
stdout: ${{ runner.temp }}/ci.build.dirty
- id: ci-test
name: nix test build
uses: arcnmx/ci/actions/nix/run@v0.7
with:
attrs: ci.job.main.run.test
command: ci-build-realise
ignore-exit-code: true
quiet: false
stdin: ${{ runner.temp }}/ci.build.dirty
- env:
CI_EXIT_CODE: ${{ steps.ci-test.outputs.exit-code }}
id: ci-summary
name: nix test results
uses: arcnmx/ci/actions/nix/run@v0.7
with:
attrs: ci.job.main.run.test
command: ci-build-summarise
quiet: false
stdin: ${{ runner.temp }}/ci.build.dirty
stdout: ${{ runner.temp }}/ci.build.cache
- env:
CACHIX_SIGNING_KEY: ${{ secrets.CACHIX_SIGNING_KEY }}
id: ci-cache
if: always()
name: nix test cache
uses: arcnmx/ci/actions/nix/run@v0.7
with:
attrs: ci.job.main.run.test
command: ci-build-cache
quiet: false
stdin: ${{ runner.temp }}/ci.build.cache
- id: artifact-build
name: artifact build
uses: arcnmx/ci/actions/nix/build@v0.7
with:
attrs: config.jobs.main.artifactPackage
file: <ci>
out-link: .ci/artifacts
- id: artifact-upload
name: artifact upload
uses: actions/upload-artifact@v4
with:
name: TaimiHUD-DataSources
path: .ci/artifacts/share/taimihud/sources.toml
- id: release-upload
if: startsWith(github.ref, 'refs/tags/')
name: release
uses: softprops/action-gh-release@v1
with:
files: .ci/artifacts/share/taimihud/sources.toml
updates:
name: taimihud-datasources-updates
runs-on: ubuntu-latest
steps:
- id: checkout
name: git clone
uses: actions/checkout@v4
with:
submodules: true
- id: nix-install
name: nix install
uses: arcnmx/ci/actions/nix/install@v0.7
- id: ci-setup
name: nix setup
uses: arcnmx/ci/actions/nix/run@v0.7
with:
attrs: ci.job.updates.run.bootstrap
quiet: false
- id: ci-dirty
name: nix test dirty
uses: arcnmx/ci/actions/nix/run@v0.7
with:
attrs: ci.job.updates.run.test
command: ci-build-dirty
quiet: false
stdout: ${{ runner.temp }}/ci.build.dirty
- id: ci-test
name: nix test build
uses: arcnmx/ci/actions/nix/run@v0.7
with:
attrs: ci.job.updates.run.test
command: ci-build-realise
ignore-exit-code: true
quiet: false
stdin: ${{ runner.temp }}/ci.build.dirty
- env:
CI_EXIT_CODE: ${{ steps.ci-test.outputs.exit-code }}
id: ci-summary
name: nix test results
uses: arcnmx/ci/actions/nix/run@v0.7
with:
attrs: ci.job.updates.run.test
command: ci-build-summarise
quiet: false
stdin: ${{ runner.temp }}/ci.build.dirty
stdout: ${{ runner.temp }}/ci.build.cache
- env:
CACHIX_SIGNING_KEY: ${{ secrets.CACHIX_SIGNING_KEY }}
id: ci-cache
if: always()
name: nix test cache
uses: arcnmx/ci/actions/nix/run@v0.7
with:
attrs: ci.job.updates.run.test
command: ci-build-cache
quiet: false
stdin: ${{ runner.temp }}/ci.build.cache
name: taimihud-datasources
'on':
- push
- pull_request
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# TaimiHUD data sources

This is a repository to be used for requests to list data sources for TaimiHUD.

## Updating

(this isn't necessary in order to generate sources.toml to be consumed by TaimiHUD so can be ignored for now)

This should be automated by CI, but some of the manual process will be described here.

```bash
nix build -L .#allUpdateChecks
```
102 changes: 102 additions & 0 deletions ci/config.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{ config, pkgs, lib, ... }: with pkgs; with lib; let
datasources = import ../.;
legacyPackages = datasources.legacyPackages.${pkgs.system};
packages = datasources.packages.${pkgs.system};
artifactRoot = ".ci/artifacts";
artifacts = "${artifactRoot}/${sourcesTomlPath}";
release = "${artifactRoot}/${sourcesTomlPath}";
sourcesTomlPath = "share/taimihud/sources.toml";
sourcesToml = linkFarm "taimihud-sources.toml" [
{ name = sourcesTomlPath; path = packages.sourcesToml; }
];
in
{
config = {
name = "taimihud-datasources";
ci.version = "v0.7";
ci.gh-actions = {
enable = true;
export = true;
};
cache.cachix.taimihud = {
enable = true;
publicKey = "taimihud.cachix.org-1:2LByDgq5eUVU2FoeIlMd5NMgUeCDXuuVarS+XbNsIkY=";
signingKey = "nya";
};
#channels.nixpkgs.version = "25.05";
jobs = {
main = {
tasks = {
build.inputs = [ sourcesToml ];
};
artifactPackages = {
sources = sourcesToml;
};
};
updates = {
tasks = {
build.inputs = legacyPackages.updateChecks;
};
};
};

# XXX: symlinks are not followed, see https://github.com/softprops/action-gh-release/issues/182
artifactPackage = mkIf (config.artifactPackages != {}) (runCommand "taimihud-datasource-artifacts" { } (''
mkdir -p $out/share
'' + concatStringsSep "\n" (mapAttrsToList (key: taimi: ''
cp -Lr --no-preserve=mode -t $out ${taimi}/share
'') config.artifactPackages)));

gh-actions = {
jobs = mkIf (config.id != "ci" && config.artifactPackage != null) {
${config.id} = {
permissions = {
contents = "write";
};
step = {
artifact-build = {
order = 1100;
name = "artifact build";
uses = {
# XXX: a very hacky way of getting the runner
inherit (config.gh-actions.jobs.${config.id}.step.ci-setup.uses) owner repo version;
path = "actions/nix/build";
};
"with" = {
file = "<ci>";
attrs = "config.jobs.${config.jobId}.artifactPackage";
out-link = artifactRoot;
};
};
artifact-upload = {
order = 1110;
name = "artifact upload";
uses.path = "actions/upload-artifact@v4";
"with" = {
name = "TaimiHUD-DataSources";
path = artifacts;
};
};
release-upload = {
order = 1111;
name = "release";
"if" = "startsWith(github.ref, 'refs/tags/')";
uses.path = "softprops/action-gh-release@v1";
"with".files = release;
};
};
};
};
};
};
options = {
artifactPackage = mkOption {
type = types.nullOr types.package;
default = null;
};
artifactPackages = mkOption {
type = with types; attrsOf package;
default = {};
};
};
}
2 changes: 2 additions & 0 deletions config.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
_: {
}
11 changes: 11 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
flakeCompat = fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
};
taimiHUD = import flakeCompat {
src = ./.;
};
in
taimiHUD.defaultNix
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.

Loading