add Nix flake and use it for CI builds

More deterministic and stable build.

Also added build.json for easy version checking.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2024-09-30 19:42:05 +02:00
parent 743479cab0
commit 064c7b0a5d
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4
4 changed files with 89 additions and 16 deletions

22
Jenkinsfile vendored
View File

@ -1,3 +1,6 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.10'
pipeline {
agent {
label 'linux'
@ -22,23 +25,24 @@ pipeline {
stages {
stage('Deps') {
steps {
sh 'npm install'
}
steps { script {
nix.develop('npm install')
} }
}
stage('Build') {
steps {
sh 'npx quartz build'
}
steps { script {
nix.develop('npx quartz build')
jenkins.genBuildMetaJSON('public/build.json')
} }
}
stage('Publish Prod') {
steps {
steps { script {
sshagent(credentials: ['status-im-auto-ssh']) {
sh 'ghp-import -p public'
nix.develop('ghp-import -c roadmap.logos.co -p public', pure: false)
}
}
} }
}
}
}

View File

@ -24,6 +24,14 @@ If you see a type or broken link, PRs are always welcome :)
If there is information you'd like to see included that isn't here, create and issue :)
## CI/CD
[CI builds](https://ci.infra.status.im/job/website/job/roadmap.logos.co/) `master` and pushes to `gh-pages` branch, which is hosted at <https://roadmap.logos.co/>.
The hosting is done using [Caddy server with Git plugin for handling GitHub webhooks](https://github.com/status-im/infra-sites/blob/master/ansible/roles/caddy-git).
Information about deployed build can be also found in `/build.json` available on the website.
### Using Obsidian
Quartz is created to serve a static site off of an [Obsidian](https://obsidian.md) vault, and thus is the preferred way to manage content locally. In order for all it to function properly, a few things need to be done properly.

26
flake.lock Normal file
View File

@ -0,0 +1,26 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1721548954,
"narHash": "sha256-7cCC8+Tdq1+3OPyc3+gVo9dzUNkNIQfwSDJ2HSi2u3o=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "63d37ccd2d178d54e7fb691d7ec76000740ea24a",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-24.05",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

35
flake.nix Normal file
View File

@ -0,0 +1,35 @@
{
description = "Flake file for website build";
inputs = {
nixpkgs.url = "nixpkgs/nixos-24.05";
};
outputs =
{ self, nixpkgs }:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forEachSystem = nixpkgs.lib.genAttrs supportedSystems;
pkgsFor = forEachSystem (system: import nixpkgs { inherit system; });
in
rec {
formatter = forEachSystem (system: pkgsFor.${system}.nixpkgs-fmt);
devShells = forEachSystem (system: {
default = pkgsFor.${system}.mkShellNoCC {
packages = with pkgsFor.${system}.buildPackages; [
yarn # 1.22.22
nodejs_20 # 20.15.1
git # 2.44.1
openssh # 9.7p1
ghp-import # 2.1.0
];
};
});
};
}