Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Quafadas committed Apr 3, 2024
1 parent e7063f1 commit 0624fef
Show file tree
Hide file tree
Showing 11 changed files with 112 additions and 71 deletions.
90 changes: 58 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,68 @@
name: CI
name: Continuous Integration

on:
push:
branches:
- main
tags:
- "v*"
pull_request:
branches: ['**', '!update/**', '!pr/**']
push:
branches: ['**', '!update/**', '!pr/**']
tags: [v*]

jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

test:
if: github.event_name == 'push' || github.event_name == 'pull_request'
runs-on: ubuntu-latest

concurrency:
group: ${{ github.workflow }} @ ${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build and Test
strategy:
matrix:
os: [ubuntu-latest]
scala: [3]
java: [temurin@17]
project: [jvm]
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: coursier/[email protected]
- uses: VirtusLab/scala-cli-setup@main
- uses: taiki-e/install-action@just
- name: Install Playwright
run: just setupPlaywright
- name: compile
run: just compile
- name: test
run: just test
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Java (temurin@17)
id: setup-java-temurin-17
if: matrix.java == 'temurin@17'
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17

- name: Test
run: ./mill project.test

publish:
needs: test
if: github.event_name == 'push'
if: github.repository == 'Quafadas/live-server-scala-cli-js' && contains(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: coursier/[email protected]
- uses: VirtusLab/scala-cli-setup@main

- name: Publish
run: scala-cli publish . --power --secret-key value:${{secrets.PUBLISH_SECRET_KEY}} --secret-key-password value:${{secrets.PUBLISH_SECRET_KEY_PASSWORD}} --user value:${{ secrets.PUBLISH_USER }} --password value:${{secrets.PUBLISH_PASSWORD}}
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17

- name: Setup GPG secrets
run: |
gpg --version
cat <(echo "${{ secrets.PUBLISH_SECRET_KEY }}") | base64 --decode | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
- name: Publish to Maven Central
run: ./mill -i mill.scalalib.PublishModule/publishAll __.publishArtifacts --sonatypeUri https://s01.oss.sonatype.org/service/local --sonatypeCreds "${{ secrets.PUBLISH_USER }}:${{ secrets.PUBLISH_PASSWORD }}" --gpgArgs "--passphrase=${{ secrets.PUBLISH_SECRET_KEY_PASSWORD}},--batch,--yes,-a,-b,--pinentry-mode,loopback" --readTimeout 600000 --awaitTimeout 600000 --release true --signed true
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
.bsp
.vscode
native
testDir
testDir
.bsp
out
1 change: 1 addition & 0 deletions .mill-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.11.7
3 changes: 2 additions & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ runner.dialectOverride.withAllowEndMarker = true
runner.dialectOverride.allowSignificantIndentation = true
rewrite.scala3.countEndMarkerLines = lastBlockOnly
rewrite.scala3.insertEndMarkerMinLines = 1
maxColumn = 120
maxColumn = 120
project.excludeFilters = [ ".*/build\\.sc" ]
41 changes: 41 additions & 0 deletions build.sc
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import mill._
import mill.scalalib._

object project extends ScalaModule with PublishModule {
def scalaVersion = "3.4.1"
def ivyDeps = super.ivyDeps() ++ Seq(
ivy"org.http4s::http4s-ember-server::0.23.26",
ivy"org.http4s::http4s-dsl::0.23.26",
ivy"org.http4s::http4s-scalatags::0.25.2",
ivy"io.circe::circe-core::0.14.6",
ivy"io.circe::circe-generic::0.14.6",
ivy"co.fs2::fs2-io::3.10.2",
ivy"com.lihaoyi::scalatags::0.12.0"
)

def publishVersion = VcsVersion.vcsState().format()

object test extends ScalaTests with TestModule.Munit {
def ivyDeps = super.ivyDeps() ++ Seq(
ivy"org.scalameta::munit::1.0.0-M11",
ivy"com.microsoft.playwright:playwright:1.41.1",
ivy"com.microsoft.playwright:driver-bundle:1.41.1",
)
}

override def pomSettings = T {
PomSettings(
description = "An experimental live server for scala JS projects",
organization = "io.github.quafadas",
url = "https://github.com/Quafadas/live-server-scala-cli-js",
licenses = Seq(License.`Apache-2.0`),
versionControl =
VersionControl.github("quafadas", "live-server-scala-cli-js"),
developers = Seq(
Developer("quafadas", "Simon Parten", "https://github.com/quafadas")
)
)
}


}
17 changes: 7 additions & 10 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,21 @@ default:
just --list

setupIde:
scala-cli setup-ide . --exclude testDir --exclude native

package:
scala-cli package .
mill mill.bsp.BSP/install

compile:
scala-cli compile . --exclude testDir --exclude native --power
mill project.compile

test:
scala-cli test . --exclude testDir --exclude native --power

jvmWatch:
scala-cli run project.scala file.watcher.scala
mill project.test

jvmServe:
scala-cli run project.scala live.serverJvm.scala htmlGen.scala file.hasher.scala -- "/Users/simon/Code/helloScalaJs/out"
scala-cli project.run /Users/simon/Code/helloScalaJs /Users/simon/Code/helloScalaJs/out

setupPlaywright:
cs launch com.microsoft.playwright:playwright:1.41.1 -M "com.microsoft.playwright.CLI" -- install --with-deps

publish:
mill

gha: setupPlaywright test
27 changes: 0 additions & 27 deletions project.scala

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 0624fef

Please sign in to comment.