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

ci: adds lint check, fixes yaml formatting and unnecessary auth #263

Merged
merged 2 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 14 additions & 15 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# yamllint --format github .github/workflows/create_release.yml
---
name: create_release

# We create a release version on a trigger tag, regardless of if the commit is documentation-only.
#
# See https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
on:
# We create a release version on a trigger tag, regardless of if the commit is
# documentation-only.
on: # yamllint disable-line rule:truthy
push:
tags: 'release-[0-9]+.[0-9]+.[0-9]+**' # Ex. release-1.2.3
tags: # e.g. release-1.2.3
- 'release-[0-9]+.[0-9]+.[0-9]+**'

jobs:
create_release:
Expand All @@ -16,28 +15,28 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4
with:
# Prevent use of implicit GitHub Actions read-only token GITHUB_TOKEN. We don't deploy on
# the tag MAJOR.MINOR.PATCH event, but we still need to deploy the maven-release-plugin master commit.
# Prevent use of implicit GitHub Actions read-only GITHUB_TOKEN
# because maven-release-plugin pushes commits to master.
token: ${{ secrets.GH_TOKEN }}
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'zulu' # zulu as it supports a wide version range
java-version: '11' # earliest LTS and last that can compile the 1.6 release profile.
java-version: '11' # last that can compile the 1.6 release profile
- name: Cache local Maven repository
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
key: ${{ runner.os }}-jdk-11-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-jdk-11-maven-
- name: Create Release
env:
# GH_USER=<user that created GH_TOKEN>
GH_USER: ${{ secrets.GH_USER }}
# GH_TOKEN=<hex token value>
# - makes release commits and tags
# - needs repo:status, public_repo
# - referenced in .settings.xml
# * makes release commits and tags
# * needs repo:status, public_repo
# * referenced in .settings.xml
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: | # GITHUB_REF will be refs/tags/release-MAJOR.MINOR.PATCH
build-bin/git/login_git &&
Expand Down
42 changes: 20 additions & 22 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ name: deploy

# We deploy on master and release versions, regardless of if the commit is
# documentation-only or not.
#
# See https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
on:
on: # yamllint disable-line rule:truthy
push:
# Don't deploy tags as they conflict with [maven-release-plugin] prepare release MAJOR.MINOR.PATCH
tags: ''
branches: master
branches:
- master
# Don't deploy tags because the same commit for MAJOR.MINOR.PATCH is also
# on master: Redundant deployment of a release version will fail uploading.
tags-ignore:
- '*'

jobs:
deploy:
Expand All @@ -22,42 +23,39 @@ jobs:
include:
- name: jars
deploy_script: build-bin/deploy
# Deploy the Bill of Materials (BOM) separately as it is unhooked from the main project intentionally
# Deploy the Bill of Materials (BOM) separately as it is unhooked
# from the main project intentionally.
- name: bom
deploy_script: build-bin/deploy_bom
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
# Prevent use of implicit GitHub Actions read-only token GITHUB_TOKEN.
# We push Javadocs to the gh-pages branch on commit.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was a lie, as in this repo we don't!

token: ${{ secrets.GH_TOKEN }}
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'zulu' # zulu as it supports a wide version range
java-version: '11' # earliest LTS and last that can compile the 1.6 release profile.
java-version: '11' # last that can compile the 1.6 release profile
- name: Cache local Maven repository
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
key: ${{ runner.os }}-jdk-11-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-jdk-11-maven-
- name: Deploy
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
# GPG_PASSPHRASE=<passphrase for GPG_SIGNING_KEY>
# - referenced in .settings.xml
# * referenced in .settings.xml
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
# SONATYPE_USER=<sonatype account token>
# - deploys snapshots and releases to Sonatype
# - needs access to io.zipkin via https://issues.sonatype.org/browse/OSSRH-16669
# - generate via https://oss.sonatype.org/#profile;User%20Token
# - referenced in .settings.xml
# * deploys snapshots and releases to Sonatype
# * needs access to io.zipkin via OSSRH-16669
# * generate via https://oss.sonatype.org/#profile;User%20Token
# * referenced in .settings.xml
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
# SONATYPE_PASSWORD=<password to sonatype account token>
# - referenced in .settings.xml
# * referenced in .settings.xml
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: | # GITHUB_REF will be refs/heads/master or refs/tags/MAJOR.MINOR.PATCH
run: | # GITHUB_REF = refs/heads/master or refs/tags/MAJOR.MINOR.PATCH
build-bin/configure_deploy &&
${{ matrix.deploy_script }} $(echo ${GITHUB_REF} | cut -d/ -f 3)
36 changes: 36 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: lint

