Skip to content

feat(eventlog-live-otelcol): pack configuration file JSON Schema #429

feat(eventlog-live-otelcol): pack configuration file JSON Schema

feat(eventlog-live-otelcol): pack configuration file JSON Schema #429

Workflow file for this run

name: CI
on:
push:
branches:
- "master"
pull_request:
# Set the default shell on all platforms.
defaults:
run:
shell: sh
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
#############################################################################
# Build
#############################################################################
build:
name: |
${{ format(
'Build on {0}{1}{2}',
startsWith(matrix.os, 'ubuntu-') && 'Linux' || startsWith(matrix.os, 'macOS-') && 'macOS',
matrix.ghc-version && format(' with GHC {0}', matrix.ghc-version),
matrix.cabal-flags && format(' with {0}', matrix.cabal-flags)
)
}}
runs-on: ${{ matrix.os }}
steps:
- name: πŸ“₯ Checkout repository
uses: actions/checkout@v4
# The dev-dependencies file lists the versions of all system dependencies
# required for development. It is formatted in such a way that it is easy
# to use from GitHub Actions. This step outputs the versions to make them
# available to all following steps under "steps.dev-dependencies.outputs"
- name: πŸ—„οΈ Read dev-dependencies
run: cat "./scripts/dev-dependencies.txt" >> "$GITHUB_OUTPUT"
id: dev-dependencies
- name: πŸ› οΈ Setup Haskell
id: setup-haskell
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc-version }}
- name: πŸ› οΈ Setup Protobuf Compiler
uses: ./.github/actions/setup-protoc
with:
protoc-version: ${{ steps.dev-dependencies.outputs.protoc }}
- name: πŸ—„οΈ Generate Cabal plan
run: cabal build all ${{ matrix.cabal-flags }} --dry-run
- name: πŸ’Ύ Restore Cabal dependencies
uses: actions/cache/restore@v4
id: cache-cabal
env:
key: build-${{ runner.os }}-ghc-${{ steps.setup-haskell.outputs.ghc-version }}-cabal-${{ steps.setup-haskell.outputs.cabal-version }}-flags-${{ matrix.cabal-flags }}
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ env.key }}-plan-${{ hashFiles('dist-newstyle/cache/plan.json') }}
restore-keys: ${{ env.key }}-
- name: πŸ› οΈ Build Cabal dependencies
run: cabal build all ${{ matrix.cabal-flags }} --only-dependencies
- name: πŸ’Ύ Save Cabal dependencies
uses: actions/cache/save@v4
if: ${{ steps.cache-cabal.outputs.cache-hit != 'true' }}
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ steps.cache-cabal.outputs.cache-primary-key }}
- name: πŸ—οΈ Build
run: cabal build all ${{ matrix.cabal-flags }}
- name: πŸ§ͺ Test fibber-dumper
run: ./examples/fibber/fibber-dumper.sh
strategy:
fail-fast: false
matrix:
os:
- "ubuntu-latest"
- "macOS-latest"
ghc-version:
- "9.8.4"
- "9.10.2"
- "9.12.2"
include:
- cabal-flags: ""
- os: "ubuntu-latest"
ghc-version: "9.4.8"
- os: "ubuntu-latest"
ghc-version: "9.6.7"
- os: "ubuntu-latest"
ghc-version: "9.10.2"
cabal-flags: "-f+use-ghc-debug-stub"
- os: "ubuntu-latest"
ghc-version: "9.10.2"
cabal-flags: "-f+use-template-haskell-lift"
#############################################################################
# Build dockerfiles
#############################################################################
build-dockerfiles:
name: "Build dockerfiles"
runs-on: "ubuntu-latest"
steps:
- name: πŸ“₯ Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: πŸ› οΈ Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: πŸ—οΈ Build
uses: docker/build-push-action@v6
with:
file: dockerfiles/Dockerfile.${{ matrix.dockerfile }}
push: false
tags: |
well-typed/${{
startsWith(matrix.dockerfile, 'eventlog-live-')
&& matrix.dockerfile
|| format('eventlog-live-examples-{0}', matrix.dockerfile)
}}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
strategy:
fail-fast: false
matrix:
dockerfile:
- "collatzer"
- "dumper"
- "eventlog-live-influxdb"
- "eventlog-live-otelcol"
- "fibber"
- "ghc-events-show"
- "oddball"
#############################################################################
# Build Nix VM
#############################################################################
build-nix-vm:
name: "Build Nix VM"
runs-on: "ubuntu-latest"
if: github.ref_name == 'master' && github.event_name == 'push'
steps:
- name: πŸ“₯ Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: πŸ› οΈ Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
- name: πŸ› οΈ Install Nix
uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- name: πŸ—οΈ Build
run: nix build .#standalone-vm
working-directory: "nix/${{ matrix.nix-vm-directory }}"
- name: πŸ“¦ Upload artifact
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.nix-vm-directory }}.qcow2"
path: "${{ github.workspace }}/nix/${{ matrix.nix-vm-directory }}/result/nixos.qcow2"
if-no-files-found: error
compression-level: 9
overwrite: true
strategy:
fail-fast: false
matrix:
nix-vm-directory:
- "eventlog-live-otelcol"
#############################################################################
# Test with cabal-docspec
#############################################################################
test-cabal-docspec:
name: "Test with cabal-docspec"
runs-on: "ubuntu-latest"
steps:
- name: πŸ“₯ Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: πŸ—„οΈ Read dev-dependencies
run: cat "./scripts/dev-dependencies.txt" >> "$GITHUB_OUTPUT"
id: dev-dependencies
- name: πŸ› οΈ Setup cabal-docspec
uses: ./.github/actions/setup-cabal-docspec
- name: πŸ› οΈ Update package list for Hackage
run: |
mkdir ~/.cabal
cabal user-config update
cabal update
- name: πŸ§ͺ Test with cabal-docspec
run: ./scripts/test-cabal-docspec.sh
#############################################################################
# Lint with actionlint
#############################################################################
lint-actionlint:
name: "Lint with actionlint"
runs-on: "ubuntu-latest"
steps:
- name: πŸ“₯ Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: πŸ—„οΈ Read dev-dependencies
run: cat "./scripts/dev-dependencies.txt" >> "$GITHUB_OUTPUT"
id: dev-dependencies
- name: "Setup actionlint"
uses: ./.github/actions/setup-actionlint
with:
actionlint-version: ${{ steps.dev-dependencies.outputs.actionlint }}
- name: πŸŽ—οΈ Lint with actionlint
run: ./scripts/lint-actionlint.sh
#############################################################################
# Lint with cabal
#############################################################################
lint-cabal:
name: "Lint with Cabal"
runs-on: "ubuntu-latest"
steps:
- name: πŸ“₯ Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: πŸ—„οΈ Read dev-dependencies
run: cat "./scripts/dev-dependencies.txt" >> "$GITHUB_OUTPUT"
id: dev-dependencies
- name: πŸ› οΈ Install Haskell
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ steps.dev-dependencies.outputs.ghc }}
cabal-version: ${{ steps.dev-dependencies.outputs.cabal }}
id: setup-haskell
- name: πŸŽ—οΈ Lint with Cabal
run: ./scripts/lint-cabal.sh
#############################################################################
# Lint with cabal-fmt
#############################################################################
lint-cabal-fmt:
name: "Lint with cabal-fmt"
runs-on: "ubuntu-latest"
steps:
- name: πŸ“₯ Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: πŸ—„οΈ Read dev-dependencies
run: cat "./scripts/dev-dependencies.txt" >> "$GITHUB_OUTPUT"
id: dev-dependencies
- name: πŸ› οΈ Install cabal-fmt
uses: ./.github/actions/setup-cabal-fmt
with:
cabal-fmt-version: ${{ steps.dev-dependencies.outputs.cabal-fmt }}
ghc-version: ${{ steps.dev-dependencies.outputs.ghc }}
cabal-version: ${{ steps.dev-dependencies.outputs.cabal }}
- name: πŸŽ—οΈ Lint with cabal-fmt
run: ./scripts/lint-cabal-fmt.sh
#############################################################################
# Lint with HLint
#############################################################################
lint-hlint:
name: "Lint with HLint"
runs-on: "ubuntu-latest"
steps:
- name: πŸ“₯ Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: πŸ—„οΈ Read dev-dependencies
run: cat "./scripts/dev-dependencies.txt" >> "$GITHUB_OUTPUT"
id: dev-dependencies
- name: πŸ› οΈ Install HLint
uses: haskell-actions/hlint-setup@v2
with:
version: ${{ steps.dev-dependencies.outputs.hlint }}
id: setup-hlint
- name: πŸŽ—οΈ Lint with HLint
run: ./scripts/lint-hlint.sh
env:
HLINT: ${{ steps.setup-hlint.outputs.hlint-bin }}
#############################################################################
# Lint with Fourmolu
#############################################################################
lint-fourmolu:
name: "Lint with Fourmolu"
runs-on: "ubuntu-latest"
steps:
- name: πŸ“₯ Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: πŸ—„οΈ Read dev-dependencies
run: cat "./scripts/dev-dependencies.txt" >> "$GITHUB_OUTPUT"
id: dev-dependencies
- name: πŸ› οΈ Install Fourmolu
uses: ./.github/actions/setup-fourmolu
with:
fourmolu-version: ${{ steps.dev-dependencies.outputs.fourmolu }}
ghc-version: ${{ steps.dev-dependencies.outputs.ghc }}
cabal-version: ${{ steps.dev-dependencies.outputs.cabal }}
- name: πŸŽ—οΈ Lint with Fourmolu
run: ./scripts/lint-fourmolu.sh
#############################################################################
# Lint with Nixfmt
#############################################################################
lint-nixfmt:
name: "Lint with Nixfmt"
runs-on: "ubuntu-latest"
steps:
- name: πŸ“₯ Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: πŸ—„οΈ Read dev-dependencies
run: cat "./scripts/dev-dependencies.txt" >> "$GITHUB_OUTPUT"
id: dev-dependencies
- name: πŸ› οΈ Install Nix
uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixos-25.05
- name: πŸŽ—οΈ Lint with Nixfmt
run: nix-shell -p nixfmt-rfc-style --run 'sh ./scripts/lint-nixfmt.sh'
#############################################################################
# Lint with Prettier
#############################################################################
lint-prettier:
name: "Lint with Prettier"
runs-on: "ubuntu-latest"
steps:
- name: πŸ“₯ Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: πŸ—„οΈ Read dev-dependencies
run: cat "./scripts/dev-dependencies.txt" >> "$GITHUB_OUTPUT"
id: dev-dependencies
- name: πŸŽ—οΈ Lint with Prettier
run: ./scripts/lint-prettier.sh
env:
PRETTIER: "npm exec --yes --package=prettier@${{ steps.dev-dependencies.outputs.prettier }} prettier --"
#############################################################################
# Lint with ShellCheck
#############################################################################
lint-shellcheck:
name: "Lint with ShellCheck"
runs-on: "ubuntu-latest"
steps:
- name: πŸ“₯ Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: πŸ—„οΈ Read dev-dependencies
run: cat "./scripts/dev-dependencies.txt" >> "$GITHUB_OUTPUT"
id: dev-dependencies
- name: πŸ› οΈ Install ShellCheck
uses: ./.github/actions/setup-shellcheck
with:
shellcheck-version: ${{ steps.dev-dependencies.outputs.shellcheck }}
- name: πŸŽ—οΈ Lint with ShellCheck
run: ./scripts/lint-shellcheck.sh
#############################################################################
# Lint with cabal2nix
#############################################################################
lint-cabal2nix:
name: "Lint with cabal2nix"
runs-on: "ubuntu-latest"
steps:
- name: πŸ“₯ Checkout repository
uses: actions/checkout@v4
with:
submodules: true
- name: πŸ› οΈ Install Nix
uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- name: πŸŽ—οΈ Lint with cabal2nix
run: |
nix-shell -p haskellPackages.cabal2nix --run '\
cabal2nix file://${{ github.workspace }}/eventlog-live && \
cabal2nix file://${{ github.workspace }}/eventlog-live-influxdb && \
cabal2nix file://${{ github.workspace }}/eventlog-live-otelcol'
shell: bash