about summary refs log tree commit diff
path: root/templates
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2023-12-15 08:13:26 -0800
committerFranck Cuny <franck@fcuny.net>2023-12-15 08:13:26 -0800
commit9f2310ed32e30a99fd32086d1b9a8bda5ca4af22 (patch)
treeec1fe8d61de235055edfbb20bd0a3a76effccdfd /templates
parentformat yaml (diff)
downloadworld-9f2310ed32e30a99fd32086d1b9a8bda5ca4af22.tar.gz
remove rust template, add GHA to go template
Diffstat (limited to 'templates')
-rw-r--r--templates/default.nix5
-rw-r--r--templates/go/.github/dependabot.yml10
-rw-r--r--templates/go/.github/workflows/ci.yaml30
-rw-r--r--templates/go/.github/workflows/update.yml28
-rw-r--r--templates/go/go.mod4
-rw-r--r--templates/rust/.envrc1
-rw-r--r--templates/rust/LICENSE20
-rw-r--r--templates/rust/deny.toml44
-rw-r--r--templates/rust/flake.nix102
-rw-r--r--templates/rust/rust-toolchain.toml3
-rw-r--r--templates/rust/rustfmt.toml1
11 files changed, 70 insertions, 178 deletions
diff --git a/templates/default.nix b/templates/default.nix
index 1307ad7..adc239f 100644
--- a/templates/default.nix
+++ b/templates/default.nix
@@ -1,9 +1,4 @@
 {
-  rust = {
-    description = "Simple rust package";
-    path = ./rust;
-  };
-
   go = {
     description = "go template";
     path = ./go;
diff --git a/templates/go/.github/dependabot.yml b/templates/go/.github/dependabot.yml
new file mode 100644
index 0000000..0cfc43c
--- /dev/null
+++ b/templates/go/.github/dependabot.yml
@@ -0,0 +1,10 @@
+version: 2
+updates:
+  - package-ecosystem: "github-actions"
+    directory: "/"
+    schedule:
+      interval: "weekly"
+  - package-ecosystem: "gomod"
+    directory: "/"
+    schedule:
+      interval: "weekly"
diff --git a/templates/go/.github/workflows/ci.yaml b/templates/go/.github/workflows/ci.yaml
new file mode 100644
index 0000000..72dbdc4
--- /dev/null
+++ b/templates/go/.github/workflows/ci.yaml
@@ -0,0 +1,30 @@
+name: "Build flake outputs"
+on:
+  push:
+    branches:
+      - main
+  pull_request:
+    branches:
+      - main
+    types:
+      - opened
+      - synchronize
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    strategy:
+      fail-fast: false
+      matrix:
+        output:
+          - devShell.x86_64-linux
+    steps:
+      - uses: actions/checkout@v4
+        with:
+          fetch-depth: 0
+      - name: Install Nix
+        uses: cachix/install-nix-action@v24
+        with:
+          extra_nix_config: |
+            experimental-features = nix-command flakes
+      - run: nix flake check
+      - run: nix develop -c echo OK
diff --git a/templates/go/.github/workflows/update.yml b/templates/go/.github/workflows/update.yml
new file mode 100644
index 0000000..2723a6f
--- /dev/null
+++ b/templates/go/.github/workflows/update.yml
@@ -0,0 +1,28 @@
+name: 'Update flake.lock'
+on:
+  workflow_dispatch:
+  schedule:
+    - cron: '30 5 * * 0'
+# you need to grant permissions to create PR:
+# https://github.com/DeterminateSystems/update-flake-lock/issues/75
+jobs:
+  update-flake-lock:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v4
+      - name: Install Nix
+        uses: cachix/install-nix-action@v23
+        with:
+          extra_nix_config: |
+            access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
+      - name: Update flake.lock
+        id: update-flake-lock
+        uses: DeterminateSystems/update-flake-lock@v20
+        with:
+          pr-title: "Update flake.lock"
+          commit-msg: "chore: update flake"
+          pr-assignees: fcuny
+          pr-labels: |
+            dependencies
+            automated
diff --git a/templates/go/go.mod b/templates/go/go.mod
index 736d11c..aa1e0fb 100644
--- a/templates/go/go.mod
+++ b/templates/go/go.mod
@@ -1,3 +1,3 @@
-module go.fcuny.net/changeme
+module github.com/fcuny/changeme
 
-go 1.18
+go 1.21
diff --git a/templates/rust/.envrc b/templates/rust/.envrc
deleted file mode 100644
index a5dbbcb..0000000
--- a/templates/rust/.envrc
+++ /dev/null
@@ -1 +0,0 @@
-use flake .
diff --git a/templates/rust/LICENSE b/templates/rust/LICENSE
deleted file mode 100644
index ac375e1..0000000
--- a/templates/rust/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2022 Franck Cuny
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/templates/rust/deny.toml b/templates/rust/deny.toml
deleted file mode 100644
index acefd37..0000000
--- a/templates/rust/deny.toml
+++ /dev/null
@@ -1,44 +0,0 @@
-[advisories]
-db-path = "~/.cargo/advisory-db"
-db-urls = ["https://github.com/rustsec/advisory-db"]
-vulnerability = "deny"
-unmaintained = "warn"
-yanked = "warn"
-notice = "warn"
-ignore = []
-
-[licenses]
-unlicensed = "deny"
-allow = ["MIT", "Apache-2.0", "ISC", "Unicode-DFS-2016", "OpenSSL"]
-deny = []
-copyleft = "allow"
-default = "deny"
-confidence-threshold = 0.8
-exceptions = []
-
-[licenses.private]
-ignore = false
-registries = []
-
-# see https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html#example
-[[licenses.clarify]]
-name = "ring"
-expression = "MIT AND ISC AND OpenSSL"
-license-files = [{ path = "LICENSE", hash = 0xbd0eed23 }]
-
-[bans]
-multiple-versions = "warn"
-wildcards = "allow"
-highlight = "all"
-allow = []
-deny = []
-skip = []
-skip-tree = []
-
-[sources]
-unknown-registry = "warn"
-unknown-git = "warn"
-allow-registry = ["https://github.com/rust-lang/crates.io-index"]
-allow-git = []
-
-[sources.allow-org]
diff --git a/templates/rust/flake.nix b/templates/rust/flake.nix
deleted file mode 100644
index fdce743..0000000
--- a/templates/rust/flake.nix
+++ /dev/null
@@ -1,102 +0,0 @@
-{
-  description = "A CLI to manage public SSH keys for GitHub.";
-
-  inputs = {
-    flake-utils.url = "github:numtide/flake-utils";
-    nixpkgs.url = "github:NixOS/nixpkgs";
-    rust-overlay = {
-      url = "github:oxalica/rust-overlay";
-      inputs = {
-        flake-utils.follows = "flake-utils";
-        nixpkgs.follows = "nixpkgs";
-      };
-    };
-    crane = {
-      url = "github:ipetkov/crane";
-      inputs.nixpkgs.follows = "nixpkgs";
-    };
-    pre-commit-hooks = {
-      url = "github:cachix/pre-commit-hooks.nix";
-      inputs = {
-        flake-utils.follows = "flake-utils";
-        nixpkgs.follows = "nixpkgs";
-      };
-    };
-  };
-
-  outputs =
-    { self
-    , flake-utils
-    , nixpkgs
-    , rust-overlay
-    , crane
-    , pre-commit-hooks
-    }:
-
-    flake-utils.lib.eachDefaultSystem
-      (system:
-      let
-        pkgs = import nixpkgs {
-          inherit system;
-          overlays = [ (import rust-overlay) ];
-        };
-        rust-toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
-
-        craneLib = (crane.mkLib pkgs).overrideScope' (_: _: {
-          cargo = rust-toolchain;
-          clippy = rust-toolchain;
-          rustc = rust-toolchain;
-          rustfmt = rust-toolchain;
-        });
-
-        src = ./.;
-
-        cargoArtifacts = craneLib.buildDepsOnly {
-          inherit src;
-        };
-
-        my-crate = craneLib.buildPackage {
-          inherit cargoArtifacts src;
-        };
-      in
-      {
-        packages.default = my-crate;
-        apps.default = flake-utils.lib.mkApp {
-          drv = my-crate;
-        };
-
-        checks = {
-          pre-commit = pre-commit-hooks.lib.${system}.run {
-            inherit src;
-            hooks = {
-              clippy = {
-                enable = true;
-                entry = pkgs.lib.mkForce "cargo clippy -- -D warnings";
-              };
-              nixpkgs-fmt = {
-                enable = true;
-              };
-              rustfmt = {
-                enable = true;
-                entry = pkgs.lib.mkForce "cargo fmt -- --check --color always";
-              };
-            };
-          };
-        };
-
-        devShell = pkgs.mkShell {
-          nativeBuildInputs = with pkgs; [
-            rust-toolchain
-            cargo-deny
-            rust-analyzer
-          ];
-
-          inherit (self.checks.${system}.pre-commit) shellHook;
-        };
-      })
-    // {
-      overlay = final: prev: {
-        XXX = self.defaultPackage.${prev.system};
-      };
-    };
-}
diff --git a/templates/rust/rust-toolchain.toml b/templates/rust/rust-toolchain.toml
deleted file mode 100644
index cc8f987..0000000
--- a/templates/rust/rust-toolchain.toml
+++ /dev/null
@@ -1,3 +0,0 @@
-[toolchain]
-channel = "1.64.0"
-components = ["rustfmt", "clippy"]
diff --git a/templates/rust/rustfmt.toml b/templates/rust/rustfmt.toml
deleted file mode 100644
index 3a26366..0000000
--- a/templates/rust/rustfmt.toml
+++ /dev/null
@@ -1 +0,0 @@
-edition = "2021"