diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml new file mode 100644 index 0000000..88d00c0 --- /dev/null +++ b/.github/workflows/cd.yaml @@ -0,0 +1,54 @@ +name: CD + +on: + push: + branches: + - main + +jobs: + release-please: + name: Release + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + outputs: + tag_name: ${{ steps.release.outputs.tag_name }} + release_created: ${{ steps.release.outputs.release_created }} + steps: + - uses: googleapis/release-please-action@v4 + id: release + with: + release-type: maven + + + publish: + if: ${{needs.release-please.outputs.release_created}} + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + needs: + - release-please + steps: + - name: checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'corretto' + cache: 'maven' + + push: + if: ${{needs.release-please.outputs.release_created}} + name: Publish to GitHub Packages Apache Maven + uses: ./.github/workflows/maven.yaml + with: + maven-goal: deploy + needs: release-please + + + + diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..6c243d3 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,22 @@ +name: CI + +on: + pull_request: + +jobs: + + security: + name: Security + uses: ./.github/workflows/security.yaml + secrets: inherit + + build-maven: + name: Build Maven + uses: ./.github/workflows/maven.yaml + with: + maven-goal: package + needs: security + + + + diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml deleted file mode 100644 index b735f8e..0000000 --- a/.github/workflows/maven-publish.yml +++ /dev/null @@ -1,38 +0,0 @@ -# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created -# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path - -name: Maven Package - -on: - push: - branches: - - gitHubPackages - -jobs: - build: - - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - uses: actions/checkout@v4 - - name: Set up JDK 11 - uses: actions/setup-java@v3 - with: - java-version: '11' - distribution: 'temurin' - server-id: github # Value of the distributionManagement/repository/id field of the pom.xml - settings-path: ${{ github.workspace }} # location for the settings.xml file - server-username: GITHUB_USER_REF # env variable name for username - server-password: GITHUB_TOKEN_REF # env variable name for GitHub Personal Access Token - - - name: Build with Maven - run: mvn -B -Pgithub package --file pom.xml - - - name: Publish to GitHub Packages Apache Maven - run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml - env: - GITHUB_USER_REF: ${{ secrets.GH_PACKAGE_REPO_USERNAME }} - GITHUB_TOKEN_REF: ${{ secrets.GH_PACKAGE_REPO_PASSWORD }} diff --git a/.github/workflows/maven.yaml b/.github/workflows/maven.yaml new file mode 100644 index 0000000..3213bb9 --- /dev/null +++ b/.github/workflows/maven.yaml @@ -0,0 +1,26 @@ +name: Maven + +on: + workflow_call: + inputs: + maven-goal: + description: 'Maven goal to run' + required: true + default: 'package' + type: string + +permissions: + contents: read + +jobs: + build: + name: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: whelk-io/maven-settings-xml-action@v22 + with: + servers: '[{ "id":"dvsa-github-packages", "configuration": { "httpHeaders": { "property": { "name":"Authorization", "value":"Bearer ${{ secrets.GITHUB_TOKEN }}"} } } } ]' + + - run: mvn -B -P github ${{ inputs.maven-goal}} + diff --git a/.github/workflows/security.yaml b/.github/workflows/security.yaml new file mode 100644 index 0000000..84e29a6 --- /dev/null +++ b/.github/workflows/security.yaml @@ -0,0 +1,42 @@ +name: Security Scan + +on: + workflow_call: + inputs: + severity-threshold: + description: "Severity threshold" + required: false + default: "high" + type: string + secrets: + SNYK_TOKEN: + description: "Snyk token" + required: true + schedule: + # Weekly on Monday at 00:00 UTC + - cron: 0 0 * * 1 + +permissions: + contents: read + packages: read + +jobs: + scan: + name: scan + runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@v4 + - uses: snyk/actions/setup@master + - uses: actions/setup-java@v4 + with: + distribution: "corretto" + java-version: "11" + cache: maven + - uses: whelk-io/maven-settings-xml-action@v22 + with: + servers: '[{ "id":"dvsa-github-packages", "configuration": { "httpHeaders": { "property": { "name":"Authorization", "value":"Bearer ${{ secrets.GITHUB_TOKEN }}"} } } } ]' + + - run: snyk test --severity-threshold=${{ inputs.severity-threshold || 'high' }} -- -P github + env: + SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} diff --git a/.snyk b/.snyk new file mode 100644 index 0000000..930d052 --- /dev/null +++ b/.snyk @@ -0,0 +1,45 @@ +# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities. +version: v1.25.0 +# ignores vulnerabilities until expiry date; change duration by modifying expiry date +ignore: + SNYK-JAVA-DOM4J-174153: + - '*': + reason: None Given + expires: 2024-06-08T13:15:21.624Z + created: 2024-05-09T13:15:21.627Z + SNYK-JAVA-DOM4J-2812795: + - '*': + reason: None Given + expires: 2024-06-08T13:16:12.796Z + created: 2024-05-09T13:16:12.804Z + SNYK-JAVA-SOFTWAREAMAZONION-6153869: + - '*': + reason: None Given + expires: 2024-06-08T13:27:49.964Z + created: 2024-05-09T13:27:49.971Z + SNYK-JAVA-DOM4J-2812975: + - '*': + reason: no fix + expires: 2024-06-08T17:23:14.009Z + created: 2024-05-09T17:23:14.014Z + SNYK-JAVA-ORGSELENIUMHQSELENIUM-6062318: + - '*': + reason: None Given + expires: 2024-06-08T15:45:53.270Z + created: 2024-05-09T15:45:53.284Z + SNYK-JAVA-ORGBOUNCYCASTLE-6612984: + - '*': + reason: None Given + expires: 2024-06-08T15:46:16.314Z + created: 2024-05-09T15:46:16.322Z + SNYK-JAVA-ORGYAML-6056527: + - '*': + reason: no fix + expires: 2024-06-08T17:23:28.159Z + created: 2024-05-09T17:23:28.165Z + SNYK-JAVA-ORGYAML-2806360: + - '*': + reason: no fix + expires: 2024-06-08T17:24:05.946Z + created: 2024-05-09T17:24:05.953Z +patch: {} diff --git a/README.md b/README.md index c8903b5..cddb3d7 100644 --- a/README.md +++ b/README.md @@ -10,4 +10,15 @@ that consumes this library. # Rules This library uses AXE-CORE to scan for accessibility violations. The full rules that the scan covers -can be found on the following link https://dequeuniversity.com/rules/axe/3.2 \ No newline at end of file +can be found on the following link https://dequeuniversity.com/rules/axe/3.2 + +## Installation +Add the following Maven dependency to your project's `pom.xml` file: +```xml + + org.dvsa.testing.framework + accessibility-library + [insert latest version of package] + +``` + diff --git a/pom.xml b/pom.xml index 8a5f4be..2e3649d 100644 --- a/pom.xml +++ b/pom.xml @@ -9,11 +9,11 @@ 2.9 - https://nexus.olcs.dev-dvsacloud.uk/repository/maven-releases UTF-8 - 3.8.1 - 2.0.1.7 - 4.8.0 + 1.11 + 1.11 + 2.2.0 + 3.0 ${rules} @@ -21,28 +21,25 @@ 0.9.11 2.22.0 2.22.0 + https://maven.pkg.github.com/dvsa/vol-accessibility-lib + 1.9.4 + 3.2.2 + 1.6.1 + 1.10.0 + 1.26.0 + 20180130 + 42.3.9 + 1.31 + 1.0.3 + 20231013 + 11 - - - - maven-releases - ${nexus.releases} - - - - - - org.springframework.build - aws-maven - 5.0.0.RELEASE - - org.apache.maven.plugins maven-compiler-plugin - ${maven.compiler.version} + 3.13.0 11 @@ -50,52 +47,102 @@ + + + github + + + central + https://repo1.maven.org/maven2 + true + true + + + dvsa-github-packages + GitHub dvsa Apache Maven Packages + https://maven.pkg.github.com/dvsa/* + true + true + + + + + - org.apache.logging.log4j - log4j-api - ${slf4j.version} + org.dvsa.testing.lib + active-support + 2.2.0 - org.apache.logging.log4j - log4j-core - ${slf4j-log4j12.version} + commons-beanutils + commons-beanutils + ${commons-beanutils.version} - org.dvsa.testing.lib - active-support - ${active-support.version} + commons-collections + commons-collections + ${commons-collections.version} - com.deque.html.axe-core - selenium - ${axe-selenium-version} - test - - - org.seleniumhq.selenium - selenenium-java - - + dom4j + dom4j + ${dom4j.version} + + + org.apache.commons + commons-text + ${org.apache.commons.commons-text.version} + + + org.apache.commons + commons-compress + ${org.apache.commons.commons-compress.version} + + + org.json + json + ${org.json.version} + + + org.postgresql + postgresql + ${org.postgresql.version} + + + org.yaml + snakeyaml + ${org.yaml.snakeyaml.version} + + + software.amazon.ion + ion-java + ${software.amazon.ion.version} com.github.spullara.mustache.java compiler ${mustache.version} + + org.apache.logging.log4j + log4j-core + ${slf4j-log4j12.version} + com.deque.html.axe-core selenium - ${axe-selenium-version} - compile + 4.9.0 - + - maven-releases - ${nexus.releases} + github + GitHub dvsa Apache Maven Packages + https://maven.pkg.github.com/dvsa/vol-accessibility-lib - \ No newline at end of file + +