diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b1bd4250b..c239de33e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,15 +12,12 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Go - uses: actions/setup-go@v3 + - uses: cachix/install-nix-action@v22 with: - go-version: 1.21.0 + github_access_token: ${{ secrets.GITHUB_TOKEN }} - name: Test - uses: joerdav/run-xc@1.0.0 - with: - task: test-cover + run: nix develop --command xc test-cover - name: Copy coverage.out to temp run: cp coverage.out $RUNNER_TEMP @@ -35,33 +32,32 @@ jobs: if: | github.event_name == 'push' + - name: Build + run: nix build + lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up Go - uses: actions/setup-go@v3 + - uses: cachix/install-nix-action@v22 with: - go-version: 1.21.0 + github_access_token: ${{ secrets.GITHUB_TOKEN }} - name: Lint - uses: golangci/golangci-lint-action@v3 + uses: nix develop --command xc lint ensure-generated: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up Go - uses: actions/setup-go@v3 + - uses: cachix/install-nix-action@v22 with: - go-version: 1.21.0 + github_access_token: ${{ secrets.GITHUB_TOKEN }} - name: Generate - uses: joerdav/run-xc@1.0.0 - with: - task: generate + uses: nix develop --command xc generate - name: Ensure clean run: git diff --exit-code diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 46b2634a1..000000000 --- a/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM nixos/nix -RUN nix-channel --update -COPY ./nix/nix.conf /etc/nix/nix.conf -RUN mkdir /templ -COPY . /templ -WORKDIR /templ -RUN nix develop --impure --command printf "Build complete\n" -COPY ./nix/.config /root/.config -# Open port for templ LSP HTTP debugging -EXPOSE 7474 -CMD nix develop --impure diff --git a/README.md b/README.md index 7e8a96bd4..fbc78f637 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ gofmt -s -w . ### lint ```sh -docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.54 golangci-lint run -v +golangci-lint run --verbose ``` ### release @@ -138,19 +138,3 @@ Directory: docs npm run build ``` -### docker-build - -Build a Docker container with a full development environment and Neovim setup for testing the LSP. - -``` -docker build -t templ:latest . -``` - -### docker-run - -Run a Docker development container in the current directory. - -``` -docker run -p 7474:7474 -v `pwd`:/templ -it --rm templ:latest -``` - diff --git a/flake.nix b/flake.nix index fde12af72..5ccedbef7 100644 --- a/flake.nix +++ b/flake.nix @@ -28,7 +28,8 @@ inherit system; pkgs = import nixpkgs { inherit system; }; }); - in rec { + in + rec { packages = forAllSystems ({ pkgs, ... }: rec { default = templ; @@ -66,7 +67,9 @@ devShell = forAllSystems ({ system, pkgs }: pkgs.mkShell { buildInputs = with pkgs; [ + (golangci-lint.override { buildGoModule = buildGo121Module; }) go_1_21 + gofmt goreleaser nodejs xc.packages.${system}.xc