Skip to content

Commit

Permalink
ci: callable workflows for build and publish
Browse files Browse the repository at this point in the history
This allows a given runtime/os combo to complete later stages without waiting for initial stages to complete accross all runtimes.
  • Loading branch information
chrissimon-au committed Nov 28, 2023
1 parent aa21f6c commit f1b259f
Show file tree
Hide file tree
Showing 5 changed files with 190 additions and 132 deletions.
68 changes: 13 additions & 55 deletions .github/workflows/contextive-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,65 +5,23 @@ on:

env:
dotnet-version: '7.0.x'

jobs:
get-matrix:
name: "Load Release Matrix"
outputs:
matrix: ${{ steps.load-matrix.outputs.matrix }}
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
persist-credentials: false
- id: load-matrix
name: Load Build Matrix
run: |
matrix="matrix=$(yq -P -o=json .github/release-matrix.yml | jq -c .)"
echo $matrix
echo $matrix >> $GITHUB_OUTPUT
language-server:
name: Language Server
needs: get-matrix
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.get-matrix.outputs.matrix) }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false

- uses: ./.github/actions/init-dotnet
uses: ./.github/workflows/get-matrix.yml
with:
matrix-path: .github/release-matrix.yml

- name: Build
id: build
run: dotnet fsi language-server/build.fsx -- -r ${{ matrix.dotnet_runtime }} --release ${{ github.ref_name }}
working-directory: src
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
VSCE_PAT: ${{ secrets.VSCE_PAT }}

vscode:
name: VsCode Extension
needs:
- get-matrix
- language-server
build-test-publish:
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.get-matrix.outputs.matrix) }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false

- uses: ./.github/actions/init-dotnet
uses: ./.github/workflows/contextive-runtime-publish.yml
with:
dotnet_runtime: ${{ matrix.dotnet_runtime }}
os: ${{ matrix.os }}
vsce_platform: ${{ matrix.vsce_platform }}
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
VSCE_PAT: ${{ secrets.VSCE_PAT }}

- name: Build
id: build
run: dotnet fsi vscode/build.fsx -- -r ${{ matrix.dotnet_runtime }} --release ${{ github.ref_name }} --vsce-platform ${{ matrix.vsce_platform }}
working-directory: src
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
71 changes: 71 additions & 0 deletions .github/workflows/contextive-runtime-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Contextive per Runtime Build
on:
workflow_call:
inputs:
dotnet_runtime:
required: true
type: string
os:
required: true
type: string
env:
DOTNET_VERSION: '7.0.x'
jobs:

language-server:
name: Language Server
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false

- uses: ./.github/actions/init-dotnet

- name: Build
id: build
run: dotnet fsi language-server/build.fsx -- -r ${{ inputs.dotnet_runtime }}
working-directory: src

- name: Language Server Artifact
uses: actions/upload-artifact@v3
with:
name: Contextive.LanguageServer-${{inputs.dotnet_runtime}}
path: ${{ steps.build.outputs.artifact-path }}

- uses: ./.github/actions/upload-reports
if: always()
with:
name: 'Contextive Language Server'
reporter: dotnet-trx

vscode:
name: VsCode Extension
needs:
- language-server
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false

- uses: ./.github/actions/init-dotnet

- name: Language Server Artifact
uses: actions/download-artifact@v3
with:
name: Contextive.LanguageServer-${{ inputs.dotnet_runtime }}
path: src/

- run: echo "XDG_RUNTIME_DIR=/run/user/$(id -u)" >> $GITHUB_ENV
- run: echo "DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/bus" >> $GITHUB_ENV

- name: Build
run: dotnet fsi vscode/build.fsx -- -r ${{ inputs.dotnet_runtime }}
working-directory: src

- uses: ./.github/actions/upload-reports
if: always()
with:
name: 'Contextive VsCode Extension'
reporter: java-junit
65 changes: 65 additions & 0 deletions .github/workflows/contextive-runtime-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Contextive per Runtime Publish
on:
workflow_call:
inputs:
dotnet_runtime:
required: true
type: string
os:
required: true
type: string
vsce_platform:
required: true
type: string
secrets:
GH_TOKEN:
required: true
VSCE_PAT:
required: true


