Table of Contents

zkbuild on GitHub Actions

zkbuild-action compiles your TwinCAT project and runs unit tests on Zeugwerk CI/CD. This page is the GitHub Actions setup. For Bitbucket, use zkbuild on Bitbucket Pipelines. Shared behavior (inputs, artifacts, the deployment installer, pricing) is on the zkbuild reference.

Free tier for public repos (30 builds/month). For private repos or higher volume, contact us.


Quick start

  1. Register at api.zeugwerk.dev/account/register. Public repositories get 30 free builds per month.
  2. Add a workflow. Create .github/workflows/build.yml:
name: Build/Test
on:
  push:
    branches: [main, 'release/**']
  pull_request_target:
  workflow_dispatch:
jobs:
  Build:
    name: Build/Test
    runs-on: ubuntu-latest
    steps:
      - name: Build
        uses: Zeugwerk/zkbuild-action@1.0.0
        with:
          username: ${{ secrets.ACTIONS_ZGWK_USERNAME }}
          password: ${{ secrets.ACTIONS_ZGWK_PASSWORD }}
      - name: Upload Artifact
        uses: actions/upload-artifact@v4
        with:
          name: artifact
          path: "**/*.library"
      - name: Publish Unittest
        uses: EnricoMi/publish-unit-test-result-action@v1
        with:
          files: archive/test/TcUnit_xUnit_results.xml
  1. Store credentials. Add ACTIONS_ZGWK_USERNAME and ACTIONS_ZGWK_PASSWORD as GitHub Secrets. Do not commit them.
  2. Configure the build. Add a .Zeugwerk/config.json in the repository. Generate it with Twinpack. Schema: config.json reference.

A push runs the action, which calls Zeugwerk CI/CD. The server builds the solution, runs unit tests, and returns artifacts. The workflow uploads libraries and publishes JUnit results. No self-hosted runner is required.

How a run finishes

Artifact Location
.library file(s) archive/<repo>/<tcversion>/<plc>_<version>.library
Test results (JUnit) archive/test/TcUnit_xUnit_results.xml for a generated harness or a tests/ solution. archive/tests/<TestProjectFolder>/TcUnit_xUnit_results.xml for an in-solution test PLC.
Installer (.exe) archive/<installer-name> when installer: true
Build logs GitHub Actions run summary

archive/tests/**/TcUnit_xUnit_results.xml matches every layout. Test setup: Unit tests.

Inputs

Full descriptions are on the zkbuild reference. The names below are the with: keys of Zeugwerk/zkbuild-action.

Input Required Default
username Yes
password Yes
tcversion No auto
platform No TwinCAT RT (x64)
variant-build No default variant
variant-test No default variant
static-analysis No false
installer No false
installer-name No Setup-<REPO> <VERSION>.exe
workspace No ./
version No latest git tag
skip-build No false
skip-test No false
force-checks No false
artifact-name No artifact.zip

Examples

Pin a TwinCAT version

- uses: Zeugwerk/zkbuild-action@1.0.0
  with:
    username: ${{ secrets.ACTIONS_ZGWK_USERNAME }}
    password: ${{ secrets.ACTIONS_ZGWK_PASSWORD }}
    tcversion: TC3.1.4024.56

Build and test different variants

- uses: Zeugwerk/zkbuild-action@1.0.0
  with:
    username: ${{ secrets.ACTIONS_ZGWK_USERNAME }}
    password: ${{ secrets.ACTIONS_ZGWK_PASSWORD }}
    variant-build: Release
    variant-test: Simulation

Enable static analysis

- uses: Zeugwerk/zkbuild-action@1.0.0
  with:
    username: ${{ secrets.ACTIONS_ZGWK_USERNAME }}
    password: ${{ secrets.ACTIONS_ZGWK_PASSWORD }}
    static-analysis: true

Generate an installer package

See PLC deployment installer for what the .exe does.

- uses: Zeugwerk/zkbuild-action@1.0.0
  with:
    username: ${{ secrets.ACTIONS_ZGWK_USERNAME }}
    password: ${{ secrets.ACTIONS_ZGWK_PASSWORD }}
    installer: true
    installer-name: Setup-MyPLC ${{ github.ref_name }}.exe

Project not at the repository root

- uses: Zeugwerk/zkbuild-action@1.0.0
  with:
    username: ${{ secrets.ACTIONS_ZGWK_USERNAME }}
    password: ${{ secrets.ACTIONS_ZGWK_PASSWORD }}
    workspace: src/MyPlc/

Run tests only

- uses: Zeugwerk/zkbuild-action@1.0.0
  with:
    username: ${{ secrets.ACTIONS_ZGWK_USERNAME }}
    password: ${{ secrets.ACTIONS_ZGWK_PASSWORD }}
    skip-build: true

Skip tests on draft pull requests with skip-test: true.

Troubleshooting

Symptom Likely cause Fix
Credentials not found Secrets not configured Set ACTIONS_ZGWK_USERNAME and ACTIONS_ZGWK_PASSWORD in GitHub Secrets.
TwinCAT version mismatch Requested version is not on the CI server Set tcversion, for example TC3.1.4024.56.
Tests not running No tests detected Use one of the unit test layouts.
Installer not produced installer not set Add installer: true.
Project not found Config is not at the repository root Set workspace to the directory that contains .Zeugwerk/config.json.

More symptoms are on the zkbuild reference.