Skip to content

Commit

Permalink
Split CI
Browse files Browse the repository at this point in the history
  • Loading branch information
cannorin committed Aug 29, 2022
1 parent abd3080 commit 6796a30
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 23 deletions.
44 changes: 40 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ name: CI

on:
push:
branches: [main]
branches: [main,v2]
pull_request:
branches: [main]
branches: [main,v2]
workflow_dispatch:

jobs:
build:
build-jsoo:
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -59,4 +59,40 @@ jobs:
run: opam install . --deps-only

- name: Run FAKE
run: dotnet fake build target Test
run: dotnet fake build target TestJsoo

build-res:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
dotnet:
- 5.0.x
node-version:
- 16.x

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Use .NET ${{ matrix.dotnet }}
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: yarn

- name: Install .NET Dependencies
run: |
dotnet restore
dotnet tool restore
- name: Run FAKE
run: dotnet fake build target TestRes
35 changes: 16 additions & 19 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,18 @@ let run cmd dir args =
failwithf "Error while running '%s' with args: %s " cmd args

let platformTool tool =
ProcessUtils.tryFindFileOnPath tool
|> function Some t -> t | _ -> failwithf "%s not found" tool
lazy
ProcessUtils.tryFindFileOnPath tool
|> function Some t -> t | _ -> failwithf "%s not found" tool

let dotnetExec cmd args =
let result = DotNet.exec id cmd args
if not result.OK then
failwithf "Error while running 'dotnet %s %s'" cmd args

let opamTool = platformTool "opam"
let opam args = run opamTool "./" args
let dune args = run opamTool "./" (sprintf "exec -- dune %s" args)
let opam args = run opamTool.Value "./" args
let dune args = run opamTool.Value "./" (sprintf "exec -- dune %s" args)

// Build targets

Expand Down Expand Up @@ -89,27 +90,24 @@ Target.create "Watch" <| fun _ ->
dotnetExec "fable" $"watch {srcDir} --sourceMaps --define DEBUG --run webpack -w --mode=development"

Target.create "Test" ignore
Target.create "TestOnly" ignore
Target.create "TestComplete" ignore

"Clean"
==> "YarnInstall"
?=> "YarnInstall"
==> "Restore"
==> "Prepare"
==> "Build"

"TestOnly"
==> "TestComplete"
==> "Test"
"Prepare"
==> "BuildForTest"

"Prepare"
?=> "BuildForTest"
?=> "TestComplete"
?=> "BuildForPublish"
==> "BuildForPublish"
==> "Build"

"Prepare"
?=> "Watch"
==> "Test"

"Prepare"
==> "Watch"

// Test targets

Expand Down Expand Up @@ -226,7 +224,7 @@ Target.create "TestJsoo" ignore
==> "TestJsooGenerateBindings"
==> "TestJsooBuild"
==> "TestJsoo"
==> "TestOnly"
==> "Test"

Target.create "TestResClean" <| fun _ -> Test.Res.clean ()
Target.create "TestResGenerateBindings" <| fun _ -> Test.Res.generateBindings ()
Expand All @@ -238,7 +236,7 @@ Target.create "TestRes" ignore
==> "TestResGenerateBindings"
==> "TestResBuild"
==> "TestRes"
==> "TestOnly"
==> "Test"

// Publish targets

Expand Down Expand Up @@ -287,7 +285,6 @@ module Publish =
inDirectory targetDir <| fun () -> dune "build"

Target.create "Publish" <| fun _ -> ()
Target.create "PublishOnly" <| fun _ -> ()

Target.create "PublishNpm" <| fun _ ->
Publish.Npm.updateVersion ()
Expand All @@ -300,7 +297,6 @@ Target.create "PublishJsoo" <| fun _ ->
"BuildForPublish"
==> "PublishNpm"
==> "PublishJsoo"
==> "PublishOnly"
==> "Publish"

"TestJsoo" ==> "PublishJsoo"
Expand All @@ -309,6 +305,7 @@ Target.create "PublishJsoo" <| fun _ ->

Target.create "All" ignore

"Prepare" ==> "All"
"Build"
==> "Test"
==> "Publish"
Expand Down

0 comments on commit 6796a30

Please sign in to comment.