-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
183 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"). | ||
# You may not use this file except in compliance with the License. | ||
# A copy of the License is located at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# or in the "license" file accompanying this file. This file is distributed | ||
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
# express or implied. See the License for the specific language governing | ||
# permissions and limitations under the License. | ||
|
||
name: PR Build | ||
|
||
on: | ||
pull_request: | ||
branches: [ main ] | ||
|
||
env: | ||
IMAGE_NAME: aws-otel-collector | ||
PACKAGING_ROOT: build/packages | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Set up building environment, patch the dev repo code on dispatch events. | ||
- name: Set up Go 1.x | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ^1.13 | ||
|
||
- uses: actions/checkout@v2 | ||
|
||
# Unit Test and attach test coverage badge | ||
- name: Unit Test | ||
run: make test | ||
|
||
- name: Upload Coverage report to CodeCov | ||
uses: codecov/codecov-action@v1.0.12 | ||
with: | ||
file: ./coverage.txt | ||
|
||
# Build and archive binaries into cache. | ||
- name: Build Binaries | ||
run: make build | ||
|
||
- name: Cache binaries | ||
uses: actions/cache@v2 | ||
with: | ||
key: "cached_binaries_${{ github.run_id }}" | ||
path: build | ||
|
||
# upload the binaries to artifact as well because cache@v2 hasn't support windows | ||
- name: Upload | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: binary_artifacts | ||
path: build | ||
|
||
packaging-msi: | ||
needs: build | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Download built artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: binary_artifacts | ||
path: build | ||
|
||
- name: Display structure of downloaded files | ||
run: ls -R | ||
|
||
- name: Create msi file using candle and light | ||
run: .\tools\packaging\windows\create_msi.ps1 | ||
|
||
packaging-rpm: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
# Build and archive rpms into cache. | ||
- uses: actions/checkout@v2 | ||
|
||
- name: restore cached binaries | ||
uses: actions/cache@v2 | ||
with: | ||
key: "cached_binaries_${{ github.run_id }}" | ||
path: build | ||
|
||
- name: Display structure of downloaded files | ||
run: ls -R | ||
|
||
- name: Build RPM | ||
run: | | ||
ARCH=x86_64 DEST=build/packages/linux/amd64 tools/packaging/linux/create_rpm.sh | ||
ARCH=aarch64 DEST=build/packages/linux/arm64 tools/packaging/linux/create_rpm.sh | ||
packaging-deb: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
# Build and archive debs into cache. | ||
- uses: actions/checkout@v2 | ||
|
||
- name: restore cached binaries | ||
uses: actions/cache@v2 | ||
with: | ||
key: "cached_binaries_${{ github.run_id }}" | ||
path: build | ||
|
||
- name: Build Debs | ||
run: | | ||
ARCH=amd64 TARGET_SUPPORTED_ARCH=x86_64 DEST=build/packages/debian/amd64 tools/packaging/debian/create_deb.sh | ||
ARCH=arm64 TARGET_SUPPORTED_ARCH=aarch64 DEST=build/packages/debian/arm64 tools/packaging/debian/create_deb.sh | ||
get-test-cases: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v2.1.4 | ||
|
||
- name: Get all the testing suites | ||
id: set-matrix | ||
run: | | ||
matrix=$(python e2etest/get-testcases.py local_matrix) | ||
echo "::set-output name=matrix::$matrix" | ||
- name: List testing suites | ||
run: | | ||
echo ${{ steps.set-matrix.outputs.matrix }} | ||
run-test-case: | ||
runs-on: ubuntu-latest | ||
needs: [get-test-cases] | ||
strategy: | ||
matrix: ${{ fromJson(needs.get-test-cases.outputs.matrix) }} | ||
|
||
steps: | ||
- name: Check out testing framework | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: 'aws-observability/aws-otel-collector-test-framework' | ||
path: testing-framework | ||
|
||
- name: Check out Collector | ||
uses: actions/checkout@v2 | ||
with: | ||
path: aws-otel-collector | ||
|
||
- name: Set up JDK 1.11 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.11 | ||
|
||
- name: Set up terraform | ||
uses: hashicorp/setup-terraform@v1 | ||
|
||
- name: Run test | ||
run: | | ||
if [[ -f testing-framework/terraform/testcases/${{ matrix.testcase }}/parameters.tfvars ]] ; then opts="-var-file=../testcases/${{ matrix.testcase }}/parameters.tfvars" ; else opts="" ; fi | ||
cd testing-framework/terraform/mock && terraform init && terraform apply -auto-approve -var="testcase=../testcases/${{ matrix.testcase }}" $opts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters