Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
ci: move to Nix (#38)
Browse files Browse the repository at this point in the history
* fix(references): unused fields like abstract and file

* ci(nix): add Nix build

* ci: add test release and update flake

* fix: remove pdf and move to releases

* fix(readme): update to releases and format (dprint)
  • Loading branch information
storopoli authored Nov 7, 2023
1 parent 039766b commit 999f431
Show file tree
Hide file tree
Showing 12 changed files with 1,674 additions and 1,308 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @storopoli
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Set update schedule for GitHub Actions
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
45 changes: 45 additions & 0 deletions .github/workflows/build-slides.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build Slides
on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main

jobs:
build-release:
name: Build Slides
runs-on: ubuntu-latest
permissions:
contents: write
env:
working-directory: ./slides
defaults:
run:
working-directory: ${{ env.working-directory }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v6

- name: Cache Nix artifacts
uses: DeterminateSystems/magic-nix-cache-action@v2

- name: Build Slides
run: nix build -L

- name: Copy result out of nix store
run: cp -v result/slides.pdf slides.pdf

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: output
path: ./slides/slides.pdf
if-no-files-found: error
40 changes: 40 additions & 0 deletions .github/workflows/release-slides.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and Release Slides

on:
push:
tags:
- "*"

jobs:
build-release:
name: Build and Release Slides
runs-on: ubuntu-latest
permissions:
contents: write
env:
working-directory: ./slides
defaults:
run:
working-directory: ${{ env.working-directory }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v6

- name: Cache Nix artifacts
uses: DeterminateSystems/magic-nix-cache-action@v2

- name: Build Slides
run: nix build -L

- name: Copy result out of nix store
run: cp -v result/slides.pdf slides.pdf

- name: Release
uses: ncipollo/release-action@v1
id: release
with:
artifacts: ./slides/slides.pdf
30 changes: 30 additions & 0 deletions .github/workflows/update_flake_lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Update Flake Lock File

on:
workflow_dispatch: # allows manual triggering
schedule:
- cron: '0 0 * * 0' # runs weekly on Sunday at 00:00

jobs:
lockfile:
runs-on: ubuntu-latest
env:
working-directory: ./slides
defaults:
run:
working-directory: ${{ env.working-directory }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v6

- name: Update flake.lock
uses: DeterminateSystems/update-flake-lock@v20
with:
pr-title: "fix: update flake.lock" # Title of PR to be created
pr-labels: | # Labels to be set on the PR
dependencies
automated
314 changes: 157 additions & 157 deletions README.md

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions dprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"json": {
},
"markdown": {
},
"toml": {
},
"excludes": [
"**/*-lock.json"
],
"plugins": [
"https://plugins.dprint.dev/json-0.19.0.wasm",
"https://plugins.dprint.dev/markdown-0.16.2.wasm",
"https://plugins.dprint.dev/toml-0.5.4.wasm"
]
}
61 changes: 61 additions & 0 deletions slides/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions slides/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
description = "A basic flake with a shell";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
tex = pkgs.texlive.combine {
inherit (pkgs.texlive) scheme-small;
inherit (pkgs.texlive) latexmk pgf pgfplots tikzsymbols biblatex beamer;
inherit (pkgs.texlive) silence appendixnumberbeamer fira fontaxes mwe;
inherit (pkgs.texlive) noto csquotes babel helvetic transparent;
inherit (pkgs.texlive) xpatch hyphenat wasysym algorithm2e listings;
inherit (pkgs.texlive) lstbayes ulem subfigure ifoddpage relsize;
inherit (pkgs.texlive) adjustbox media9 ocgx2 biblatex-apa wasy;
};
in
{
devShells.default = pkgs.mkShell {
packages = [
pkgs.bashInteractive
pkgs.pdfpc
];
};
defaultPackage = pkgs.stdenvNoCC.mkDerivation rec {
name = "slides";
src = self;
buildInputs = [
pkgs.coreutils
tex
pkgs.gnuplot
pkgs.biber
];
phases = [ "unpackPhase" "buildPhase" "installPhase" ];
buildPhase = ''
export PATH="${pkgs.lib.makeBinPath buildInputs}";
export HOME=$(pwd)
latexmk -pdflatex -shell-escape slides.tex
'';
installPhase = ''
mkdir -p $out
cp slides.pdf $out/
'';
};
});
}
Loading

0 comments on commit 999f431

Please sign in to comment.