pipeline {
    agent none

    stages {
        stage('Cross build') {
            matrix {
                axes {
                    axis {
                        name 'PLATFORM'
                        values 'linux', 'windows', 'darwin'
                    }
                    axis {
                        name 'ARCH'
                        values 'amd64', 'arm64'
                    }
                }

                excludes {
                    exclude {
                        axis {
                            name 'PLATFORM'
                            values 'windows'
                        }
                        axis {
                            name 'ARCH'
                            values 'arm64'
                        }
                    }
                }

                agent {
                    label "${PLATFORM}"
                }

                stages {
                    stage('Compile') {
                        steps {
                            echo "building ${PLATFORM}/${ARCH}"
                        }
                    }
                }
            }
        }
    }
}
