Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge specialized PR workflows back into one configuration file #2363

Merged
merged 27 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c4eaf84
Attempt to simply docs only CI runs
Mpdreamz May 23, 2024
f056dc3
fix embedded yaml hopefully
Mpdreamz May 23, 2024
743858b
fix embedded yaml strings
Mpdreamz May 23, 2024
45f207c
fix variable subs
Mpdreamz May 23, 2024
b4dcfe4
fix output check
Mpdreamz May 23, 2024
6b3a162
use output
Mpdreamz May 23, 2024
6702a83
no negate
Mpdreamz May 23, 2024
5e0d91c
jobs => needs
Mpdreamz May 23, 2024
dc3ec7e
see if negate works
Mpdreamz May 23, 2024
7c17887
remove -docs for test-linux
Mpdreamz May 23, 2024
21c2f00
format should need changeset
Mpdreamz May 23, 2024
229f76a
make heavy integration tests dependend on unit tests
Mpdreamz May 23, 2024
ae73a08
undo negate again
Mpdreamz May 23, 2024
0c9c0d0
Move windows over to new checks
Mpdreamz May 23, 2024
f4089d1
pass secret explicitly since composite cannot inherit
Mpdreamz May 23, 2024
c78b35d
remove echo
Mpdreamz May 23, 2024
394abe6
format needs to run on windows
Mpdreamz May 23, 2024
f923620
re-enable IIS and make it docs aware as well
Mpdreamz May 23, 2024
e63b4ef
remove echo
Mpdreamz May 23, 2024
f3b101f
Apply suggestions from code review
Mpdreamz May 24, 2024
e1b1a36
Merge remote-tracking branch 'origin/main' into fix/simplify-docs-noo…
Mpdreamz May 28, 2024
cdb2e27
separate unit and integrations, since integrations currently has a ro…
Mpdreamz May 28, 2024
4ea74f5
revert back to -docs.yml to follow established company wide patterns
Mpdreamz Jun 4, 2024
f61d3a4
remove changeset composite action
Mpdreamz Jun 4, 2024
8e3531b
merge -iis and -windows
Mpdreamz Jun 4, 2024
ea2e7b9
fix yml indentation
Mpdreamz Jun 4, 2024
9972082
Update .github/workflows/test-windows.yml
Mpdreamz Jun 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/bootstrap/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,18 @@ inputs:
description: 'Install azure functions tool chain ("true" or "false")'
required: false
default: "false"
tc-cloud:
description: 'Bootstrap TestContainers Cloud (TOKEN or "false")'
required: false
default: "false"
outputs:
agent-version:
description: "The current agent version number"
value: ${{ steps.dotnet.outputs.agent-version }}
major-version:
description: "The current major version number, semver"
value: ${{ steps.dotnet.outputs.major-version }}


runs:
using: "composite"
Expand All @@ -27,7 +32,7 @@ runs:
run: |
git fetch --prune --unshallow --tags
git tag --list

- uses: actions/cache@v4
with:
path: ~/.nuget/packages
Expand Down Expand Up @@ -56,10 +61,11 @@ runs:

# Setup git config
- uses: elastic/apm-pipeline-library/.github/actions/setup-git@current

# install common dependencies
- name: Install common dependencies
uses: ./.github/workflows/install-dependencies
with:
rust: '${{ inputs.rust }}'
azure: '${{ inputs.azure }}'
tc-cloud: '${{ inputs.tc-cloud }}'
33 changes: 33 additions & 0 deletions .github/workflows/changeset/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Documentation Only Change Set
description: Checks if the proposed changes are only documentation changes

outputs:
docs-changes-only:
description: "True if only documentation file changed"
value: ${{ steps.changed-files.outputs.docs_any_changed == 'true' && steps.changed-files.outputs.not_docs_any_changed == 'false' }}
ci-changes-only:
description: "True if only ci files changed"
value: ${{ steps.changed-files.outputs.ci_any_changed == 'true' && steps.changed-files.outputs.not_ci_any_changed == 'false' }}

runs:
using: "composite"
steps:
- uses: tj-actions/changed-files@v44
name: 'Gets the current changeset'
id: changed-files
with:
files_yaml: |
doc:
- '*.md'
- '*.asciidoc'
- 'docs/**'
not_docs:
- '!*.md'
- '!*.asciidoc'
- '!docs/**'

ci:
- '.github/**'
not_ci:
- '!.github/**'
27 changes: 24 additions & 3 deletions .github/workflows/install-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ inputs:
required: false
default: "false"
azure:
description: 'Install azure functions tool chain ("true" or "false")'
required: false
default: "false"
description: 'Install azure functions tool chain ("true" or "false")'
required: false
default: "false"
tc-cloud:
description: 'Bootstrap TestContainers Cloud (TOKEN or "false")'
required: false
default: "false"

runs:
using: "composite"
Expand Down Expand Up @@ -55,3 +59,20 @@ runs:
shell: cmd
run: choco install azure-functions-core-tools -y --no-progress -r --version 4.0.4829

# TEST CONTAINERS CLOUD
# If no PR event or if a PR event that's caused by a non-fork and non dependabot actor
- name: Setup TestContainers Cloud Client
if: |
inputs.tc-cloud != 'false'
&& (github.event_name != 'pull_request'
|| (github.event_name == 'pull_request'
&& github.event.pull_request.head.repo.fork == false
&& github.actor != 'dependabot[bot]'
)
)
uses: atomicjar/testcontainers-cloud-setup-action@v1
with:
token: ${{ inputs.tc-cloud }}



