Skip to content

[chore] test both amd64 and arm64 archs #498

[chore] test both amd64 and arm64 archs

[chore] test both amd64 and arm64 archs #498

Workflow file for this run

name: build
on:
push:
branches:
- main
tags:
- ".*"
pull_request:
permissions:
contents: read
jobs:
build-package:
runs-on: ${{ matrix.ARCH == 'amd64' && 'ubuntu-24.04' || 'ubuntu-24.04-arm' }}
strategy:
matrix:
SYS_PACKAGE: [ "deb", "rpm" ]
ARCH: [ "amd64", "arm64"]
steps:
- name: Check out the codebase.
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # v2.0.5
with:
# maintenance note: This version needs to be kept in sync with the version referenced in the file /zig-version
# in the root of the repository.
version: 0.14.1
- name: lint source code
run: |
make lint
- name: Run Zig unit tests
run: make zig-unit-tests ARCH=${{ matrix.ARCH }}
- name: Run Injector integration tests
run: make injector-integration-tests-for-one-architecture ARCH=${{ matrix.ARCH }}
# TODO I think we should split the build-package job at this point. Everything above is independent of SYS_PACKAGE.
# In particular the make injector-integration-tests-for-one-architecture ARCH=${{ matrix.ARCH }} step is not
# super cheap and right now we are running it twice for each CPU arch, once for deb and once for rpm, although
# it is independent of SYS_PACKAGE. The remaining steps below should be a separate job (named build-and-upload
# package) and the steps above should be a job named run-tests or verify or something like that.
# However, I'll leave that to a separate follow up PR.
- name: Determine version
id: github_tag
run: |
TAG="${GITHUB_REF##*/}"
if [[ -z "$TAG" ]]
then
echo "version=$TAG" >> $GITHUB_OUTPUT
else
echo "version=dev" >> $GITHUB_OUTPUT
fi
- name: Build ${{ matrix.ARCH }} ${{ matrix.SYS_PACKAGE }} package
run: make ${{ matrix.SYS_PACKAGE }}-package ARCH="${{ matrix.ARCH }}" VERSION="${{ steps.github_tag.version.version }}"
- name: Upload artifact
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: otelinject-${{ matrix.ARCH }}-${{ matrix.SYS_PACKAGE }}
path: ./instrumentation/dist/*.${{ matrix.SYS_PACKAGE }}
packaging-integration-tests:
strategy:
matrix:
SYS_PACKAGE: [ "deb", "rpm" ]
lang: [ "java", "nodejs", "dotnet" ]
arch: [ "amd64", "arm64" ]
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-24.04' || 'ubuntu-24.04-arm' }}
steps:
- name: Check out the codebase.
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
# TODO we currently build the RPM and DEB for at least once CPU architectures twice, once in the build-package job
# in the step "Build ${{ matrix.ARCH }} ${{ matrix.SYS_PACKAGE }} package", and once here in the context of
# running the packacking integration tests. We should run the packaging integration tests for both CPU
# architectures (instead of only amd64), but ideally only build each combination of CPU arch & SYS_PACKAGE once.
- name: Run packaging integration tests for ${{ matrix.SYS_PACKAGE }}/${{ matrix.lang }}/${{ matrix.arch }}
run: ARCH=${{ matrix.arch }} make packaging-integration-test-${{ matrix.SYS_PACKAGE }}-${{ matrix.lang }}
publish-stable:
runs-on: ubuntu-24.04
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'open-telemetry/opentelemetry-injector'
needs: build-package
permissions:
contents: write
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- run: mkdir -p artifacts
- name: Download artifacts
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
path: ./artifacts/
- name: Prepare release notes
run: ./.github/workflows/scripts/prepare-release-notes.sh
env:
RELEASE_TAG: ${{ steps.github_tag.outputs.tag }}
- name: Release
uses: softprops/action-gh-release@6da8fa9354ddfdc4aeace5fc48d7f679b5214090 # v2.4.1
with:
body_path: release-notes.md
files: |
artifacts/*