Skip to content

Commit

Permalink
Automate website deployment using logging-parent:11.0.0-SNAPSHOT
Browse files Browse the repository at this point in the history
  • Loading branch information
vy committed Apr 15, 2024
1 parent 0eeb713 commit 27ae663
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 192 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

build:
if: github.actor != 'dependabot[bot]'
uses: apache/logging-parent/.github/workflows/build-reusable.yaml@rel/10.6.0
uses: apache/logging-parent/.github/workflows/build-reusable.yaml@main
with:
java-version: |
8
Expand All @@ -48,11 +48,11 @@ jobs:
deploy-snapshot:
needs: build
if: github.repository == 'apache/logging-log4j2' && github.ref_name == '2.x'
uses: apache/logging-parent/.github/workflows/deploy-snapshot-reusable.yaml@rel/10.6.0
uses: apache/logging-parent/.github/workflows/deploy-snapshot-reusable.yaml@main
# Secrets for deployments
secrets:
NEXUS_USER: ${{ secrets.NEXUS_USER }}
NEXUS_PW: ${{ secrets.NEXUS_PW }}
NEXUS_USERNAME: ${{ secrets.NEXUS_USER }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PW }}
with:
java-version: |
8
Expand All @@ -61,12 +61,12 @@ jobs:
deploy-release:
needs: build
if: github.repository == 'apache/logging-log4j2' && startsWith(github.ref_name, 'release/')
uses: apache/logging-parent/.github/workflows/deploy-release-reusable.yaml@rel/10.6.0
uses: apache/logging-parent/.github/workflows/deploy-release-reusable.yaml@main
# Secrets for deployments
secrets:
GPG_SECRET_KEY: ${{ secrets.LOGGING_GPG_SECRET_KEY }}
LOGGING_STAGE_DEPLOYER_USER: ${{ secrets.LOGGING_STAGE_DEPLOYER_USER }}
LOGGING_STAGE_DEPLOYER_PW: ${{ secrets.LOGGING_STAGE_DEPLOYER_PW }}
NEXUS_USERNAME: ${{ secrets.LOGGING_STAGE_DEPLOYER_USER }}
NEXUS_PASSWORD: ${{ secrets.LOGGING_STAGE_DEPLOYER_PW }}
SVN_USERNAME: ${{ secrets.LOGGING_SVN_DEV_USERNAME }}
SVN_PASSWORD: ${{ secrets.LOGGING_SVN_DEV_PASSWORD }}
# Write permissions to allow the Maven `revision` property update, changelog release, etc.
Expand All @@ -77,4 +77,3 @@ jobs:
8
17
project-id: log4j
site-enabled: true
98 changes: 98 additions & 0 deletions .github/workflows/deploy-site.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to you under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

name: deploy-site

on:
push:
branches:
- "2.x"
- "2.x-site-pro"
- "release/*"
paths-ignore:
- "**.md"
- "**.txt"

permissions: read-all

jobs:

deploy-site-stg:
if: github.repository == 'apache/logging-log4j2' && github.ref_name == '2.x'
uses: apache/logging-parent/.github/workflows/deploy-site-reusable.yaml@main
# Secrets for committing the generated site
secrets:
GPG_SECRET_KEY: ${{ secrets.LOGGING_GPG_SECRET_KEY }}
# Write permissions for committing the generated site
permissions:
contents: write
with:
asf-yaml-content: |
staging:
profile: ~
whoami: ${{ github.ref_name }}-site-stg-out
subdir: content/log4j/2.x
install-required: true
target-branch: ${{ github.ref_name }}-site-stg-out

deploy-site-pro:
if: github.repository == 'apache/logging-log4j2' && github.ref_name == '2.x-site-pro'
uses: apache/logging-parent/.github/workflows/deploy-site-reusable.yaml@main
# Secrets for committing the generated site
secrets:
GPG_SECRET_KEY: ${{ secrets.LOGGING_GPG_SECRET_KEY }}
# Write permissions for committing the generated site
permissions:
contents: write
with:
asf-yaml-content: |
publish:
profile: ~
whoami: ${{ github.ref_name }}-out
subdir: content/log4j/2.x
install-required: true
target-branch: ${{ github.ref_name }}-out

export-version:
if: github.repository == 'apache/logging-log4j2' && startsWith(github.ref_name, 'release/')
runs-on: ubuntu-latest
outputs:
version: ${{ steps.export-version.outputs.version }}
steps:
- name: Export version
id: export-version
run: |
version=$(echo "${{ github.ref_name }}" | sed 's/^release\///')
echo "version=$version" >> "$GITHUB_OUTPUT"
deploy-site-rel:
needs: export-version
uses: apache/logging-parent/.github/workflows/deploy-site-reusable.yaml@main
# Secrets for committing the generated site
secrets:
GPG_SECRET_KEY: ${{ secrets.LOGGING_GPG_SECRET_KEY }}
# Write permissions for committing the generated site
permissions:
contents: write
with:
asf-yaml-content: |
staging:
profile: ~
whoami: ${{ github.ref_name }}-site-stg-out
subdir: content/log4j/${{ needs.export-version.outputs.version }}
install-required: true
target-branch: ${{ github.ref_name }}-site-stg-out
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ private static final class InstanceHolder {
StatusLogger.class.getSimpleName(),
ParameterizedNoReferenceMessageFactory.INSTANCE,
Config.getInstance(),
new StatusConsoleListener(Config.getInstance().fallbackListenerLevel));
new StatusConsoleListener(requireNonNull(Config.getInstance().fallbackListenerLevel)));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
*/
package org.apache.logging.log4j.core.config.plugins.convert;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.assertj.core.api.Assertions.assertThat;

import java.io.File;
import java.math.BigDecimal;
Expand Down Expand Up @@ -221,12 +220,6 @@ public TypeConvertersTest(
public void testConvert() throws Exception {
final Object actual = TypeConverters.convert(value, clazz, defaultValue);
final String assertionMessage = "\nGiven: " + value + "\nDefault: " + defaultValue;
if (expected instanceof char[]) {
assertArrayEquals(assertionMessage, (char[]) expected, (char[]) actual);
} else if (expected instanceof byte[]) {
assertArrayEquals(assertionMessage, (byte[]) expected, (byte[]) actual);
} else {
assertEquals(assertionMessage, expected, actual);
}
assertThat(actual).as(assertionMessage).isEqualTo(expected);
}
}
Loading

0 comments on commit 27ae663

Please sign in to comment.