name: build-and-test-windows on: push: branches: [ main ] tags: - 'v[0-9]+.[0-9]+.[0-9]+*' pull_request: env: TEST_RESULTS: testbed/tests/results/junit/results.xml # See: https://github.com/actions/cache/issues/810#issuecomment-1222550359 # Cache downloads for this workflow consistently run in under 10 minutes SEGMENT_DOWNLOAD_TIMEOUT_MIN: 15 concurrency: group: ${{ github.workflow }}-${{ github.head_ref }} cancel-in-progress: true jobs: setup-environment: runs-on: windows-latest if: ${{ github.actor != 'dependabot[bot]' }} steps: - name: Checkout Repo uses: actions/checkout@v3 - name: Setup Go uses: actions/setup-go@v3 with: go-version: 1.17 - name: Cache Go Mod id: go-mod-cache uses: actions/cache@v3 with: path: | ~\go\pkg\mod key: go-mod-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }} - name: Install dependencies if: steps.go-mod-cache.outputs.cache-hit != 'true' run: make -j2 gomoddownload windows-unittest-matrix: needs: [setup-environment] strategy: matrix: group: - receiver-0 - receiver-1 - processor - exporter - extension - internal - other runs-on: windows-latest if: ${{ github.actor != 'dependabot[bot]' }} steps: - name: Checkout Repo uses: actions/checkout@v3 - if: matrix.group == 'receiver-0' name: install IIS run: Install-WindowsFeature -name Web-Server -IncludeManagementTools - if: matrix.group == 'receiver-0' name: Install Active Directory DS run: Install-WindowsFeature -name AD-Domain-Services -IncludeManagementTools - name: Setup Go uses: actions/setup-go@v3 with: go-version: 1.19 - name: Cache Go id: go-mod-cache uses: actions/cache@v3 with: path: | ~\go\pkg\mod key: go-mod-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }} - name: Cache Go Build uses: actions/cache@v3 with: path: | ~\AppData\Local\go-build key: go-build-cache-${{ runner.os }}-${{ matrix.group }}-go-${{ hashFiles('**/go.sum') }} - name: Run Unit tests run: make gotest GROUP=${{ matrix.group }} windows-unittest: if: ${{ always() }} runs-on: windows-latest needs: [windows-unittest-matrix] steps: - name: Print result run: echo ${{ needs.windows-unittest-matrix.result }} - name: Interpret result shell: bash run: | if [[ success == ${{ needs.windows-unittest-matrix.result }} ]] then echo "All matrix jobs passed!" else echo "One or more matrix jobs failed." false fi