Skip to content

Bump github/codeql-action from 2 to 3 (#41) #150

Bump github/codeql-action from 2 to 3 (#41)

Bump github/codeql-action from 2 to 3 (#41) #150

Workflow file for this run

name: CWL Avro Testing
on: [push]
jobs:
Build:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: 'x64'
# upgrade pip?
- run: sudo pip install --upgrade pip
# install a specific version of the cwl dependencies to test with
- run: pip3.10 install --user importlib-resources==6.1.1
- run: pip3.10 install --user setuptools==69.0.2
- run: pip3.10 install --user cwl-runner cwltool==3.1.20230201224320 schema-salad==8.4.20230201194352
- run: git clone https://github.com/common-workflow-language/common-workflow-language
# convert CWL schema salad CWL to standard Avro json
- run: schema-salad-tool --print-avro common-workflow-language/v1.0/CommonWorkflowLanguage.yml > cwl.avsc
# get rid of invalid avro symbols
- run: sed '/draft-3/d' cwl.avsc > cwl.edited.avsc
- run: sed -i '/draft-2/d' cwl.edited.avsc
- run: sed -i '/draft-4/d' cwl.edited.avsc
- run: sed -i '/dev4/d' cwl.edited.avsc
- run: sed -i '/v1.0/d' cwl.edited.avsc
# Replace the namespace generated by schema-salad-tool with our namespace, "io.cwl.avro" so
# that the generated Java models will have this package name.
- run: sed -i 's/org.w3id.cwl.cwl/io.cwl.avro/g' cwl.edited.avsc
- run: sed -i 's/org.w3id.cwl.salad/io.cwl.avro/g' cwl.edited.avsc
# get rid of symbols that screw up javadoc (not sure if invalid avro schema)
- run: sed -i 's/<A>/A/g' cwl.edited.avsc
- run: sed -i 's/<B>/B/g' cwl.edited.avsc
- run: sed -i 's/<C>/C/g' cwl.edited.avsc
- run: wget https://repo1.maven.org/maven2/org/apache/avro/avro-tools/1.11.3/avro-tools-1.11.3.jar
# generate Java model classes.
- run: java -jar avro-tools-1.11.3.jar compile schema -fieldVisibility public cwl.edited.avsc cwl-temp
- run: find cwl-temp/ -type f -exec sed -i 's/io.cwl.avro.Any/Object/g' {} \;
- run: rm cwl-temp/io/cwl/avro/Any.java
# There are 5 subdirectories in cwl-temp/io/cwl/avro that have the same name as a file
# Fix ArraySchema conflict
- run: mv cwl-temp/io/cwl/avro/ArraySchema cwl-temp/io/cwl/avro/ArraySchemaPackage
- run: find cwl-temp/ -type f -exec sed -i 's/io.cwl.avro.ArraySchema.type/io.cwl.avro.ArraySchemaPackage.type/g' {} \;
# Fix Directory conflict
- run: mv cwl-temp/io/cwl/avro/Directory cwl-temp/io/cwl/avro/DirectoryPackage
- run: find cwl-temp/ -type f -exec sed -i 's/io.cwl.avro.Directory.class\$/io.cwl.avro.DirectoryPackage.class$/g' {} \;
# Fix EnumSchema conflict
- run: mv cwl-temp/io/cwl/avro/EnumSchema cwl-temp/io/cwl/avro/EnumSchemaPackage
- run: find cwl-temp/ -type f -exec sed -i 's/io.cwl.avro.EnumSchema.type/io.cwl.avro.EnumSchemaPackage.type/g' {} \;
# Fix File conflict
- run: mv cwl-temp/io/cwl/avro/File cwl-temp/io/cwl/avro/FilePackage
- run: find cwl-temp/ -type f -exec sed -i 's/io.cwl.avro.File.class\$/io.cwl.avro.FilePackage.class$/g' {} \;
# Fix RecordSchema conflict
- run: mv cwl-temp/io/cwl/avro/RecordSchema cwl-temp/io/cwl/avro/RecordSchemaPackage
- run: find cwl-temp/ -type f -exec sed -i 's/io.cwl.avro.RecordSchema.type/io.cwl.avro.RecordSchemaPackage.type/g' {} \;
# Copy generated java classes
- run: rm -Rf cwlavro-generated/src/main/java/io/cwl/avro
- run: cp -R cwl-temp/io/cwl/avro cwlavro-generated/src/main/java/io/cwl/avro
- run: echo "the output below should show that the generated API more-or-less matches the checked-in API for convenience"
- run: git diff
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17.0.4+8'
distribution: 'adopt'
- if: "!contains(github.ref, 'dependabot')"
name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: java
- run: mvn -B clean install
- if: "!contains(github.ref, 'dependabot')"
name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3