Skip to content

Commit 079e79f

Browse files
Adds lint workflow for yaml and link checking (#228)
originally added here openzipkin/zipkin-gcp#212 Signed-off-by: Adrian Cole <[email protected]>
1 parent 4ac65b2 commit 079e79f

File tree

10 files changed

+181
-96
lines changed

10 files changed

+181
-96
lines changed

.github/workflows/create_release.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
# yamllint --format github .github/workflows/create_release.yml
21
---
32
name: create_release
43

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

1211
jobs:
1312
create_release:
@@ -16,8 +15,8 @@ jobs:
1615
- name: Checkout Repository
1716
uses: actions/checkout@v4
1817
with:
19-
# Prevent use of implicit GitHub Actions read-only token GITHUB_TOKEN. We don't deploy on
20-
# the tag MAJOR.MINOR.PATCH event, but we still need to deploy the maven-release-plugin master commit.
18+
# Prevent use of implicit GitHub Actions read-only GITHUB_TOKEN
19+
# because maven-release-plugin pushes commits to master.
2120
token: ${{ secrets.GH_TOKEN }}
2221
- name: Setup java
2322
uses: actions/setup-java@v4
@@ -28,16 +27,16 @@ jobs:
2827
uses: actions/cache@v3
2928
with:
3029
path: ~/.m2/repository
31-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
32-
restore-keys: ${{ runner.os }}-maven-
30+
key: ${{ runner.os }}-jdk-17-maven-${{ hashFiles('**/pom.xml') }}
31+
restore-keys: ${{ runner.os }}-jdk-17-maven-
3332
- name: Create Release
3433
env:
3534
# GH_USER=<user that created GH_TOKEN>
3635
GH_USER: ${{ secrets.GH_USER }}
3736
# GH_TOKEN=<hex token value>
38-
# - makes release commits and tags
39-
# - needs repo:status, public_repo
40-
# - referenced in .settings.xml
37+
# * makes release commits and tags
38+
# * needs repo:status, public_repo
39+
# * referenced in .settings.xml
4140
GH_TOKEN: ${{ secrets.GH_TOKEN }}
4241
run: | # GITHUB_REF will be refs/tags/release-MAJOR.MINOR.PATCH
4342
build-bin/git/login_git &&

.github/workflows/deploy.yml

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,21 @@ name: deploy
44

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

1516
jobs:
1617
deploy:
1718
runs-on: ubuntu-22.04 # newest available distribution, aka jellyfish
1819
steps:
1920
- name: Checkout Repository
2021
uses: actions/checkout@v4
21-
with:
22-
# Prevent use of implicit GitHub Actions read-only token GITHUB_TOKEN.
23-
# We push Javadocs to the gh-pages branch on commit.
24-
token: ${{ secrets.GH_TOKEN }}
2522
- name: Setup java
2623
uses: actions/setup-java@v4
2724
with:
@@ -31,8 +28,8 @@ jobs:
3128
uses: actions/cache@v3
3229
with:
3330
path: ~/.m2/repository
34-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
35-
restore-keys: ${{ runner.os }}-maven-
31+
key: ${{ runner.os }}-jdk-17-maven-${{ hashFiles('**/pom.xml') }}
32+
restore-keys: ${{ runner.os }}-jdk-17-maven-
3633
# Don't attempt to cache Docker. Sensitive information can be stolen
3734
# via forks, and login session ends up in ~/.docker. This is ok because
3835
# we publish DOCKER_PARENT_IMAGE to ghcr.io, hence local to the runner.
@@ -41,31 +38,30 @@ jobs:
4138
# GH_USER=<user that created GH_TOKEN>
4239
GH_USER: ${{ secrets.GH_USER }}
4340
# GH_TOKEN=<hex token value>
44-
# - pushes gh-pages during build-bin/javadoc_to_gh_pages
45-
# - pushes Docker images to ghcr.io
46-
# - create via https://github.com/settings/tokens
47-
# - needs repo:status, public_repo, write:packages, delete:packages
41+
# * pushes gh-pages during build-bin/javadoc_to_gh_pages
42+
# * pushes Docker images to ghcr.io
43+
# * create via https://github.com/settings/tokens
44+
# * needs repo:status, public_repo, write:packages, delete:packages
4845
GH_TOKEN: ${{ secrets.GH_TOKEN }}
4946
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
5047
# GPG_PASSPHRASE=<passphrase for GPG_SIGNING_KEY>
51-
# - referenced in .settings.xml
48+
# * referenced in .settings.xml
5249
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
5350
# SONATYPE_USER=<sonatype account token>
54-
# - deploys snapshots and releases to Sonatype
55-
# - needs access to io.zipkin via https://issues.sonatype.org/browse/OSSRH-16669
56-
# - generate via https://oss.sonatype.org/#profile;User%20Token
57-
# - referenced in .settings.xml
51+
# * deploys snapshots and releases to Sonatype
52+
# * needs access to io.zipkin via OSSRH-16669
53+
# * generate via https://oss.sonatype.org/#profile;User%20Token
54+
# * referenced in .settings.xml
5855
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
5956
# SONATYPE_PASSWORD=<password to sonatype account token>
60-
# - referenced in .settings.xml
57+
# * referenced in .settings.xml
6158
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
6259
# DOCKERHUB_USER=<typically dockerzipkindeployer>
63-
# - only push top-level projects: zipkin zipkin-aws zipkin-dependencies zipkin-gcp to Docker Hub, only on release
64-
# - login like this: echo "$DOCKERHUB_TOKEN"| docker login -u "$DOCKERHUB_USER" --password-stdin
60+
# * only push repos in openzipkin org to Docker Hub on release
6561
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
6662
# DOCKERHUB_TOKEN=<access token for DOCKERHUB_USER>
67-
# - Access Token from here https://hub.docker.com/settings/security
63+
# * Access Token from here https://hub.docker.com/settings/security
6864
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
69-
run: | # GITHUB_REF will be refs/heads/master or refs/tags/MAJOR.MINOR.PATCH
65+
run: | # GITHUB_REF = refs/heads/master or refs/tags/MAJOR.MINOR.PATCH
7066
build-bin/configure_deploy &&
7167
build-bin/deploy $(echo ${GITHUB_REF} | cut -d/ -f 3)

.github/workflows/docker_push.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
# yamllint --format github .github/workflows/docker_push.yml
21
---
32
name: docker_push
43

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

1211
jobs:
1312
docker_push:
@@ -19,22 +18,21 @@ jobs:
1918
# via forks, and login session ends up in ~/.docker. This is ok because
2019
# we publish DOCKER_PARENT_IMAGE to ghcr.io, hence local to the runner.
2120
- name: Docker Push
22-
run: | # GITHUB_REF will be refs/tags/docker-MAJOR.MINOR.PATCH
21+
run: | # GITHUB_REF = refs/tags/docker-MAJOR.MINOR.PATCH
2322
build-bin/git/login_git &&
2423
build-bin/docker/configure_docker_push &&
2524
build-bin/docker_push $(echo ${GITHUB_REF} | cut -d/ -f 3)
2625
env:
2726
# GH_USER=<user that created GH_TOKEN>
2827
GH_USER: ${{ secrets.GH_USER }}
2928
# GH_TOKEN=<hex token value>
30-
# - pushes Docker images to ghcr.io
31-
# - create via https://github.com/settings/tokens
32-
# - needs repo:status, public_repo, write:packages, delete:packages
29+
# * pushes Docker images to ghcr.io
30+
# * create via https://github.com/settings/tokens
31+
# * needs repo:status, public_repo, write:packages, delete:packages
3332
GH_TOKEN: ${{ secrets.GH_TOKEN }}
3433
# DOCKERHUB_USER=<typically dockerzipkindeployer>
35-
# - only push top-level projects: zipkin zipkin-aws zipkin-dependencies zipkin-gcp to Docker Hub, only on release
36-
# - login like this: echo "$DOCKERHUB_TOKEN"| docker login -u "$DOCKERHUB_USER" --password-stdin
34+
# * only push repos in openzipkin org to Docker Hub on release
3735
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
3836
# DOCKERHUB_TOKEN=<access token for DOCKERHUB_USER>
39-
# - Access Token from here https://hub.docker.com/settings/security
37+
# * Access Token from here https://hub.docker.com/settings/security
4038
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

.github/workflows/lint.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: lint
3+
4+
on: # yamllint disable-line rule:truthy
5+
push: # non-tagged pushes to master
6+
branches:
7+
- master
8+
tags-ignore:
9+
- '*'
10+
paths:
11+
- '**/*.md'
12+
- '.github/workflows/*.yml'
13+
- './build-bin/*lint'
14+
- ./build-bin/mlc_config.json
15+
pull_request: # pull requests targeted at the master branch.
16+
branches:
17+
- master
18+
paths:
19+
- '**/*.md'
20+
- '.github/workflows/*.yml'
21+
- './build-bin/*lint'
22+
- ./build-bin/mlc_config.json
23+
24+
jobs:
25+
lint:
26+
name: lint
27+
runs-on: ubuntu-22.04 # newest available distribution, aka jellyfish
28+
# skip commits made by the release plugin
29+
if: "!contains(github.event.head_commit.message, 'maven-release-plugin')"
30+
steps:
31+
- name: Checkout Repository
32+
uses: actions/checkout@v4
33+
- name: Lint
34+
run: |
35+
build-bin/configure_lint
36+
build-bin/lint

.github/workflows/test.yml

Lines changed: 48 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,61 @@
1-
# yamllint --format github .github/workflows/test.yml
21
---
32
name: test
43

54
# We don't test documentation-only commits.
6-
on:
7-
# We run tests on non-tagged pushes to master that aren't a commit made by the release plugin
8-
push:
9-
tags: ''
10-
branches: master
11-
paths-ignore: '**/*.md'
12-
# We also run tests on pull requests targeted at the master branch.
13-
pull_request:
14-
branches: master
15-
paths-ignore: '**/*.md'
5+
on: # yamllint disable-line rule:truthy
6+
push: # non-tagged pushes to master
7+
branches:
8+
- master
9+
tags-ignore:
10+
- '*'
11+
paths-ignore:
12+
- '**/*.md'
13+
- './build-bin/*lint'
14+
- ./build-bin/mlc_config.json
15+
pull_request: # pull requests targeted at the master branch.
16+
branches:
17+
- master
18+
paths-ignore:
19+
- '**/*.md'
20+
- './build-bin/*lint'
21+
- ./build-bin/mlc_config.json
1622

1723
jobs:
1824
test:
25+
name: test (JDK 17)
1926
runs-on: ubuntu-22.04 # newest available distribution, aka jellyfish
27+
# skip commits made by the release plugin
2028
if: "!contains(github.event.head_commit.message, 'maven-release-plugin')"
29+
strategy:
30+
fail-fast: false # don't fail fast as some failures are LTS specific
31+
matrix: # match with maven-enforcer-plugin rules in pom.xml
32+
include:
33+
- java_version: 17 # earliest LTS supported by Spring Boot 3
34+
maven_args: -Prelease -Dgpg.skip
35+
- java_version: 21 # Most recent LTS
2136
steps:
2237
- name: Checkout Repository
2338
uses: actions/checkout@v4
24-
- name: Cache local Maven repository
25-
uses: actions/cache@v3
26-
with:
27-
path: ~/.m2/repository
28-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
29-
restore-keys: ${{ runner.os }}-maven-
3039
- name: Setup java
3140
uses: actions/setup-java@v4
3241
with:
3342
distribution: 'zulu' # zulu as it supports a wide version range
3443
java-version: '17' # until Spark 4 per SPARK-43831
44+
- name: Cache local Maven repository
45+
uses: actions/cache@v4
46+
with:
47+
path: ~/.m2/repository
48+
# yamllint disable-line rule:line-length
49+
key: ${{ runner.os }}-jdk-17-maven-${{ hashFiles('**/pom.xml') }}
50+
restore-keys: ${{ runner.os }}-jdk-17-maven-
3551
- name: Test without Docker
36-
run: build-bin/maven/maven_go_offline && build-bin/test -DexcludedGroups=docker
52+
run: |
53+
build-bin/maven/maven_go_offline &&
54+
build-bin/test -DexcludedGroups=docker
55+
3756
test_docker:
38-
name: test_docker (${{ matrix.name }})
39-
runs-on: ubuntu-22.04 # newest available distribution, aka jellyfish
57+
runs-on: ubuntu-22.04 # newest available distribution, aka jellyfish
58+
# skip commits made by the release plugin
4059
if: "!contains(github.event.head_commit.message, 'maven-release-plugin')"
4160
strategy:
4261
matrix:
@@ -59,20 +78,21 @@ jobs:
5978
steps:
6079
- name: Checkout Repository
6180
uses: actions/checkout@v4
81+
- name: Setup java
82+
uses: actions/setup-java@v4
83+
with:
84+
distribution: 'zulu' # zulu as it supports a wide version range
85+
java-version: '17' # until Spark 4 per SPARK-43831
6286
- name: Cache local Maven repository
63-
uses: actions/cache@v3
87+
uses: actions/cache@v4
6488
with:
6589
path: ~/.m2/repository
66-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
67-
restore-keys: ${{ runner.os }}-maven-
90+
# yamllint disable-line rule:line-length
91+
key: ${{ runner.os }}-jdk-17-maven-${{ hashFiles('**/pom.xml') }}
92+
restore-keys: ${{ runner.os }}-jdk-17-maven-
6893
# Don't attempt to cache Docker. Sensitive information can be stolen
6994
# via forks, and login session ends up in ~/.docker. This is ok because
7095
# we publish DOCKER_PARENT_IMAGE to ghcr.io, hence local to the runner.
71-
- name: Setup java
72-
uses: actions/setup-java@v4
73-
with:
74-
distribution: 'zulu' # zulu as it supports a wide version range
75-
java-version: '17' # until Spark 4 per SPARK-43831
7696
- name: Test with Docker
7797
run: |
7898
build-bin/docker/configure_docker &&

.github/workflows/test_readme.yml

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
1-
# yamllint --format github .github/workflows/test_readme.yml
21
---
32
name: test_readme
43

54
# These test build commands mentioned in various README.md files.
65
#
7-
# This doesn't literally scrape the README.md, so we don't test documentation-only commits.
8-
on:
9-
# We run tests on only on pull requests targeted at the master branch.
10-
# * This skips master pushes as it is rare things not done in PRs break, and conserves resources
11-
pull_request:
12-
branches: master
13-
paths-ignore: '**/*.md'
6+
# We don't test documentation-only commits.
7+
on: # yamllint disable-line rule:truthy
8+
push: # non-tagged pushes to master
9+
branches:
10+
- master
11+
tags-ignore:
12+
- '*'
13+
paths-ignore:
14+
- '**/*.md'
15+
- './build-bin/*lint'
16+
- ./build-bin/mlc_config.json
17+
pull_request: # pull requests targeted at the master branch.
18+
branches:
19+
- master
20+
paths-ignore:
21+
- '**/*.md'
22+
- './build-bin/*lint'
23+
- ./build-bin/mlc_config.json
1424

1525
jobs:
16-
zipkin-dependencies:
26+
zipkin-server:
1727
runs-on: ubuntu-22.04 # newest available distribution, aka jellyfish
28+
# skip commits made by the release plugin
1829
steps:
1930
- name: Checkout Repository
2031
uses: actions/checkout@v4
@@ -24,16 +35,16 @@ jobs:
2435
distribution: 'zulu' # zulu as it supports a wide version range
2536
java-version: '17' # until Spark 4 per SPARK-43831
2637
- name: Cache local Maven repository
27-
uses: actions/cache@v3
38+
uses: actions/cache@v4
2839
with:
2940
path: ~/.m2/repository
30-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
31-
restore-keys: ${{ runner.os }}-maven-
41+
key: ${{ runner.os }}-jdk-17-maven-${{ hashFiles('**/pom.xml') }}
42+
restore-keys: ${{ runner.os }}-jdk-17-maven-
3243
# Don't attempt to cache Docker. Sensitive information can be stolen
3344
# via forks, and login session ends up in ~/.docker. This is ok because
3445
# we publish DOCKER_PARENT_IMAGE to ghcr.io, hence local to the runner.
3546
- name: README.md # Tests the build which is re-used for docker
36-
run: ./mvnw -T1C -q --batch-mode -DskipTests -Denforcer.fail=false package
47+
run: ./mvnw -T1C -q --batch-mode -DskipTests package
3748
- name: docker/README.md
3849
run: build-bin/docker/docker_build openzipkin/zipkin-dependencies:test
3950
env:

0 commit comments

Comments
 (0)