os/.drone.yml
teutat3s 472560e1c1
Restructure CI:
build ISO on each push to main branch

tags with v* and t* names trigger a test VM

pull requests trigger a basic check building host PubSolarOS
2022-08-25 16:06:33 +02:00

97 lines
2 KiB
YAML

---
kind: pipeline
type: docker
name: Check
steps:
- name: "Check"
image: docker.nix-community.org/nixpkgs/nix-flakes:latest
when:
event:
- pull_request
environment:
NIX_FLAGS: "--print-build-logs --verbose"
commands:
- 'echo DEBUG: Using NIX_FLAGS: $NIX_FLAGS'
- nix $$NIX_FLAGS flake show
- nix $$NIX_FLAGS build ".#nixosConfigurations.PubSolarOS.config.system.build.toplevel"
- nix $$NIX_FLAGS develop --command echo OK
---
kind: pipeline
type: exec
name: Tests
steps:
- name: "Tests"
environment:
NIX_FLAGS: "--print-build-logs --verbose"
commands:
- 'echo DEBUG: Using NIX_FLAGS: $NIX_FLAGS'
- nix $$NIX_FLAGS build ".#checks.x86_64-linux.customTestFor-PubSolarOS-firstTest"
- nix-store --read-log result
- nix $$NIX_FLAGS flake check
- nix $$NIX_FLAGS develop --command echo OK
trigger:
ref:
- refs/tags/v*
- refs/tags/t*
---
kind: pipeline
type: docker
name: Publish ISO
steps:
- name: "Build ISO"
image: docker.nix-community.org/nixpkgs/nix-flakes:latest
environment:
NIX_FLAGS: "--print-build-logs --verbose"
volumes:
- name: file-exchange
path: /var/nix/iso-cache
commands:
- |
nix $$NIX_FLAGS build \
'.#nixosConfigurations.bootstrap.config.system.build.bootstrapIso'
- cp $(readlink -f result)/iso/*.iso /var/nix/iso-cache/
- name: "Publish ISO"
image: appleboy/drone-scp
volumes:
- name: file-exchange
path: /var/nix/iso-cache
settings:
host:
from_secret: ssh_host
user:
from_secret: ssh_user
port:
from_secret: ssh_port
key:
from_secret: ssh_key
target: /srv/os
source:
- /var/nix/iso-cache/*.iso
strip_components: 3
depends_on:
- Check
trigger:
branch:
- main
event:
- push
volumes:
- name: file-exchange
temp: {}
---
kind: signature
hmac: f78042286446a0649b61bdd28240caf7650cf995804acb714b92d145fa028bdf
...