add woodpecker CI #2

Merged
darkkirb merged 2 commits from add-woodpecker-next into main 2023-04-08 18:27:02 +00:00
13 changed files with 7109 additions and 0 deletions

24
ci/woodpecker/agent.nix Normal file
View file

@ -0,0 +1,24 @@
{
lib,
buildGoModule,
callPackage,
fetchFromGitHub,
}: let
common = callPackage ./common.nix {};
in
buildGoModule {
pname = "woodpecker-agent";
inherit (common) version src ldflags postBuild;
vendorSha256 = builtins.readFile ./agent.sha256;
proxyVendor = true;
subPackages = "cmd/agent";
CGO_ENABLED = 0;
meta =
common.meta
// {
description = "Woodpecker Continuous Integration agent";
};
}

View file

@ -0,0 +1 @@
sha256-cwWqk6wG7GQCul/6fTE0fUvcz7Ktlt6stlaWBKfp/gk=

24
ci/woodpecker/cli.nix Normal file
View file

@ -0,0 +1,24 @@
{
lib,
buildGoModule,
callPackage,
fetchFromGitHub,
}: let
common = callPackage ./common.nix {};
in
buildGoModule {
pname = "woodpecker-cli";
inherit (common) version src ldflags postBuild;
vendorSha256 = builtins.readFile ./cli.sha256;
proxyVendor = true;
subPackages = "cmd/cli";
CGO_ENABLED = 0;
meta =
common.meta
// {
description = "Command line client for the Woodpecker Continuous Integration server";
};
}

1
ci/woodpecker/cli.sha256 Normal file
View file

@ -0,0 +1 @@
sha256-cwWqk6wG7GQCul/6fTE0fUvcz7Ktlt6stlaWBKfp/gk=

34
ci/woodpecker/common.nix Normal file
View file

@ -0,0 +1,34 @@
{
lib,
fetchFromGitHub,
}: let
source = builtins.fromJSON (builtins.readFile ./source.json);
in rec {
version = source.date;
src = fetchFromGitHub {
owner = "woodpecker-ci";
repo = "woodpecker";
inherit (source) rev sha256;
};
postBuild = ''
mkdir -p $GOPATH/bin
cd $GOPATH/bin
for f in *; do
mv -- "$f" "woodpecker-$f"
done
cd -
'';
ldflags = [
"-s"
"-w"
"-X github.com/woodpecker-ci/woodpecker/version.Version=${version}"
];
meta = with lib; {
homepage = "https://woodpecker-ci.org/";
license = licenses.asl20;
};
}

View file

@ -0,0 +1,45 @@
{
lib,
callPackage,
fetchFromGitHub,
fetchYarnDeps,
mkYarnPackage,
}: let
common = callPackage ./common.nix {};
in
mkYarnPackage {
pname = "woodpecker-frontend";
inherit (common) version;
src = "${common.src}/web";
packageJSON = ./package.json;
yarnLock = ./yarn.lock;
yarnNix = ./yarn.nix;
buildPhase = ''
runHook preBuild
yarn build
runHook postBuild
'';
installPhase = ''
runHook preInstall
cp -R deps/woodpecker-ci/dist $out
echo "${common.version}" > "$out/version"
runHook postInstall
'';
# Do not attempt generating a tarball for woodpecker-frontend again.
doDist = false;
meta =
common.meta
// {
description = "Woodpecker Continuous Integration server frontend";
};
}

View file

@ -0,0 +1,71 @@
{
"name": "woodpecker-ci",
"author": "Woodpecker CI",
"version": "0.0.0",
"license": "Apache-2.0",
"engines": {
"node": ">=14"
},
"scripts": {
"start": "vite",
"build": "vite build",
"serve": "vite preview",
"lint": "eslint --max-warnings 0 --ext .js,.ts,.vue,.json .",
"formatcheck": "prettier -c .",
"format:fix": "prettier --write .",
"typecheck": "vue-tsc --noEmit",
"test": "echo 'No tests configured' && exit 0"
},
"dependencies": {
"@intlify/unplugin-vue-i18n": "^0.10.0",
"@kyvg/vue3-notification": "^2.9.0",
"@vueuse/core": "^9.13.0",
"ansi_up": "^5.2.0",
"dayjs": "^1.11.7",
"floating-vue": "^2.0.0-beta.20",
"fuse.js": "^6.6.2",
"humanize-duration": "^3.28.0",
"javascript-time-ago": "^2.5.9",
"lodash": "^4.17.21",
"node-emoji": "^1.11.0",
"pinia": "^2.0.33",
"prismjs": "^1.29.0",
"vue": "^3.2.47",
"vue-i18n": "^9.2.2",
"vue-router": "^4.1.6"
},
"devDependencies": {
"@iconify/json": "^2.2.43",
"@types/humanize-duration": "^3.27.1",
"@types/javascript-time-ago": "^2.0.3",
"@types/lodash": "^4.14.192",
"@types/node": "^18.15.11",
"@types/node-emoji": "^1.8.2",
"@types/prismjs": "^1.26.0",
"@typescript-eslint/eslint-plugin": "^5.57.0",
"@typescript-eslint/parser": "^5.57.0",
"@vitejs/plugin-vue": "^4.1.0",
"@vue/compiler-sfc": "^3.2.47",
"eslint": "^8.37.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-vue": "^9.10.0",
"eslint-plugin-vue-scoped-css": "^2.4.0",
"prettier": "^2.8.7",
"typescript": "5.0.3",
"unplugin-icons": "^0.16.1",
"unplugin-vue-components": "^0.24.1",
"vite": "^4.2.1",
"vite-plugin-prismjs": "^0.0.8",
"vite-plugin-windicss": "^1.8.10",
"vite-svg-loader": "^4.0.0",
"vue-eslint-parser": "^9.1.1",
"vue-tsc": "^1.2.0",
"windicss": "^3.5.6"
}
}

