Skip to content

feat(workflow): support workflow #1591

feat(workflow): support workflow

feat(workflow): support workflow #1591

Workflow file for this run

name: Before checker with maven
on:
push:
branches: [ "*" ]
pull_request:
branches: [ "dev" ]
jobs:
before_checker_loading:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- run: echo 'Before checker loading'
before_checker_ui:
runs-on: ubuntu-latest
needs:
- before_checker_loading
if: |
${{ github.event_name == 'pull_request' && (
contains(github.event.pull_request.changed_files.*.filename, 'core/datacap-ui') ||
contains(toJSON(github.event.pull_request.changed_files), 'core/datacap-ui')
) }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- run: cd core/datacap-ui && npm install pnpm -g && pnpm install && pnpm run build
before_checker_style:
runs-on: ubuntu-latest
needs:
- before_checker_loading
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Debug file changes
run: |
echo "Event name: ${{ github.event_name }}"
echo "Modified files (push):"
echo "${{ toJSON(github.event.commits.*.modified) }}"
echo "Changed files (pull_request):"
echo "${{ toJSON(github.event.pull_request.changed_files.*.filename) }}"
- name: Check if Java or Kotlin files changed
id: check_files
run: |
if [[ "${{ github.event_name }}" == "push" ]]; then
MODIFIED_FILES="${{ toJSON(github.event.commits.*.modified) }}"
if [[ $MODIFIED_FILES == *".java"* ]] || [[ $MODIFIED_FILES == *".kt"* ]]; then
echo "run_check=true" >> $GITHUB_OUTPUT
fi
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
CHANGED_FILES="${{ toJSON(github.event.pull_request.changed_files.*.filename) }}"
if [[ $CHANGED_FILES == *".java"* ]] || [[ $CHANGED_FILES == *".kt"* ]]; then
echo "run_check=true" >> $GITHUB_OUTPUT
fi
fi
shell: bash
- name: Maven Checker Style
if: steps.check_files.outputs.run_check == 'true'
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- if: steps.check_files.outputs.run_check == 'true'
run: chmod 755 ./mvnw
- if: steps.check_files.outputs.run_check == 'true'
run: ./mvnw clean install checkstyle:checkstyle -Dspotbugs.skip -Dgpg.skip -Dskip.pnpm -DskipTests=true
before_checker_bugs:
runs-on: ubuntu-latest
needs:
- before_checker_loading
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Debug file changes
run: |
echo "Event name: ${{ github.event_name }}"
echo "Modified files (push):"
echo "${{ toJSON(github.event.commits.*.modified) }}"
echo "Changed files (pull_request):"
echo "${{ toJSON(github.event.pull_request.changed_files.*.filename) }}"
- name: Check if Java or Kotlin files changed
id: check_files
run: |
if [[ "${{ github.event_name }}" == "push" ]]; then
MODIFIED_FILES="${{ toJSON(github.event.commits.*.modified) }}"
if [[ $MODIFIED_FILES == *".java"* ]] || [[ $MODIFIED_FILES == *".kt"* ]]; then
echo "run_check=true" >> $GITHUB_OUTPUT
fi
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
CHANGED_FILES="${{ toJSON(github.event.pull_request.changed_files.*.filename) }}"
if [[ $CHANGED_FILES == *".java"* ]] || [[ $CHANGED_FILES == *".kt"* ]]; then
echo "run_check=true" >> $GITHUB_OUTPUT
fi
fi
shell: bash
- name: Maven Checker Bugs
if: steps.check_files.outputs.run_check == 'true'
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Grant execute permission for mvnw
if: steps.check_files.outputs.run_check == 'true'
run: chmod +x mvnw
- name: Run SpotBugs skip server
if: steps.check_files.outputs.run_check == 'true'
env:
MAVEN_OPTS: -Xmx1024m
run: ./mvnw clean install spotbugs:spotbugs -pl '!core/datacap-server' -Dcheckstyle.skip -Dgpg.skip -Dskip.pnpm -DskipTests=true
- name: Run SpotBugs for server
if: steps.check_files.outputs.run_check == 'true'
run: ./mvnw clean install spotbugs:spotbugs -Dcheckstyle.skip -Dgpg.skip -Dskip.pnpm -DskipTests=true -f core/datacap-server/pom.xml
before_checker_test:
runs-on: ubuntu-latest
needs:
- before_checker_ui
- before_checker_style
- before_checker_bugs
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Maven Checker Style
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Add hosts
run: |
echo "156.238.128.11 cdn.north.devlive.org" | sudo tee -a /etc/hosts
echo "156.238.128.17 cdn.north.devlive.org" | sudo tee -a /etc/hosts
echo "156.238.128.19 cdn.north.devlive.org" | sudo tee -a /etc/hosts
echo "156.238.128.23 cdn.north.devlive.org" | sudo tee -a /etc/hosts
- run: chmod 755 ./mvnw
- name: Debug Environment Variables
env:
QINIU_ACCESS: ${{ secrets.QINIU_ACCESS }}
QINIU_SECRET: ${{ secrets.QINIU_SECRET }}
QINIU_BUCKET: ${{ secrets.QINIU_BUCKET }}
QINIU_ENDPOINT: ${{ secrets.QINIU_ENDPOINT }}
run: |
echo "QINIU_ENDPOINT is set: ${{ secrets.QINIU_ENDPOINT != '' }}"
echo "QINIU_ENDPOINT length: ${#QINIU_ENDPOINT}"
- name: Run Tests
if: ${{ env.QINIU_ENDPOINT != '' }}
env:
QINIU_ACCESS: ${{ secrets.QINIU_ACCESS }}
QINIU_SECRET: ${{ secrets.QINIU_SECRET }}
QINIU_BUCKET: ${{ secrets.QINIU_BUCKET }}
QINIU_ENDPOINT: ${{ secrets.QINIU_ENDPOINT }}
ALIOSS_ACCESS: ${{ secrets.ALIOSS_ACCESS }}
ALIOSS_SECRET: ${{ secrets.ALIOSS_SECRET }}
ALIOSS_BUCKET: ${{ secrets.ALIOSS_BUCKET }}
ALIOSS_ENDPOINT: ${{ secrets.ALIOSS_ENDPOINT }}
COS_ACCESS: ${{ secrets.COS_ACCESS }}
COS_SECRET: ${{ secrets.COS_SECRET }}
COS_BUCKET: ${{ secrets.COS_BUCKET }}
COS_ENDPOINT: ${{ secrets.COS_ENDPOINT }}
S3_ACCESS: ${{ secrets.S3_ACCESS }}
S3_SECRET: ${{ secrets.S3_SECRET }}
S3_BUCKET: ${{ secrets.S3_BUCKET }}
S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
run: |
./mvnw clean test -Dspotbugs.skip -Dgpg.skip -Dcheckstyle.skip -Dskip.pnpm \
-Dqiniu.access="$QINIU_ACCESS" -Dqiniu.secret="$QINIU_SECRET" -Dqiniu.bucket="$QINIU_BUCKET" -Dqiniu.endpoint="$QINIU_ENDPOINT" \
-Dalioss.access="$ALIOSS_ACCESS" -Dalioss.secret="$ALIOSS_SECRET" -Dalioss.bucket="$ALIOSS_BUCKET" -Dalioss.endpoint="$ALIOSS_ENDPOINT" \
-Dcos.access="$COS_ACCESS" -Dcos.secret="$COS_SECRET" -Dcos.bucket="$COS_BUCKET" -Dcos.endpoint="$COS_ENDPOINT" \
-Ds3.access="$S3_ACCESS" -Ds3.secret="$S3_SECRET" -Ds3.bucket="$S3_BUCKET" -Ds3.endpoint="$S3_ENDPOINT"
before_checker_package:
runs-on: ubuntu-latest
needs:
- before_checker_test
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Maven Checker Package
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- run: chmod 755 ./mvnw
- run: ./mvnw -T 1C clean install package -Dspotbugs.skip -Dgpg.skip -Dcheckstyle.skip -DskipTests=true