From 937f1dd330294801411b78ab497073f36ebedd47 Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Fri, 28 Mar 2025 14:55:25 -0400 Subject: all: do not commit generated JS/CSS to source control (#148) Closes #125 Closes #40 Among other things, this moves all of the asset generation to run within the context of an npm script. Developer documentation stubs have been added so that people can get started more easily. The top-level Dockerfile (which is no longer used in production) has been removed as its presence has been causing confusion. This changeset will break it anyways. These changes will make for less "repo churn" as the static assets are built and rebuilt, at the cost of making the build step more complicated for downstream packagers. If this becomes a burden, we can explore making a "release tarball" that contains pre-massaged outputs. --- .github/workflows/docker-pr.yml | 29 +++++++++++++++++++++++++---- .github/workflows/docker.yml | 31 ++++++++++++++++++++++++++----- .github/workflows/go.yml | 7 ++++++- 3 files changed, 57 insertions(+), 10 deletions(-) (limited to '.github') diff --git a/.github/workflows/docker-pr.yml b/.github/workflows/docker-pr.yml index 8461366..b124f75 100644 --- a/.github/workflows/docker-pr.yml +++ b/.github/workflows/docker-pr.yml @@ -20,11 +20,29 @@ jobs: fetch-tags: true fetch-depth: 0 - - uses: actions/setup-go@v5 + - name: Set up Homebrew + uses: Homebrew/actions/setup-homebrew@master + + - name: Setup Homebrew cellar cache + uses: actions/cache@v4 with: - go-version: '1.24.x' + path: | + /home/linuxbrew/.linuxbrew/Cellar + /home/linuxbrew/.linuxbrew/bin + /home/linuxbrew/.linuxbrew/etc + /home/linuxbrew/.linuxbrew/include + /home/linuxbrew/.linuxbrew/lib + /home/linuxbrew/.linuxbrew/opt + /home/linuxbrew/.linuxbrew/sbin + /home/linuxbrew/.linuxbrew/share + /home/linuxbrew/.linuxbrew/var + key: ${{ runner.os }}-go-homebrew-cellar-${{ hashFiles('go.sum') }} + restore-keys: | + ${{ runner.os }}-go-homebrew-cellar- - - uses: ko-build/setup-ko@v0.8 + - name: Install Brew dependencies + run: | + brew bundle - name: Docker meta id: meta @@ -35,9 +53,12 @@ jobs: - name: Build and push id: build run: | - go run ./cmd/containerbuild --docker-repo ghcr.io/techarohq/anubis --slog-level debug + npm ci + npm run container env: PULL_REQUEST_ID: ${{ github.event.number }} + DOCKER_REPO: ghcr.io/techarohq/anubis + SLOG_LEVEL: debug - run: | echo "Test this with:" diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index bfb095c..c3a532f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -26,11 +26,29 @@ jobs: fetch-tags: true fetch-depth: 0 - - uses: actions/setup-go@v5 + - name: Set up Homebrew + uses: Homebrew/actions/setup-homebrew@master + + - name: Setup Homebrew cellar cache + uses: actions/cache@v4 with: - go-version: '1.24.x' + path: | + /home/linuxbrew/.linuxbrew/Cellar + /home/linuxbrew/.linuxbrew/bin + /home/linuxbrew/.linuxbrew/etc + /home/linuxbrew/.linuxbrew/include + /home/linuxbrew/.linuxbrew/lib + /home/linuxbrew/.linuxbrew/opt + /home/linuxbrew/.linuxbrew/sbin + /home/linuxbrew/.linuxbrew/share + /home/linuxbrew/.linuxbrew/var + key: ${{ runner.os }}-go-homebrew-cellar-${{ hashFiles('go.sum') }} + restore-keys: | + ${{ runner.os }}-go-homebrew-cellar- - - uses: ko-build/setup-ko@v0.8 + - name: Install Brew dependencies + run: | + brew bundle - name: Log into registry uses: docker/login-action@v3 @@ -48,11 +66,14 @@ jobs: - name: Build and push id: build run: | - go run ./cmd/containerbuild --docker-repo ghcr.io/techarohq/anubis --slog-level debug + npm ci + npm run container + env: + DOCKER_REPO: ghcr.io/techarohq/anubis + SLOG_LEVEL: debug - name: Generate artifact attestation uses: actions/attest-build-provenance@v2 - if: ${{github.event_name == 'pull_request'}} with: subject-name: ghcr.io/techarohq/anubis subject-digest: ${{ steps.build.outputs.digest }} diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index d112342..2837c98 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -69,8 +69,13 @@ jobs: npx --yes playwright@1.50.1 install --with-deps npx --yes playwright@1.50.1 run-server --port 3000 & + - name: install node deps + run: | + npm ci + npm run assets + - name: Build run: go build ./... - name: Test - run: go test -v ./... + run: npm run test -- cgit v1.2.3