Skip to content

Commit

Permalink
update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Derek Tang committed Feb 16, 2024
1 parent 3c79a6e commit 83aa69c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,20 @@ jobs:
lint:
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
env:
REPO_DIR : /opt/analysis-core
steps:
- uses: actions/checkout@v4

- env:
REPO_DIR : /opt/analysis-core
- name: Run lint
run: |
docker build --build-arg REPO_DIR="$REPO_DIR" --target setup-env -t lint-image .
docker run --name lint-container lint-image
docker cp lint-container:"$REPO_DIR"/lint.log .
echo "MSG_COUNT=$(wc -l lint.log | awk '{print $1}')" >> "$GITHUB_ENV"
- if: ${{ env.MSG_COUNT != 0 }}
- name: Display lint errors
if: failure()
run: |
docker cp lint-container:"$REPO_DIR"/lint.log .
while IFS= read -r LINT_MSG; do echo "::warning::${LINT_MSG}"; done < lint.log
exit 1
Expand Down
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ SHELL ["/bin/bash", "-c"]
# run lint if container started
ENTRYPOINT []

CMD mvn -B -q checkstyle:check | grep -i --color=never '\.java\|failed to execute goal' > lint.log
CMD mvn -B -q checkstyle:check | \
grep -i --color=never '\.java\|failed to execute goal' > lint.log && \
exit 1 || \
exit 0


# ===== stage 2 =====
Expand Down

0 comments on commit 83aa69c

Please sign in to comment.