CI/CD Integration
Integrate MAKI into your continuous integration and deployment workflows.
GitHub Actions
Section titled “GitHub Actions”Complete Build Workflow
Section titled “Complete Build Workflow”name: Build FHIR IG
on: [push, pull_request]
jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4
- name: Download MAKI run: | curl -L https://github.com/octofhir/maki/releases/latest/download/maki-linux-x64 -o maki chmod +x maki sudo mv maki /usr/local/bin/
- name: Check formatting run: maki fmt --check input/fsh/
- name: Lint FSH files run: maki lint input/fsh/
- name: Build IG run: maki build --progress
- name: Upload artifacts uses: actions/upload-artifact@v4 with: name: fsh-generated path: fsh-generated/Basic Lint Workflow
Section titled “Basic Lint Workflow”name: Lint FSH Files
on: [push, pull_request]
jobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4
- name: Download MAKI run: | curl -L https://github.com/octofhir/maki/releases/latest/download/maki-linux-x64 -o maki chmod +x maki sudo mv maki /usr/local/bin/
- name: Check formatting run: maki fmt --check input/fsh/
- name: Lint FSH files run: maki lint input/fsh/Strict Build (CI Mode)
Section titled “Strict Build (CI Mode)”Build with strict mode - treat warnings as errors:
name: Strict Build
on: [push, pull_request]
jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4
- name: Download MAKI run: | curl -L https://github.com/octofhir/maki/releases/latest/download/maki-linux-x64 -o maki chmod +x maki sudo mv maki /usr/local/bin/
- name: Build with strict mode run: maki build --lint --strict --progressAuto-format and Auto-fix
Section titled “Auto-format and Auto-fix”Automatically format and fix issues, then commit:
name: Auto-format and Lint
on: [push, pull_request]
jobs: auto-fix: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4
- name: Download MAKI run: | curl -L https://github.com/octofhir/maki/releases/latest/download/maki-linux-x64 -o maki chmod +x maki sudo mv maki /usr/local/bin/
- name: Format FSH files run: maki fmt --write input/fsh/
- name: Lint with fixes run: maki lint --write input/fsh/
- name: Commit changes uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: "style: auto-format and fix FSH issues"GitLab CI
Section titled “GitLab CI”Basic Pipeline
Section titled “Basic Pipeline”build: image: ubuntu:latest before_script: - apt-get update && apt-get install -y curl - curl -L https://github.com/octofhir/maki/releases/latest/download/maki-linux-x64 -o /usr/local/bin/maki - chmod +x /usr/local/bin/maki script: - maki lint input/fsh/ - maki build --progress only: - merge_requests - mainWith Artifacts
Section titled “With Artifacts”build: image: ubuntu:latest before_script: - apt-get update && apt-get install -y curl - curl -L https://github.com/octofhir/maki/releases/latest/download/maki-linux-x64 -o /usr/local/bin/maki - chmod +x /usr/local/bin/maki script: - maki lint --format json input/fsh/ > lint-report.json || true - maki build --progress artifacts: paths: - fsh-generated/ - lint-report.json when: alwaysJenkins
Section titled “Jenkins”Declarative Pipeline
Section titled “Declarative Pipeline”pipeline { agent any
stages { stage('Setup') { steps { sh ''' curl -L https://github.com/octofhir/maki/releases/latest/download/maki-linux-x64 -o maki chmod +x maki mv maki /usr/local/bin/ ''' } }
stage('Lint') { steps { sh 'maki lint input/fsh/' } }
stage('Build') { steps { sh 'maki build --progress' } } }
post { always { archiveArtifacts artifacts: 'fsh-generated/**/*', allowEmptyArchive: true } }}Azure Pipelines
Section titled “Azure Pipelines”trigger: - main
pool: vmImage: 'ubuntu-latest'
steps:- script: | curl -L https://github.com/octofhir/maki/releases/latest/download/maki-linux-x64 -o maki chmod +x maki sudo mv maki /usr/local/bin/ displayName: 'Install MAKI'
- script: maki lint input/fsh/ displayName: 'Lint FSH files'
- script: maki build --progress displayName: 'Build IG'
- task: PublishBuildArtifacts@1 inputs: pathtoPublish: 'fsh-generated' artifactName: 'fsh-generated'Pre-commit Hook
Section titled “Pre-commit Hook”Format and Lint
Section titled “Format and Lint”Install MAKI as a pre-commit hook to format and lint before commits:
repos: - repo: local hooks: - id: maki-format name: FSH Format entry: maki fmt language: system files: \.fsh$ - id: maki-lint name: FSH Lint entry: maki lint --write language: system files: \.fsh$Git Hook Script
Section titled “Git Hook Script”Alternatively, use a custom git hook (.git/hooks/pre-commit):
#!/bin/bash
# Format FSH filesecho "Formatting FSH files..."maki fmt input/fsh/
# Check if formatting changed filesif ! git diff --quiet; then echo "Files were formatted. Please review changes and commit again." git add input/fsh/*.fshfi
# Lint FSH filesecho "Linting FSH files..."maki lint input/fsh/
if [ $? -ne 0 ]; then echo "Linting failed. Please fix errors before committing." exit 1fiMake it executable:
chmod +x .git/hooks/pre-commitBest Practices
Section titled “Best Practices”- Use Pre-built Binaries - Download binary releases for faster CI setup
- Check Formatting First - Run
maki fmt --checkbefore linting - Build with Quality Checks - Use
maki build --lint --formatfor integrated workflow - Strict Mode for CI - Use
--strictto treat warnings as errors - Save Artifacts - Archive
fsh-generated/for downstream use - Fail Fast - Separate format check → lint → build for quick feedback
Recommended Workflow
Section titled “Recommended Workflow”For best results, structure your workflow like this:
jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4
- name: Install MAKI run: | curl -L https://github.com/octofhir/maki/releases/latest/download/maki-linux-x64 -o maki chmod +x maki sudo mv maki /usr/local/bin/
- name: Format Check run: maki fmt --check input/fsh/
- name: Lint run: maki lint input/fsh/
- name: Build run: maki build --progress
- name: Upload Artifacts uses: actions/upload-artifact@v4 with: name: fsh-generated path: fsh-generated/Troubleshooting
Section titled “Troubleshooting”Binary Download Issues
Section titled “Binary Download Issues”If the binary download fails, try with specific version:
VERSION=0.0.3curl -L https://github.com/octofhir/maki/releases/download/v${VERSION}/maki-linux-x64 -o makiPermission Denied
Section titled “Permission Denied”Ensure the binary is executable:
chmod +x makiBuild Timeouts
Section titled “Build Timeouts”For large IGs, increase the timeout or use --skip-deps if packages are pre-installed:
maki build --progress --skip-deps