Skip to content

Commit

Permalink
ci: add boringcrypto support to the test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikołaj Świątek committed Jun 21, 2023
1 parent bc8406f commit 34e8612
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 45 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/dev_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ jobs:
include:
- arch_os: linux_amd64
runs-on: ubuntu-20.04
- arch_os: linux_amd64
runs-on: ubuntu-20.04
boringcrypto: true
- arch_os: darwin_amd64
runs-on: macos-latest
- arch_os: windows_amd64
Expand All @@ -79,6 +82,7 @@ jobs:
arch_os: ${{ matrix.arch_os }}
runs-on: ${{ matrix.runs-on }}
save-cache: true
boringcrypto: ${{ matrix.boringcrypto == true }}

build:
name: Build
Expand Down
46 changes: 4 additions & 42 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ jobs:
include:
- arch_os: linux_amd64
runs-on: ubuntu-20.04
- arch_os: linux_amd64
runs-on: ubuntu-20.04
boringcrypto: true
- arch_os: darwin_amd64
runs-on: macos-latest
- arch_os: windows_amd64
Expand All @@ -132,6 +135,7 @@ jobs:
arch_os: ${{ matrix.arch_os }}
runs-on: ${{ matrix.runs-on }}
only-if-changed: true
boringcrypto: ${{ matrix.boringcrypto == true }}

test-install-script:
name: Test Install Script
Expand Down Expand Up @@ -167,48 +171,6 @@ jobs:
if: steps.changed-files.outputs.any_changed == 'true'
run: make test-install-script


# pipeline to test using Go+BoringCrypto
test-go-boringcrypto:
name: Test BoringCrypto
runs-on: ${{ matrix.runs_on }}
strategy:
matrix:
include:
- arch_os: linux_amd64
runs_on: ubuntu-20.04
steps:
- uses: actions/checkout@v3

- name: Check if test related files changed
id: changed-files
uses: tj-actions/changed-files@v35
with:
files: |
**/go.mod
**/go.sum
**/*.go
**/*.yaml
**/*.yml
**/Makefile
**/Makefile.common
scripts/install.sh
- name: Setup go
if: steps.changed-files.outputs.any_changed == 'true'
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: '**/go.sum'

- name: Add opentelemetry-collector-builder installation dir to PATH
if: steps.changed-files.outputs.any_changed == 'true'
run: echo "$HOME/bin" >> $GITHUB_PATH

- name: Run tests
if: steps.changed-files.outputs.any_changed == 'true'
run: make gotest CGO_ENABLED=1 GOEXPERIMENT=boringcrypto

test-wixext:
name: Test (SumoLogic.wixext)
runs-on: windows-2019
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/workflow-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
description: Architecture and OS in the form "{arch}_{os}". See GOARCH and GOOS for accepted values.
default: linux_amd64
type: string
boringcrypto:
description: Run with BoringCrypto enabled
default: false
type: boolean
runs-on:
default: ubuntu-20.04
type: string
Expand All @@ -30,6 +34,8 @@ jobs:
test:
name: Test
runs-on: ${{ inputs.runs-on }}
env:
BORINGCRYPTO_SUFFIX: ${{ inputs.boringcrypto && '-boringcrypto' || '' }}
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -64,8 +70,8 @@ jobs:
id: get-cache-key
if: ${{ ! inputs.only-if-changed || steps.changed-files.outputs.any_changed == 'true' }}
run: |
echo "cache-key=go-test-${{ env.GO_VERSION }}-${{inputs.arch_os}}${BORINGCRYPTO_SUFFIX}-${{ hashFiles('pkg/**/go.sum', 'otelcolbuilder/.otelcol-builder.yaml') }}" >> $GITHUB_OUTPUT
echo "restore-keys=go-test-${{ env.GO_VERSION }}-${{inputs.arch_os}}${BORINGCRYPTO_SUFFIX}-" >> $GITHUB_OUTPUT
echo "cache-key=go-test-${{ env.GO_VERSION }}${BORINGCRYPTO_SUFFIX}-${{inputs.arch_os}}-${{ hashFiles('pkg/**/go.sum', 'otelcolbuilder/.otelcol-builder.yaml') }}" >> $GITHUB_OUTPUT
echo "restore-keys=go-test-${{ env.GO_VERSION }}${BORINGCRYPTO_SUFFIX}-${{inputs.arch_os}}-" >> $GITHUB_OUTPUT
- uses: actions/cache/restore@v3
if: ${{ ! inputs.only-if-changed || steps.changed-files.outputs.any_changed == 'true' }}
Expand All @@ -87,7 +93,7 @@ jobs:

- name: Run package tests
if: ${{ ! inputs.only-if-changed || steps.changed-files.outputs.any_changed == 'true' }}
run: make gotest
run: make gotest ${{ inputs.boringcrypto && 'CGO_ENABLED=1 GOEXPERIMENT=boringcrypto' || '' }}

- uses: actions/cache/save@v3
if: ${{ inputs.save-cache && (! inputs.only-if-changed || steps.changed-files.outputs.any_changed == 'true') }}
Expand Down

0 comments on commit 34e8612

Please sign in to comment.