General enhancements (#390) #705
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
name: ci | |
on: | |
pull_request: | |
paths-ignore: | |
- "**/*.asciidoc" | |
- "**/*.md" | |
- "**/*.png" | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "**/*.asciidoc" | |
- "**/*.md" | |
- "**/*.png" | |
permissions: | |
contents: read | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup | |
- name: lint | |
run: ./gradlew lint | |
- name: Verify OSS compliance | |
run: ./gradlew verifyNoticeFile | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/setup | |
- name: Build | |
run: ./gradlew assemble | |
- name: Checks and unit tests | |
run: ./checks.sh | |
- name: Enable KVM for Android tests | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- name: Android tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 29 | |
script: ./android_tests.sh | |
- name: Store test results | |
if: success() || failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results | |
path: | | |
**/build/test-results/testRelease*/TEST-*.xml | |
**/build/test-results/test/TEST-*.xml | |
**/build/outputs/androidTest-results/**/TEST-*.xml | |
# The very last job to report whether the Workflow passed. | |
# This will act as the Branch Protection gatekeeper | |
ci: | |
if: always() | |
runs-on: ubuntu-latest | |
needs: | |
- lint | |
- test | |
steps: | |
- id: check | |
uses: elastic/oblt-actions/check-dependent-jobs@v1 | |
with: | |
jobs: ${{ toJSON(needs) }} | |
- run: ${{ steps.check.outputs.is-success }} | |
test-release: | |
runs-on: ubuntu-latest | |
if: github.event_name != 'pull_request' | |
permissions: | |
attestations: write | |
contents: write | |
id-token: write | |
env: | |
TARBALL_FILE: dist.tar | |
steps: | |
- id: buildkite-run | |
name: Run Release dry-run | |
uses: elastic/oblt-actions/buildkite/run@v1 | |
with: | |
branch: ${{ github.ref_name }} | |
pipeline: "apm-agent-android-release" | |
token: ${{ secrets.BUILDKITE_TOKEN }} | |
wait-for: true | |
env-vars: | | |
branch_specifier=${{ github.ref_name }} | |
target_specifier=all | |
dry_run=true | |
TARBALL_FILE=${{ env.TARBALL_FILE }} | |
- uses: elastic/oblt-actions/buildkite/download-artifact@v1 | |
with: | |
build-number: ${{ steps.buildkite-run.outputs.number }} | |
path: ${{ env.TARBALL_FILE }} | |
pipeline: ${{ steps.buildkite-run.outputs.pipeline }} | |
token: ${{ secrets.BUILDKITE_TOKEN }} | |
- name: untar the buildkite tarball | |
run: tar xvf ${{ env.TARBALL_FILE }} | |
- name: generate build provenance (jar files) | |
uses: actions/attest-build-provenance@520d128f165991a6c774bcb264f323e3d70747f4 # v2.2.0 | |
with: | |
subject-path: "${{ github.workspace }}/**/build/libs/*.jar" | |
- name: generate build provenance (aar files) | |
uses: actions/attest-build-provenance@520d128f165991a6c774bcb264f323e3d70747f4 # v2.2.0 | |
with: | |
subject-path: "${{ github.workspace }}/**/build/outputs/aar/*.aar" |