nix/.forgejo/workflows/ssh-test.yml

86 lines
2.3 KiB
YAML
Raw Normal View History

2023-12-08 12:04:16 +01:00
name: ssh-test
run-name: ${{ github.actor }} - ssh-test
2023-12-08 12:04:24 +01:00
on:
push:
branches:
- main
2023-12-08 12:04:16 +01:00
jobs:
ssh-test:
runs-on: docker
container:
image: alpine:edge
2023-12-08 13:25:19 +01:00
options: --volume /dev/net/tun:/dev/net/tun
2023-12-08 12:04:16 +01:00
steps:
- name: "Setup: Runner"
run: |
apk update
2023-12-08 12:41:38 +01:00
apk add git nodejs nix openssh-client qemu tailscale --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/
- name: "Setup: SSH"
run: |
mkdir /root/.ssh
echo "${{ secrets.SSH_PUBLIC_KEY }}" > /root/.ssh/id_ed25519.pub
echo "${{ secrets.SSH_PRIVATE_KEY }}" > /root/.ssh/id_ed25519
chmod 700 /root/.ssh
chmod 600 /root/.ssh/id_ed25519
chmod 644 /root/.ssh/id_ed25519.pub
- name: "Setup: Headscale"
run: |
2023-12-08 13:16:13 +01:00
echo "tailscaled --cleanup"
2023-12-08 12:41:38 +01:00
tailscaled --cleanup
2023-12-08 13:16:13 +01:00
echo ""
2023-12-08 13:32:18 +01:00
echo "tailscaled --state=mem 2> ~/tailscaled.log &"
tailscaled --state=mem:
2023-12-08 13:16:13 +01:00
echo ""
echo "tailscale up"
2023-12-08 12:41:38 +01:00
tailscale up \
2023-12-08 13:11:42 +01:00
--login-server=https://headscale.sysctl.io \
--accept-routes \
--accept-dns \
--authkey ${{ secrets.TAILSCALE_KEY }} \
--hostname forgejo-runner \
--advertise-tags "tag:forgejo,tag:container,tag:ephemeral"
2023-12-08 12:41:56 +01:00
tailscale status
tailscale netcheck
2023-12-08 12:41:38 +01:00
2023-12-08 12:04:16 +01:00
- uses: actions/checkout@v3
- name: "Directory Structure"
run: |
ls ${{ github.workspace }}/*
2023-12-08 12:41:38 +01:00
2023-12-08 12:04:16 +01:00
- name: "Runner: Node Info"
run: |
2023-12-08 12:11:36 +01:00
echo "pwd"
2023-12-08 12:05:58 +01:00
pwd
2023-12-08 12:11:36 +01:00
echo "ls -lah"
ls -lah
echo 'id'
2023-12-08 12:04:16 +01:00
id
2023-12-08 12:11:36 +01:00
echo "uname -a"
2023-12-08 12:04:16 +01:00
uname -a
2023-12-08 12:11:36 +01:00
echo "hostname"
2023-12-08 12:04:16 +01:00
hostname
2023-12-08 12:11:36 +01:00
echo "/etc/os-release"
2023-12-08 12:04:16 +01:00
cat /etc/os-release
2023-12-08 12:13:55 +01:00
echo "whoami"
whoami
2023-12-08 12:26:03 +01:00
echo "cat /etc/resolv.conf"
cat /etc/resolv.conf
2023-12-08 12:41:38 +01:00
2023-12-08 12:04:16 +01:00
- name: "Nix Version"
run: |
nix --version
# - name: "Nix build"
# run: |
# echo "Running Nix Build"
# nix --extra-experimental-features "nix-command flakes" \
# build /workspace/albert/nix#imageConfigurations.nixos-iso-desktop
# echo "Results:"
# ls -lah result/iso/
- if: always()
run: rm -rf /.cache
- if: always()
run: rm -rf ${{ github.worksspace }}