ci: move it to a container

Add nix flake and use it in the pipeline for reliability and reproducability.

Referenced issue:
* https://github.com/status-im/infra-ci/issues/188
This commit is contained in:
Marko Burčul 2025-10-23 12:53:04 +02:00
parent 0df18b2a75
commit e2c9364053
No known key found for this signature in database
GPG Key ID: FC4CD2F9A040D54A
4 changed files with 89 additions and 5 deletions

View File

@ -23,6 +23,15 @@ npm install
npm run doc
```
# Using Nix shell
```shell
git clone https://github.com/waku-org/js-waku.git
cd js-waku
nix develop
npm install
npm run doc
```
## Bugs, Questions & Features
If you encounter any bug or would like to propose new features, feel free to [open an issue](https://github.com/waku-org/js-waku/issues/new/).

26
ci/Jenkinsfile vendored
View File

@ -1,5 +1,13 @@
pipeline {
agent { label 'linux' }
agent {
docker {
label 'linuxcontainer'
image 'harbor.status.im/infra/ci-build-containers:linux-base-1.0.0'
args '--volume=/nix:/nix ' +
'--volume=/etc/nix:/etc/nix ' +
'--user jenkins'
}
}
options {
disableConcurrentBuilds()
@ -21,19 +29,25 @@ pipeline {
stages {
stage('Deps') {
steps {
sh 'npm install'
script {
nix.develop('npm install', pure: true)
}
}
}
stage('Packages') {
steps {
sh 'npm run build'
script {
nix.develop('npm run build', pure: true)
}
}
}
stage('Build') {
steps {
sh 'npm run doc'
script {
nix.develop('npm run doc', pure: true)
}
}
}
@ -41,7 +55,9 @@ pipeline {
when { expression { GIT_BRANCH.endsWith('master') } }
steps {
sshagent(credentials: ['status-im-auto-ssh']) {
sh 'npm run deploy'
script {
nix.develop('npm run deploy', pure: true)
}
}
}
}

26
flake.lock generated Normal file
View File

@ -0,0 +1,26 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1761016216,
"narHash": "sha256-G/iC4t/9j/52i/nm+0/4ybBmAF4hzR8CNHC75qEhjHo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "481cf557888e05d3128a76f14c76397b7d7cc869",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-25.05",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

33
flake.nix Normal file
View File

@ -0,0 +1,33 @@
{
description = "Nix flake development shell.";
inputs = {
nixpkgs.url = "nixpkgs/nixos-25.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; [
git # 2.44.1
openssh # 9.7p1
nodejs_20 # v20.15.1
];
};
});
};
}