Rename Interpret.handleRun to Interpret.run. #216
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
- 'ci-*' | |
pull_request: | |
env: | |
DEPLOY_HOST: cty-2.hypered.systems | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Nix | |
uses: cachix/install-nix-action@v18 | |
with: | |
nix_path: nixpkgs=channel:nixos-22.05 | |
extra_nix_config: | | |
post-build-hook = /etc/nix/post-build-hook | |
substituters = https://s3.eu-central-003.backblazeb2.com/curiosity-store/ https://cache.nixos.org/ | |
trusted-public-keys = curiosity-store:W3LXUB+6DjtZkKV0gEfNXGtTjA+hMqjPUoK6mzzco+w= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= | |
- name: Setup Nix Cache | |
env: | |
SIGNING_KEY: ${{ secrets.NIX_SIGNING_KEY }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.B2_APPKEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.B2_APPKEY }} | |
run: | | |
sudo cp ci/post-build-hook /etc/nix/real-post-build-hook | |
sudo chmod a+x /etc/nix/real-post-build-hook | |
# Setting up temporarily the real post build hook as | |
# post-build-hook to upload the queued-build-hook daemon to | |
# the cache. | |
sudo ln -s /etc/nix/real-post-build-hook /etc/nix/post-build-hook | |
sudo mkdir -p /run/keys | |
sudo bash -c "echo ${SIGNING_KEY} > /run/keys/nix-signing-key.private" | |
sudo bash -c "echo ${AWS_ACCESS_KEY_ID} > /run/keys/AWS_ACCESS_KEY_ID" | |
sudo bash -c "echo ${AWS_SECRET_ACCESS_KEY} > /run/keys/AWS_SECRET_ACCESS_KEY" | |
queued_build_hook_path="$(nix-build -A ci-tools.queue-to-post-build-hook-daemon)"/bin/queue-to-post-build-hook-daemon | |
# Let's replace the temporary post-build-hook with the queued-build-hook powered one. | |
sudo rm /etc/nix/post-build-hook | |
sudo cp "${queued_build_hook_path}" /etc/nix/post-build-hook | |
sudo chmod a+x /etc/nix/post-build-hook | |
- name: Build Curiosity | |
run: | | |
PATH="$(nix-build -A ci-tools.queued-build-hook)"/bin:"$(nix-build -A ci-tools.systemfd)"/bin:$PATH | |
# Starting the queued-build-hook-daemon. | |
systemfd -s unix::/tmp/queued-build-hook.sock -- queued-build-hook daemon -hook /etc/nix/real-post-build-hook & | |
# Waiting for the build-hook daemon to be ready to receive connections. | |
until [ -S /tmp/queued-build-hook.sock ] | |
do | |
sleep 1 | |
done | |
$(nix-build -A ci-tools.build-curiosity)/bin/build-curiosity | |
# Waiting for the build-hook daemon to upload all the pending paths. | |
queued-build-hook wait -socket /tmp/queued-build-hook.sock | |
id: build_curiosity | |
- name: Setup NixOS deploy env | |
if: github.event_name == 'push' && github.ref_name == 'main' | |
run: | | |
ssh_key=$(mktemp) | |
chmod 600 $ssh_key | |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > $ssh_key | |
echo "SSH_KEY_PATH=$ssh_key" > $GITHUB_OUTPUT | |
id: deploy_env | |
- name: Deploy closure to cty-2.hypered.systems | |
if: github.event_name == 'push' && github.ref_name == 'main' | |
env: | |
NIX_SSHOPTS: "-o StrictHostKeyChecking=no -i ${{ steps.deploy_env.outputs.SSH_KEY_PATH }} -l root" | |
run: ./scripts/deploy.sh |