env:
dotnet-version: '7.0.x'

jobs:
get-matrix:
uses: ./.github/workflows/get-matrix.yml
with:
matrix-path: .github/release-matrix.yml

language-server:
name: Language Server
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false

- uses: ./.github/actions/init-dotnet

- name: Build
id: build
run: dotnet fsi language-server/build.fsx -- -r ${{ input.dotnet_runtime }} --release ${{ github.ref_name }}
working-directory: src
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

vscode:
name: VsCode Extension
needs:
- language-server
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false

- uses: ./.github/actions/init-dotnet

- name: Build
id: build
run: dotnet fsi vscode/build.fsx -- -r ${{ inputs.dotnet_runtime }} --release ${{ github.ref_name }} --vsce-platform ${{ inputs.vsce_platform }}
working-directory: src
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
VSCE_PAT: ${{ secrets.VSCE_PAT }}
88 changes: 11 additions & 77 deletions .github/workflows/contextive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,90 +4,24 @@ on:
paths:
- 'src/**'
- '.github/workflows/contextive.yml'
- '.github/workflows/get-matrix.yml'
- '.github/build-matrix.yml'
- '.github/actions/**'
env:
DOTNET_VERSION: '7.0.x'
jobs:

jobs:
get-matrix:
name: "Load Build Matrix"
outputs:
matrix: ${{ steps.load-matrix.outputs.matrix }}
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
persist-credentials: false
- id: load-matrix
name: Load Build Matrix
run: |
matrix="matrix=$(yq -P -o=json .github/build-matrix.yml | jq -c .)"
echo $matrix
echo $matrix >> $GITHUB_OUTPUT
uses: ./.github/workflows/get-matrix.yml
with:
matrix-path: .github/build-matrix.yml

language-server:
name: Language Server
build-test:
needs: get-matrix
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.get-matrix.outputs.matrix) }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false

- uses: ./.github/actions/init-dotnet

- name: Build
id: build
run: dotnet fsi language-server/build.fsx -- -r ${{ matrix.dotnet_runtime }}
working-directory: src

- name: Language Server Artifact
uses: actions/upload-artifact@v3
with:
name: Contextive.LanguageServer-${{matrix.dotnet_runtime}}
path: ${{ steps.build.outputs.artifact-path }}

- uses: ./.github/actions/upload-reports
if: always()
with:
name: 'Contextive Language Server'
reporter: dotnet-trx

vscode:
name: VsCode Extension
needs:
- get-matrix
- language-server
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.get-matrix.outputs.matrix) }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false

- uses: ./.github/actions/init-dotnet

- name: Language Server Artifact
uses: actions/download-artifact@v3
with:
name: Contextive.LanguageServer-${{ matrix.dotnet_runtime }}
path: src/

- run: echo "XDG_RUNTIME_DIR=/run/user/$(id -u)" >> $GITHUB_ENV
- run: echo "DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/bus" >> $GITHUB_ENV

- name: Build
run: dotnet fsi vscode/build.fsx -- -r ${{ matrix.dotnet_runtime }}
working-directory: src

- uses: ./.github/actions/upload-reports
if: always()
with:
name: 'Contextive VsCode Extension'
reporter: java-junit
uses: ./.github/workflows/contextive-runtime-build.yml
with:
dotnet_runtime: ${{ matrix.dotnet_runtime }}
os: ${{ matrix.os }}
30 changes: 30 additions & 0 deletions .github/workflows/get-matrix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Get Matrix
on:
workflow_call:
inputs:
matrix-path:
required: true
type: string
outputs:
matrix:
description: "The first output string"
value: ${{ jobs.get-matrix.outputs.matrix }}

jobs:

get-matrix:
name: "Load Build Matrix"
outputs:
matrix: ${{ steps.load-matrix.outputs.matrix }}
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
persist-credentials: false
- id: load-matrix
name: Load Build Matrix
run: |
matrix="matrix=$(yq -P -o=json ${{ inputs.matrix-path }} | jq -c .)"
echo $matrix
echo $matrix >> $GITHUB_OUTPUT

0 comments on commit f1b259f

Please sign in to comment.