citadel icon indicating copy to clipboard operation
citadel copied to clipboard

CI: Build `main` on push, run tests. Maybe static code analysis

Open phildenhoff opened this issue 1 year ago • 2 comments

To make it easier to try Citadel, and ensure that new changes don't prevent the app from working for long, add a CI pipeline using GitHub Actions to build main anytime it's updated, and run any tests.

The build should be a matrix supporting

  • Ubuntu/Debian builds
  • macOS

In the future, if there is appeal, we can add Windows builds + non-appimage/.deb builds.

Stretch goal

Add a CI pipeline that, on PR open or updated, runs static checks like linting & formatting checks (ensure code is correctly formatted). I haven't run these in a while, so there are likely to be some errors. The first step is to open a PR that resolves any lint/format issues without adding CI.

Further reading

phildenhoff avatar Jan 14 '24 19:01 phildenhoff

Thanks to @danielfrankcom, here's a Dockerfile to build appimage & .deb files

ARG WORKDIR=/build
 
FROM ivangabriele/tauri:fedora-37-18 AS build
 
ARG WORKDIR
WORKDIR ${WORKDIR}
 
RUN curl -fsSL https://bun.sh/install | bash 
ENV PATH="${PATH}:/root/.bun/bin/"
 
COPY package.json bun.lockb "${WORKDIR}"
RUN bun install --frozen-lockfile
 
COPY . "${WORKDIR}"
RUN bun run build
 
FROM scratch AS artifacts
 
ARG WORKDIR
COPY --from=build \
    "${WORKDIR}/src-tauri/target/release/bundle/appimage/citadel_0.1.0_amd64.AppImage" \
    .
COPY --from=build \
    "${WORKDIR}/src-tauri/target/release/bundle/deb/citadel_0.1.0_amd64.deb" \
    .

phildenhoff avatar Jan 15 '24 10:01 phildenhoff

I've set up a very rough CI process that builds on pushes to main (and PRs, although uploads should be disabled for those), uploads the artifacts to the Action, and creates a Draft release. I'm open to feedback / changes here, because I don't like it, but something is better than nothing.

Specifically:

  • is it easy to access artifacts from GH actions?
  • do we really need a release for every push to main? I think not. A manual "this build is good" process could create that release.
  • PRs should build the app but not publish the artifacts, esp. not as a new Release.

phildenhoff avatar Jan 16 '24 18:01 phildenhoff