33 changes: 0 additions & 33 deletions .github/workflows/test-linux-docs.yml

This file was deleted.

86 changes: 67 additions & 19 deletions .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,78 @@ on:
push:
branches:
- main
paths-ignore:
- '*.md'
- '*.asciidoc'
- 'docs/**'
pull_request:
paths-ignore:
- '*.md'
- '*.asciidoc'
- 'docs/**'

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: '${{ github.workflow }}-${{ github.ref }}'
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

defaults:
run:
shell: bash

env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages


# 'pack' & 'tests' are required checks in this workflow.

# To not burn unneeded CI cycles:
# - The 'changeset' job detects doc only changes and allows us to skip several jobs.
# - Our required checks will always succeed if doc only changes are detected.
# - all jobs depend on 'changeset' and 'format' to not waste cycles on quickly fixable errors.

jobs:

changeset:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: changeset
uses: ./.github/workflows/changeset

- name: 'changeset output'
run: "echo docs-changes-only: ${{ steps.changeset.outputs.docs-changes-only }}"
outputs:
docs-changes-only: ${{ steps.changeset.outputs.docs-changes-only }}
ci-changes-only: ${{ steps.changeset.outputs.ci-changes-only }}

format:
runs-on: ubuntu-latest
needs: [ 'changeset' ]
steps:
- run: 'echo "Skipping prerequisite step [format] because only doc changes are detected"'
if: ${{ needs.changeset.outputs.docs-changes-only == 'true' }}
- uses: actions/checkout@v4
if: ${{ needs.changeset.outputs.docs-changes-only == 'false' }}
- name: Bootstrap Action Workspace
if: ${{ needs.changeset.outputs.docs-changes-only == 'false' }}
uses: ./.github/workflows/bootstrap
- name: Format
if: ${{ needs.changeset.outputs.docs-changes-only == 'false' }}
run: ./build.sh format

#required step
pack:
runs-on: ubuntu-latest

needs: [ 'changeset', 'format' ]
steps:
- run: 'echo "Skipping required step [pack] because only doc changes are detected"'
if: ${{ needs.changeset.outputs.docs-changes-only == 'true' }}

- uses: actions/checkout@v4
if: ${{ needs.changeset.outputs.docs-changes-only == 'false' }}
- name: Bootstrap Action Workspace
if: ${{ needs.changeset.outputs.docs-changes-only == 'false' }}
uses: ./.github/workflows/bootstrap
with:
rust: 'true'

- name: Format
run: ./build.sh format

- name: Package
if: ${{ needs.changeset.outputs.docs-changes-only == 'false' }}
run: ./build.sh pack

- uses: actions/upload-artifact@v4
Expand All @@ -48,28 +85,38 @@ jobs:
path: build/output/*
retention-days: 1

#required step
tests:
runs-on: ubuntu-latest
needs: [ 'changeset', 'format' ]
timeout-minutes: 30

steps:
- run: 'echo "Skipping required step [tests] because only doc changes are detected"'
if: ${{ needs.changeset.outputs.docs-changes-only == 'true' }}

- uses: actions/checkout@v4
if: ${{ needs.changeset.outputs.docs-changes-only == 'false' }}
- name: Bootstrap Action Workspace
if: ${{ needs.changeset.outputs.docs-changes-only == 'false' }}
uses: ./.github/workflows/bootstrap

- name: Build
shell: bash
if: ${{ needs.changeset.outputs.docs-changes-only == 'false' }}
run: dotnet build -c Release --verbosity minimal

- name: 'Tests: Unit'
if: ${{ needs.changeset.outputs.docs-changes-only == 'false' }}
uses: ./.github/workflows/test
with:
name: 'unit'
filter: 'FullyQualifiedName!~Elastic.Apm.StartupHook.Tests&FullyQualifiedName!~Elastic.Apm.Profiler.Managed.Tests&FullyQualifiedName!~Elastic.Apm.Azure'

azure-tests:
runs-on: ubuntu-latest
if: ${{ false }}
needs: [ 'changeset', 'format', 'tests' ]
#TODO merge the two ifs again, the clean up is timing out
if: ${{ false && needs.changeset.outputs.docs-changes-only == 'false' }}
#if: |
# github.event_name != 'pull_request'
# || github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false
Expand All @@ -81,7 +128,6 @@ jobs:
azure: 'true'

- name: Build
shell: bash
run: dotnet build -c Release --verbosity minimal

- name: 'Read credentials'
Expand Down Expand Up @@ -118,7 +164,8 @@ jobs:

startup-hook-tests:
runs-on: ubuntu-latest

needs: [ 'changeset', 'format', 'tests' ]
if: ${{ needs.changeset.outputs.docs-changes-only == 'false' }}
steps:
- uses: actions/checkout@v4
- name: Bootstrap Action Workspace
Expand All @@ -136,7 +183,8 @@ jobs:

profiler-tests:
runs-on: ubuntu-latest

needs: [ 'changeset', 'format', 'tests' ]
if: ${{ needs.changeset.outputs.docs-changes-only }}
steps:
- uses: actions/checkout@v4
- name: Bootstrap Action Workspace
Expand Down
28 changes: 0 additions & 28 deletions .github/workflows/test-windows-docs.yml

This file was deleted.

Loading
Loading