From d9a2472a1cf50cb8ff700db8997d1e41cd461c9a Mon Sep 17 00:00:00 2001 From: Alexander Stein Date: Tue, 27 Sep 2022 15:22:31 -0400 Subject: [PATCH] Update Java setup, clean up NodeJS and Python setup. --- .github/workflows/content-artifacts.yml | 48 ++++++++++++++++--------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/.github/workflows/content-artifacts.yml b/.github/workflows/content-artifacts.yml index cc377b98..cfa867af 100644 --- a/.github/workflows/content-artifacts.yml +++ b/.github/workflows/content-artifacts.yml @@ -43,33 +43,49 @@ jobs: - name: Install APT dependencies run: | sudo apt-get install libxml2-utils - - name: Install NPM dependencies + - name: Set up NodeJS + uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 + with: + node-version-file: git-content/${{ env.OSCAL_DIR }}/build/.nvmrc + cache: 'npm' + cache-dependency-path: '**/package-lock.json' + - name: Setup Dependencies run: | - sudo npm install --loglevel verbose -g yargs ajv-formats@"^1.5.x" ajv-cli@"^4.0.x" yaml-convert@"^1.0.x" - - name: Set up JDK 11 - uses: actions/setup-java@v1 + # NodeJS + cd "${{ github.workspace }}/build" + # If you are a developer and need to modify the workflow, be sure to review + # the package.json and package-lock.json to ensure the following deps are + # at least installed (they will be updated by dependabot): + # - ajv-cli + # - ajv-formats + # - markdown-link-check + # - yaml-convert + npm install --loglevel verbose + echo "$PWD/node_modules/.bin/" >> $GITHUB_PATH + working-directory: git-content/${{ env.OSCAL_DIR }}/build + - name: Set up JDK + uses: actions/setup-java@f0bb91606209742fe3ea40199be2f3ef195ecabf with: java-version: 11 - - name: Cache Maven packages - uses: actions/cache@v2 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 - - name: Get Saxon-HE + distribution: 'temurin' + cache: 'maven' + - name: Install JDK Deps Saxon and XML Calabash run: | - mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:get -DartifactId=Saxon-HE -DgroupId=net.sf.saxon -Dversion=$SAXON_VERSION + mkdir -p "${JAVA_CLASSPATH}" + mvn dependency:copy-dependencies -DoutputDirectory="${JAVA_CLASSPATH}" + working-directory: git-content/${{ env.OSCAL_DIR }}/build - name: Set up Python 3.x - uses: actions/setup-python@98f2ad02fd48d057ee3b4d4f66525b231c3e52b6 # current release v3.1.2 + uses: actions/setup-python@98f2ad02fd48d057ee3b4d4f66525b231c3e52b6 with: python-version: '3.8' architecture: 'x64' cache: 'pip' cache-dependency-path: | - git-content/${{ env.CICD_DIR_PATH }}/python/requirements.txt + git-content/${{ env.OSCAL_DIR }}/build/python/requirements.txt - name: Install Python dependencies run: | - pip install -r "${GITHUB_WORKSPACE}/git-content/${CICD_DIR_PATH}/python/requirements.txt" + pip install -r requirements.txt + working-directory: git-content/${{ env.OSCAL_DIR }}/build/python - name: Validate Content run: # mkdir -p "${OSCAL_BUILD_DIR_PATH}" @@ -81,7 +97,7 @@ jobs: - name: Publish Artifacts # only do this on main if: github.repository == env.HOME_REPO && github.ref == 'refs/heads/main' - uses: stefanzweifel/git-auto-commit-action@v4.5.1 + uses: stefanzweifel/git-auto-commit-action@6c32682a4040e023c054b2fc60a7cf65cc77f7ad with: repository: git-content push_options: --force