- name: "Node: Build"
  run:
    when: "${FORCE_RUN} or change_in(['/*', '/api/', '/libcalico-go/', '/typha/', '/felix/', '/confd/', '/bird/', '/pod2daemon/', '/node/', '/hack/test/certs/'], {exclude: ['/**/.gitignore', '/**/README.md', '/**/LICENSE']})"
  dependencies:
    - Prerequisites
  task:
    agent:
      machine:
        type: f1-standard-4
        os_image: ubuntu2004
    prologue:
      commands:
        - cd node
    jobs:
      - name: "Node: CI"
        commands:
          - ../.semaphore/run-and-monitor ci.log make ci
- name: "Node: multi-arch build"
  run:
    when: "${FORCE_RUN} or change_in(['/felix/', '/confd/', '/node/'])"
  dependencies:
    - "Node: Build"
  task:
    agent:
      machine:
        type: f1-standard-4
        os_image: ubuntu2004
    prologue:
      commands:
        - cd node
    jobs:
      - name: Build image
        matrix:
          - env_var: ARCH
            values:
              - ppc64le
              - s390x
        commands:
          - ../.semaphore/run-and-monitor image-$ARCH.log make image ARCH=$ARCH
      - name: Build Windows archive
        commands:
          - ../.semaphore/run-and-monitor build-windows-archive.log make build-windows-archive
      - name: Build Windows image
        commands:
          - ../.semaphore/run-and-monitor build-windows-image.log make image-windows
- name: "Node: Build - native arm64 runner"
  run:
    when: "${FORCE_RUN} or change_in(['/felix/', '/confd/', '/node/'])"
  dependencies:
    - "Node: Build"
  task:
    agent:
      machine:
        type: s1-aws-arm64-2
    prologue:
      commands:
        - cd node
    jobs:
      - name: Build image
        commands:
          - ../.semaphore/run-and-monitor build-arm64.log make image ARCH=arm64
- name: "Node: kind-cluster tests"
  run:
    when: "${FORCE_RUN} or change_in(['/*', '/api/', '/libcalico-go/', '/typha/', '/felix/', '/confd/', '/bird/', '/pod2daemon/', '/node/', '/hack/test/certs/'], {exclude: ['/**/.gitignore', '/**/README.md', '/**/LICENSE']})"
  dependencies:
    - Prerequisites
  task:
    prologue:
      commands:
        - cd node
        - export GOOGLE_APPLICATION_CREDENTIALS=$HOME/secrets/secret.google-service-account-key.json
        - export SHORT_WORKFLOW_ID=$(echo ${SEMAPHORE_WORKFLOW_ID} | sha256sum | cut -c -8)
        - export ZONE=europe-west3-c
        - export VM_PREFIX=sem-${SEMAPHORE_PROJECT_NAME}-${SHORT_WORKFLOW_ID}-kind-
        - echo VM_PREFIX=${VM_PREFIX}
        - export REPO_NAME=$(basename $(pwd))
        - export VM_DISK_SIZE=80GB
        - mkdir artifacts
        - ../.semaphore/vms/create-test-vms ${ZONE} ${VM_PREFIX}
    jobs:
      - name: "Node: kind-cluster tests"
        execution_time_limit:
          minutes: 120
        commands:
          - ../.semaphore/vms/run-tests-on-vms ${ZONE} ${VM_PREFIX}
    epilogue:
      always:
        commands:
          - ../.semaphore/vms/publish-artifacts
          - ../.semaphore/vms/clean-up-vms ${ZONE} ${VM_PREFIX}
          - test-results publish ./report/*.xml --name "node-kind-tests" || true
    secrets:
      - name: google-service-account-for-gce
