From 943bd7f9f99007d499964f74fc373ad76d6784ed Mon Sep 17 00:00:00 2001 From: Gabriel Volpe Date: Wed, 25 Jan 2023 17:58:22 +0100 Subject: [PATCH 1/3] update scala to 3.2.2 and various updates --- .github/workflows/ci.yml | 10 +++----- .github/workflows/release.yml | 19 ++++++++-------- README.md | 15 ++++++------ build.sbt | 4 ++-- flake.lock | 43 +++++++++++++++++++++++++++++++++++ flake.nix | 36 +++++++++++++++++++++++++++++ shell.nix | 39 ------------------------------- 7 files changed, 102 insertions(+), 64 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix delete mode 100644 shell.nix diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38f064c..4fe28d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,11 +8,7 @@ on: jobs: build: name: Build - runs-on: ubuntu-18.04 - strategy: - matrix: - java: - - jdk15 + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2.3.2 @@ -20,7 +16,7 @@ jobs: uses: coursier/cache-action@v4.1 - name: "Install Nix ❄️" - uses: cachix/install-nix-action@v12 + uses: cachix/install-nix-action@v18 - name: "Run with ${{ matrix.java }} 🚀" - run: nix-shell --argstr java "${{ matrix.java }}" --run "sbt ++ 'test;mdoc'" + run: nix develop -c sbt '++test;mdoc' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3984714..9cf7f53 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,18 +9,19 @@ on: jobs: build: name: Publish - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2.1.0 - - name: java 11 setup - uses: olafurpg/setup-java@v10 + - uses: actions/checkout@v2.3.2 with: - java-version: '11' - - uses: olafurpg/setup-gpg@v3 - - env: + fetch-depth: 0 # fetch all branches & tags + + - name: "Install Nix ❄️" + uses: cachix/install-nix-action@v18 + + - name: "Publish ${{ github.ref }} 🚀" + env: PGP_PASSPHRASE: "${{ secrets.PGP_PASSPHRASE }}" PGP_SECRET: "${{ secrets.PGP_SECRET }}" SONATYPE_PASSWORD: "${{ secrets.SONATYPE_PASSWORD }}" SONATYPE_USERNAME: "${{ secrets.SONATYPE_USERNAME }}" - name: "Publish ${{ github.ref }}" - run: sbt ci-release + run: nix develop -c sbt ci-release diff --git a/README.md b/README.md index ad7267a..ce69aaa 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,9 @@ http4s-jwt-auth =============== -[![CI Status](https://github.com/profunktor/http4s-jwt-auth/workflows/Build/badge.svg)](https://github.com/profunktor/http4s-jwt-auth/actions) +[![CI Status](https://github.com/profunktor/http4s-jwt-auth/workflows/Scala/badge.svg)](https://github.com/profunktor/http4s-jwt-auth/actions) [![Gitter Chat](https://badges.gitter.im/profunktor-dev/http4s-jwt-auth.svg)](https://gitter.im/profunktor-dev/http4s-jwt-auth) [![Maven Central](https://img.shields.io/maven-central/v/dev.profunktor/http4s-jwt-auth_2.12.svg)](http://search.maven.org/#search%7Cga%7C1%7Chttp4s-jwt-auth) Cats friendly -[![MergifyStatus](https://img.shields.io/endpoint.svg?url=https://gh.mergify.io/badges/profunktor/http4s-jwt-auth&style=flat)](https://mergify.io) [![Scala Steward badge](https://img.shields.io/badge/Scala_Steward-helping-brightgreen.svg?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAQCAMAAAARSr4IAAAAVFBMVEUAAACHjojlOy5NWlrKzcYRKjGFjIbp293YycuLa3pYY2LSqql4f3pCUFTgSjNodYRmcXUsPD/NTTbjRS+2jomhgnzNc223cGvZS0HaSD0XLjbaSjElhIr+AAAAAXRSTlMAQObYZgAAAHlJREFUCNdNyosOwyAIhWHAQS1Vt7a77/3fcxxdmv0xwmckutAR1nkm4ggbyEcg/wWmlGLDAA3oL50xi6fk5ffZ3E2E3QfZDCcCN2YtbEWZt+Drc6u6rlqv7Uk0LdKqqr5rk2UCRXOk0vmQKGfc94nOJyQjouF9H/wCc9gECEYfONoAAAAASUVORK5CYII=)](https://scala-steward.org) Opinionated [JWT](https://tools.ietf.org/html/rfc7519) authentication library for [http4s](https://http4s.org/). @@ -44,13 +43,15 @@ val securedRoutes: HttpRoutes[IO] = middleware(routes) ### Build microsite -If you only need `jekyll` for this, it is recommended to use `nix-shell` to avoid installing it globally: +You need to have `jekyll` installed before running the following command: +``` console +$ sbt makeMicrosite +$ cd site/target/site +$ jekyll serve ``` -nix-shell -p jekyll -sbt makeMicrosite -cd site/target/site && jekyll serve -``` + +Or you can use `nix develop` by leveraging the `flake.nix` in this repo. ### Notes diff --git a/build.sbt b/build.sbt index a6e26ff..835ce7e 100644 --- a/build.sbt +++ b/build.sbt @@ -4,7 +4,7 @@ import Dependencies._ import microsites.ExtraMdFileConfig ThisBuild / organizationName := "ProfunKtor" -ThisBuild / crossScalaVersions := List("2.12.15", "2.13.8", "3.1.2") +ThisBuild / crossScalaVersions := List("2.12.15", "2.13.8", "3.2.2") // publishing ThisBuild / name := """http4s-jwt-auth""" @@ -16,7 +16,7 @@ ThisBuild / developers := List( "gvolpe", "Gabriel Volpe", "volpegabriel@gmail.com", - url("https://gvolpe.github.io") + url("https://gvolpe.com") ) ) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e2adc94 --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1674487464, + "narHash": "sha256-Jgq50e4S4JVCYpWLqrabBzDp/1mfaxHCh8/OOorHTy0=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "3954218cf613eba8e0dcefa9abe337d26bc48fd0", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..70ea78a --- /dev/null +++ b/flake.nix @@ -0,0 +1,36 @@ +{ + description = "Scala development shell"; + + inputs = { + nixpkgs.url = github:nixos/nixpkgs/nixpkgs-unstable; + flake-utils.url = github:numtide/flake-utils; + }; + + outputs = { self, nixpkgs, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + jreOverlay = f: p: { + jre = p.jdk19; + }; + + pkgs = import nixpkgs { + inherit system; + overlays = [ jreOverlay ]; + }; + in + { + devShell = pkgs.mkShell { + name = "scala-dev-shell"; + + buildInputs = with pkgs; [ + gnupg + jekyll + jre + sbt + ]; + + JAVA_HOME = "${pkgs.jre}"; + }; + } + ); +} diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 4a70ba3..0000000 --- a/shell.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ jdk ? "jdk15" }: - -let - config = { - packageOverrides = p: rec { - java = p.${jdk}; - - sbt = p.sbt.overrideAttrs ( - old: rec { - jre = "${java}"; - } - ); - }; - }; - - nixpkgs = fetchTarball { - name = "nixos-unstable-2021-02-21"; - url = "https://github.com/NixOS/nixpkgs/archive/9816b99e71c.tar.gz"; - sha256 = "1dpz36i3vx0c1wmacrki0wsf30if8xq3bnj71g89rsbxyi87lhcm"; - }; - - pkgs = import nixpkgs { inherit config; }; - - siteDeps = with pkgs; [ - autoconf # v2.7.0 (autoreconf) - automake # v1.16.3 (aclocal) - nodejs-14_x # v14.15.5 - yarn # v1.22.10 - ]; -in -pkgs.mkShell { - name = "scala-shell"; - - buildInputs = with pkgs; [ - coursier # v2.0.12 - pkgs.${jdk} # v15.0.1 - sbt # v1.4.7 (script version) - ] ++ siteDeps; -} From a6676e9808006dde44e3721df12e0dfb8491438c Mon Sep 17 00:00:00 2001 From: Gabriel Volpe Date: Wed, 25 Jan 2023 18:06:38 +0100 Subject: [PATCH 2/3] revert Scala 3.2.2 update due to mdoc imcompatibility --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 835ce7e..ed30633 100644 --- a/build.sbt +++ b/build.sbt @@ -4,7 +4,7 @@ import Dependencies._ import microsites.ExtraMdFileConfig ThisBuild / organizationName := "ProfunKtor" -ThisBuild / crossScalaVersions := List("2.12.15", "2.13.8", "3.2.2") +ThisBuild / crossScalaVersions := List("2.12.15", "2.13.8", "3.2.1") // publishing ThisBuild / name := """http4s-jwt-auth""" From e72f2e64b5a67895544ecfbd54baca30de6fe9a9 Mon Sep 17 00:00:00 2001 From: Gabriel Volpe Date: Wed, 25 Jan 2023 18:13:44 +0100 Subject: [PATCH 3/3] update commands order --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4fe28d0..61b3de7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,4 +19,4 @@ jobs: uses: cachix/install-nix-action@v18 - name: "Run with ${{ matrix.java }} 🚀" - run: nix develop -c sbt '++test;mdoc' + run: nix develop -c sbt 'clean;mdoc;++test'