on: # yamllint disable-line rule:truthy
push: # non-tagged pushes to master
branches:
- master
tags-ignore:
- '*'
paths:
- '**/*.md'
- '.github/workflows/*.yml'
- './build-bin/*lint'
- ./build-bin/mlc_config.json
pull_request: # pull requests targeted at the master branch.
branches:
- master
paths:
- '**/*.md'
- '.github/workflows/*.yml'
- './build-bin/*lint'
- ./build-bin/mlc_config.json

jobs:
lint:
name: Lint
runs-on: ubuntu-22.04 # newest available distribution, aka jellyfish
# skip commits made by the release plugin
if: "!contains(github.event.head_commit.message, 'maven-release-plugin')"
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Lint
run: |
build-bin/configure_lint
build-bin/lint
65 changes: 26 additions & 39 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,38 @@
# yamllint --format github .github/workflows/test.yml
---
name: test

# We don't test documentation-only commits.
on:
# We run tests on non-tagged pushes to master that aren't a commit made by the release plugin
push:
tags: ''
branches: master
paths-ignore: '**/*.md'
# We also run tests on pull requests targeted at the master branch.
pull_request:
branches: master
paths-ignore: '**/*.md'
on: # yamllint disable-line rule:truthy
push: # non-tagged pushes to master
branches:
- master
tags-ignore:
- '*'
paths-ignore:
- '**/*.md'
- './build-bin/*lint'
- ./build-bin/mlc_config.json
pull_request: # pull requests targeted at the master branch.
branches:
- master
paths-ignore:
- '**/*.md'
- './build-bin/*lint'
- ./build-bin/mlc_config.json

jobs:
test-javadoc:
name: Test JavaDoc Builds
runs-on: ubuntu-22.04 # newest available distribution, aka jellyfish
if: "!contains(github.event.head_commit.message, 'maven-release-plugin')"
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'zulu' # zulu as it supports a wide version range
java-version: '11' # earliest LTS and last that can compile the 1.6 release profile.
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-jdk-11-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-jdk-11-maven-
- name: Build JavaDoc
run: ./mvnw clean javadoc:aggregate -Prelease

test:
name: test (JDK ${{ matrix.java_version }})
runs-on: ubuntu-22.04 # newest available distribution, aka jellyfish
runs-on: ubuntu-22.04 # newest available distribution, aka jellyfish
# skip commits made by the release plugin
if: "!contains(github.event.head_commit.message, 'maven-release-plugin')"
strategy:
fail-fast: false # don't fail fast as sometimes failures are operating system specific
matrix: # use latest available versions and be consistent on all workflows!
fail-fast: false # don't fail fast as some failures are LTS specific
matrix: # match with maven-enforcer-plugin rules in pom.xml
include:
- java_version: 11 # Last that can compile zipkin-reporter to 1.6 for Brave
maven_args: -Prelease -Dgpg.skip -Dmaven.javadoc.skip=true
- java_version: 21 # Most recent LTS
- java_version: '11' # last that can compile the 1.6 release profile
maven_args: -Prelease -Dgpg.skip
- java_version: '21' # Most recent LTS
steps:
- name: Checkout Repository
uses: actions/checkout@v4
Expand All @@ -56,9 +42,10 @@ jobs:
distribution: 'zulu' # zulu as it supports a wide version range
java-version: ${{ matrix.java_version }}
- name: Cache local Maven repository
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.m2/repository
# yamllint disable-line rule:line-length
key: ${{ runner.os }}-jdk-${{ matrix.java_version }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-jdk-${{ matrix.java_version }}-maven-
# Don't attempt to cache Docker. Sensitive information can be stolen
Expand Down
Loading