diff --git a/.github/workflows/compile.yaml b/.github/workflows/compile.yaml new file mode 100644 index 0000000..7ec16bb --- /dev/null +++ b/.github/workflows/compile.yaml @@ -0,0 +1,41 @@ +name: Compile ESPHome + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + +jobs: + compile: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Nix + uses: cachix/install-nix-action@v26 + with: + nix_path: nixpkgs=channel:nixos-unstable + extra_nix_config: | + sandbox = false + + - name: Enable unprivileged user namespaces + run: sudo sysctl -w kernel.unprivileged_userns_clone=1 || true + + - name: Install direnv + run: sudo apt-get install -y direnv + + - name: Prepare secrets + run: | + if [ -f templates/secrets.yaml.sample ]; then + cp templates/secrets.yaml.sample secrets.yaml + elif [ -f secrets.yaml.sample ]; then + cp secrets.yaml.sample secrets.yaml + fi + + - name: Allow direnv + run: direnv allow . + + - name: Compile + run: direnv exec . ./reflash.sh compile '' diff --git a/flake.nix b/flake.nix index 49e9923..774f664 100644 --- a/flake.nix +++ b/flake.nix @@ -18,6 +18,7 @@ esphome esptool cc2538-bsl + zsh ]; shellHook = ''