Skip to content

Commit e2c9364

Browse files
committed
ci: move it to a container
Add nix flake and use it in the pipeline for reliability and reproducability. Referenced issue: * status-im/infra-ci#188
1 parent 0df18b2 commit e2c9364

File tree

4 files changed

+89
-5
lines changed

4 files changed

+89
-5
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ npm install
2323
npm run doc
2424
```
2525

26+
# Using Nix shell
27+
```shell
28+
git clone https://github.com/waku-org/js-waku.git
29+
cd js-waku
30+
nix develop
31+
npm install
32+
npm run doc
33+
```
34+
2635
## Bugs, Questions & Features
2736

2837
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/).

ci/Jenkinsfile

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
pipeline {
2-
agent { label 'linux' }
2+
agent {
3+
docker {
4+
label 'linuxcontainer'
5+
image 'harbor.status.im/infra/ci-build-containers:linux-base-1.0.0'
6+
args '--volume=/nix:/nix ' +
7+
'--volume=/etc/nix:/etc/nix ' +
8+
'--user jenkins'
9+
}
10+
}
311

412
options {
513
disableConcurrentBuilds()
@@ -21,27 +29,35 @@ pipeline {
2129
stages {
2230
stage('Deps') {
2331
steps {
24-
sh 'npm install'
32+
script {
33+
nix.develop('npm install', pure: true)
34+
}
2535
}
2636
}
2737

2838
stage('Packages') {
2939
steps {
30-
sh 'npm run build'
40+
script {
41+
nix.develop('npm run build', pure: true)
42+
}
3143
}
3244
}
3345

3446
stage('Build') {
3547
steps {
36-
sh 'npm run doc'
48+
script {
49+
nix.develop('npm run doc', pure: true)
50+
}
3751
}
3852
}
3953

4054
stage('Publish') {
4155
when { expression { GIT_BRANCH.endsWith('master') } }
4256
steps {
4357
sshagent(credentials: ['status-im-auto-ssh']) {
44-
sh 'npm run deploy'
58+
script {
59+
nix.develop('npm run deploy', pure: true)
60+
}
4561
}
4662
}
4763
}

flake.lock

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
description = "Nix flake development shell.";
3+
4+
inputs = {
5+
nixpkgs.url = "nixpkgs/nixos-25.05";
6+
};
7+
8+
outputs =
9+
{ self, nixpkgs }:
10+
let
11+
supportedSystems = [
12+
"x86_64-linux"
13+
"aarch64-linux"
14+
"x86_64-darwin"
15+
"aarch64-darwin"
16+
];
17+
forEachSystem = nixpkgs.lib.genAttrs supportedSystems;
18+
pkgsFor = forEachSystem (system: import nixpkgs { inherit system; });
19+
in
20+
rec {
21+
formatter = forEachSystem (system: pkgsFor.${system}.nixpkgs-fmt);
22+
23+
devShells = forEachSystem (system: {
24+
default = pkgsFor.${system}.mkShellNoCC {
25+
packages = with pkgsFor.${system}.buildPackages; [
26+
git # 2.44.1
27+
openssh # 9.7p1
28+
nodejs_20 # v20.15.1
29+
];
30+
};
31+
});
32+
};
33+
}

0 commit comments

Comments
 (0)