45
ci/woodpecker/server.nix Normal file
View file

@ -0,0 +1,45 @@
{
lib,
buildGoModule,
callPackage,
fetchFromGitHub,
writeScript,
}: let
woodpecker-frontend = callPackage ./frontend.nix {};
common = callPackage ./common.nix {};
in
buildGoModule rec {
pname = "woodpecker-server";
inherit (common) version src ldflags postBuild;
vendorSha256 = builtins.readFile ./server.sha256;
proxyVendor = true;
postPatch = ''
cp -r ${woodpecker-frontend} web/dist
'';
subPackages = "cmd/server";
CGO_ENABLED = 1;
passthru = {
inherit woodpecker-frontend;
updateScript = writeScript "update-woodpecker" ''
${../../scripts/update-git.sh} https://github.com/woodpecker-ci/woodpecker ci/woodpecker/source.json
if [ "$(git diff -- ci/woodpecker/source.json)" ]; then
SRC_PATH=$(nix-build -E '(import ./. {}).${pname}.src')
${../../scripts/update-yarn.sh} $SRC_PATH/web ci/woodpecker
./scripts/update-go.sh ci/woodpecker/agent.nix ci/woodpecker/agent.sha256
./scripts/update-go.sh ci/woodpecker/cli.nix ci/woodpecker/cli.sha256
./scripts/update-go.sh ci/woodpecker/server.nix ci/woodpecker/server.sha256
fi
'';
};
meta =
common.meta
// {
description = "Woodpecker Continuous Integration server";
};
}

View file

@ -0,0 +1 @@
sha256-cwWqk6wG7GQCul/6fTE0fUvcz7Ktlt6stlaWBKfp/gk=

11
ci/woodpecker/source.json Normal file
View file

@ -0,0 +1,11 @@
{
"url": "https://github.com/woodpecker-ci/woodpecker",
"rev": "36b5ae345959559fba5f5cc1682d209038d09db0",
"date": "2023-04-08T13:15:28+02:00",
"path": "/nix/store/60d3ib0r6cllp5dcdqva3357vb0pvkpm-woodpecker",
"sha256": "1swwngghwpz1jy778nnnvsj8nz49ffn317qmr6zx9pxr4lk08hrr",
"fetchLFS": false,
"fetchSubmodules": false,
"deepClone": false,
"leaveDotGit": false
}

3237
ci/woodpecker/yarn.lock Normal file

File diff suppressed because it is too large Load diff

3611
ci/woodpecker/yarn.nix Normal file

File diff suppressed because it is too large Load diff

View file

@ -94,6 +94,10 @@
inherit (inputs.attic.packages.${pkgs.system}) attic attic-client attic-server; inherit (inputs.attic.packages.${pkgs.system}) attic attic-client attic-server;
element-web = pkgs.callPackage ./matrix/element-web {}; element-web = pkgs.callPackage ./matrix/element-web {};
mautrix-cleanup = inputs.mautrix-cleanup.packages.${pkgs.system}.default; mautrix-cleanup = inputs.mautrix-cleanup.packages.${pkgs.system}.default;
woodpecker-agent = pkgs.callPackage ./ci/woodpecker/agent.nix {};
woodpecker-cli = pkgs.callPackage ./ci/woodpecker/cli.nix {};
woodpecker-frontend = pkgs.callPackage ./ci/woodpecker/frontend.nix {};
woodpecker-server = pkgs.callPackage ./ci/woodpecker/server.nix {};
} }
// ( // (
if system == "riscv64-linux" if system == "riscv64-linux"