-
Notifications
You must be signed in to change notification settings - Fork 29
Refactor CI build #328
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
Merged
Merged
Refactor CI build #328
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,96 @@ | ||
| name: Reusable - Common | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| cache-read-only: | ||
| type: boolean | ||
| required: false | ||
| no-build-cache: | ||
| type: boolean | ||
| required: false | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: | ||
| - macos-latest | ||
| - macos-13 | ||
| - ubuntu-latest | ||
| test-java-version: | ||
| - 8 | ||
| - 11 | ||
| - 17 | ||
| - 21 | ||
| - 25 # renovate: datasource=java-version | ||
| # macos-latest drops support for java 8 temurin. Run java 8 on macos-13. Run java 11+ on macos-latest. | ||
| exclude: | ||
| - os: macos-latest | ||
| test-java-version: 8 | ||
| - os: macos-13 | ||
| test-java-version: 11 | ||
| - os: macos-13 | ||
| test-java-version: 17 | ||
| - os: macos-13 | ||
| test-java-version: 21 | ||
| - os: macos-13 | ||
| test-java-version: 25 # renovate: datasource=java-version | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
|
|
||
| - id: setup-java-test | ||
| name: Set up Java ${{ matrix.test-java-version }} for tests | ||
| uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 | ||
| with: | ||
| distribution: temurin | ||
| java-version: ${{ matrix.test-java-version }} | ||
|
|
||
| - id: setup-java | ||
| name: Set up Java for build | ||
| uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 | ||
| with: | ||
| distribution: temurin | ||
| java-version: 17 | ||
|
|
||
| - uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0 | ||
|
|
||
| - name: build | ||
| run: > | ||
| ./gradlew | ||
| build | ||
| -PtestJavaVersion=${{ matrix.test-java-version }} | ||
| -Porg.gradle.java.installations.paths=${{ steps.setup-java-test.outputs.path }},${{ steps.setup-java.outputs.path }} | ||
| - name: generate | ||
| # Skip running on macos-latest which doesn't have docker | ||
| if: matrix.os == 'ubuntu-latest' | ||
| run: ./gradlew generateSemanticConventions --console=plain | ||
|
|
||
| # Run spotless after generate to format generated code | ||
| - name: spotless | ||
| run: ./gradlew spotlessApply | ||
|
|
||
| - name: Check for diff | ||
| run: | | ||
| # need to "git add" in case any generated files did not already exist | ||
| # select files from both /semconv and /semconv-incubating | ||
| git add semconv** | ||
| if git diff --cached --quiet | ||
| then | ||
| echo "No diff detected." | ||
| else | ||
| echo "Diff detected - did you run './gradlew generateSemanticConventions spotlessApply'?" | ||
| echo $(git diff --cached --name-only) | ||
| echo $(git diff --cached) | ||
| exit 1 | ||
| fi | ||
|
|
||
| misspell-check: | ||
| uses: ./.github/workflows/reusable-misspell-check.yml | ||
This file contains hidden or 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,31 @@ | ||
| name: Build Pull Request | ||
|
|
||
| on: | ||
| pull_request: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| common: | ||
| uses: ./.github/workflows/build-common.yml | ||
| with: | ||
| cache-read-only: true | ||
|
|
||
| link-check: | ||
| uses: ./.github/workflows/reusable-link-check.yml | ||
|
|
||
| required-status-check: | ||
| if: always() | ||
| needs: | ||
| - common | ||
| - link-check # wait for link check to complete, but don't require it to pass for merging | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| # The reusable workflow success depends on all its jobs passing | ||
| - if: needs.common.result != 'success' | ||
| run: exit 1 # fail |
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -4,115 +4,12 @@ on: | |
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| - release/* | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. build wasn't running on push to release branch previously |
||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: | ||
| - macos-latest | ||
| - macos-13 | ||
| - ubuntu-latest | ||
| test-java-version: | ||
| - 8 | ||
| - 11 | ||
| - 17 | ||
| - 21 | ||
| - 25 # renovate: datasource=java-version | ||
| # macos-latest drops support for java 8 temurin. Run java 8 on macos-13. Run java 11+ on macos-latest. | ||
| exclude: | ||
| - os: macos-latest | ||
| test-java-version: 8 | ||
| - os: macos-13 | ||
| test-java-version: 11 | ||
| - os: macos-13 | ||
| test-java-version: 17 | ||
| - os: macos-13 | ||
| test-java-version: 21 | ||
| - os: macos-13 | ||
| test-java-version: 25 # renovate: datasource=java-version | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
|
|
||
| - id: setup-java-test | ||
| name: Set up Java ${{ matrix.test-java-version }} for tests | ||
| uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 | ||
| with: | ||
| distribution: temurin | ||
| java-version: ${{ matrix.test-java-version }} | ||
|
|
||
| - id: setup-java | ||
| name: Set up Java for build | ||
| uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 | ||
| with: | ||
| distribution: temurin | ||
| java-version: 17 | ||
|
|
||
| - uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0 | ||
|
|
||
| - name: build | ||
| run: > | ||
| ./gradlew | ||
| build | ||
| -PtestJavaVersion=${{ matrix.test-java-version }} | ||
| -Porg.gradle.java.installations.paths=${{ steps.setup-java-test.outputs.path }},${{ steps.setup-java.outputs.path }} | ||
|
|
||
| - name: generate | ||
| # Skip running on macos-latest which doesn't have docker | ||
| if: matrix.os == 'ubuntu-latest' | ||
| run: ./gradlew generateSemanticConventions --console=plain | ||
|
|
||
| # Run spotless after generate to format generated code | ||
| - name: spotless | ||
| run: ./gradlew spotlessApply | ||
|
|
||
| - name: Check for diff | ||
| run: | | ||
| # need to "git add" in case any generated files did not already exist | ||
| # select files from both /semconv and /semconv-incubating | ||
| git add semconv** | ||
| if git diff --cached --quiet | ||
| then | ||
| echo "No diff detected." | ||
| else | ||
| echo "Diff detected - did you run './gradlew generateSemanticConventions spotlessApply'?" | ||
| echo $(git diff --cached --name-only) | ||
| echo $(git diff --cached) | ||
| exit 1 | ||
| fi | ||
|
|
||
| link-check: | ||
| # release branches are excluded to avoid unnecessary maintenance | ||
| if: ${{ !startsWith(github.ref_name, 'release/') }} | ||
| uses: ./.github/workflows/reusable-link-check.yml | ||
|
|
||
| misspell-check: | ||
| # release branches are excluded to avoid unnecessary maintenance | ||
| if: ${{ !startsWith(github.ref_name, 'release/') }} | ||
| uses: ./.github/workflows/reusable-misspell-check.yml | ||
|
|
||
| required-status-check: | ||
| # markdown-link-check is not required so pull requests are not blocked if external links break | ||
| # misspell-check is not required so pull requests are not blocked if the misspell dictionary is | ||
| # updated | ||
| needs: | ||
| - build | ||
| runs-on: ubuntu-latest | ||
| if: always() | ||
| steps: | ||
| - if: | | ||
| needs.build.result != 'success' | ||
| run: exit 1 | ||
| common: | ||
| uses: ./.github/workflows/build-common.yml | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -6,10 +6,15 @@ permissions: | |
| contents: read | ||
|
|
||
| jobs: | ||
| build: | ||
| uses: ./.github/workflows/build-common.yml | ||
|
Comment on lines
+9
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and release workflow wasn't running build |
||
|
|
||
| release: | ||
| permissions: | ||
| contents: write # for creating the release | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - build | ||
| outputs: | ||
| version: ${{ steps.create-github-release.outputs.version }} | ||
| prior-version: ${{ steps.create-github-release.outputs.prior-version }} | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for this project building and testing on different oses and java versions might be an overkill
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I'll send a follow-up to remove the different OSes at least