Skip to content

Commit 3accb72

Browse files
Merge pull request #19 from asaasdev/image_codenarc_github_actions
Trazendo a image gerada no codenarc-action
2 parents 4a002a2 + 65cba76 commit 3accb72

File tree

13 files changed

+268
-59
lines changed

13 files changed

+268
-59
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ updates:
1212
- package-ecosystem: "docker" # See documentation for possible values
1313
directory: "/" # Location of package manifests
1414
schedule:
15-
interval: "daily"
15+
interval: "daily"

.github/workflows/ci.yml

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,45 @@
1-
name: ci
1+
name: docker image ci
22

33
on:
44
push:
5-
branches: main
5+
tags:
6+
- 'v*'
7+
pull_request:
8+
branches:
9+
- 'main'
610

711
jobs:
812
main:
913
runs-on: ubuntu-latest
1014
steps:
11-
-
12-
name: Set up QEMU
15+
- uses: actions/checkout@v2
16+
17+
- name: Docker meta
18+
id: meta
19+
uses: docker/metadata-action@v3
20+
with:
21+
images: |
22+
asaasdev/codenarc
23+
tags: |
24+
type=ref,event=pr
25+
type=semver,pattern={{raw}}
26+
27+
- name: Set up QEMU
1328
uses: docker/[email protected]
14-
-
15-
name: Set up Docker Buildx
29+
30+
- name: Set up Docker Buildx
1631
uses: docker/[email protected]
17-
-
18-
name: Login to DockerHub
32+
33+
- name: Login to DockerHub
1934
uses: docker/[email protected]
2035
with:
2136
username: ${{ secrets.DOCKERHUB_USERNAME }}
2237
password: ${{ secrets.DOCKERHUB_TOKEN }}
23-
-
24-
name: Build and push
38+
39+
- name: Build and push
2540
id: docker_build
2641
uses: docker/[email protected]
2742
with:
2843
push: true
29-
tags: |
30-
asaasdev/codenarc:latest
31-
asaasdev/codenarc:2.0.0
32-
-
33-
name: Image digest
34-
run: echo ${{ steps.docker_build.outputs.digest }}
44+
tags: ${{ steps.meta.outputs.tags }}
45+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/depup.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: depup
2+
on:
3+
schedule:
4+
- cron: '14 14 * * *' # Runs at 14:14 UTC every day
5+
repository_dispatch:
6+
types: [depup]
7+
workflow_dispatch:
8+
9+
jobs:
10+
reviewdog:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/[email protected]
14+
- uses: haya14busa/[email protected]
15+
id: depup
16+
with:
17+
file: Dockerfile
18+
version_name: REVIEWDOG_VERSION
19+
repo: reviewdog/reviewdog
20+
21+
- name: Create Pull Request
22+
uses: peter-evans/create-pull-request@v3
23+
with:
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
title: "chore(deps): update reviewdog to ${{ steps.depup.outputs.latest }}"
26+
commit-message: "chore(deps): update reviewdog to ${{ steps.depup.outputs.latest }}"
27+
body: |
28+
Update reviewdog to [v${{ steps.depup.outputs.latest }}](https://github.com/reviewdog/reviewdog/releases/tag/v${{ steps.depup.outputs.latest }})
29+
Compare [v${{ steps.depup.outputs.current }}...v${{ steps.depup.outputs.latest }}](https://github.com/reviewdog/reviewdog/compare/v${{ steps.depup.outputs.current }}...v${{ steps.depup.outputs.latest }})
30+
31+
This PR is auto generated by [depup workflow](https://github.com/${{ github.repository }}/actions?query=workflow%3Adepup).
32+
branch: depup/reviewdog
33+
base: master
34+
labels: "bump:minor"

.github/workflows/release.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
types:
8+
- labeled
9+
10+
jobs:
11+
release:
12+
if: github.event.action != 'labeled'
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/[email protected]
16+
17+
# Bump version on merging Pull Requests with specific labels.
18+
# (bump:major,bump:minor,bump:patch)
19+
- id: bumpr
20+
if: "!startsWith(github.ref, 'refs/tags/')"
21+
uses: haya14busa/action-bumpr@v1
22+
23+
# Update corresponding major and minor tag.
24+
# e.g. Update v1 and v1.2 when releasing v1.2.3
25+
- uses: haya14busa/[email protected]
26+
if: "!steps.bumpr.outputs.skip"
27+
with:
28+
tag: ${{ steps.bumpr.outputs.next_version }}
29+
30+
# Get tag name.
31+
- id: tag
32+
uses: haya14busa/action-cond@v1
33+
with:
34+
cond: "${{ startsWith(github.ref, 'refs/tags/') }}"
35+
if_true: ${{ github.ref }}
36+
if_false: ${{ steps.bumpr.outputs.next_version }}
37+
38+
# Create release.
39+
- uses: actions/create-release@v1
40+
if: "steps.tag.outputs.value != ''"
41+
env:
42+
# This token is provided by Actions, you do not need to create your own token
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
with:
45+
tag_name: ${{ steps.tag.outputs.value }}
46+
release_name: Release ${{ steps.tag.outputs.value }}
47+
body: ${{ steps.bumpr.outputs.message }}
48+
draft: false
49+
prerelease: false
50+
51+
publish:
52+
needs: release
53+
runs-on: ubuntu-latest
54+
steps:
55+
- uses: actions/checkout@v2
56+
57+
- uses: actions-ecosystem/action-get-latest-tag@v1
58+
id: get-latest-tag
59+
with:
60+
semver_only: true
61+
62+
- name: Set up QEMU
63+
uses: docker/[email protected]
64+
65+
- name: Set up Docker Buildx
66+
uses: docker/[email protected]
67+
68+
- name: Login to DockerHub
69+
uses: docker/[email protected]
70+
with:
71+
username: ${{ secrets.DOCKERHUB_USERNAME }}
72+
password: ${{ secrets.DOCKERHUB_TOKEN }}
73+
74+
- name: Build and push
75+
id: docker_build
76+
uses: docker/[email protected]
77+
with:
78+
push: true
79+
tags: |
80+
asaasdev/codenarc:${{ steps.get-latest-tag.outputs.tag }}
81+
asaasdev/codenarc:latest
82+
83+
- name: Image digest
84+
run: echo ${{ steps.docker_build.outputs.digest }}
85+
86+
release-check:
87+
if: github.event.action == 'labeled'
88+
runs-on: ubuntu-latest
89+
steps:
90+
- uses: actions/[email protected]
91+
92+
- name: Post bumpr status comment
93+
uses: haya14busa/action-bumpr@v1

.github/workflows/reviewdog.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: reviewdog
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
jobs:
8+
shellcheck:
9+
name: runner / shellcheck
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/[email protected]
13+
- uses: haya14busa/action-cond@v1
14+
id: reporter
15+
with:
16+
cond: ${{ github.event_name == 'pull_request' }}
17+
if_true: "github-pr-review"
18+
if_false: "github-check"
19+
- uses: reviewdog/[email protected]
20+
with:
21+
github_token: ${{ secrets.github_token }}
22+
reporter: ${{ steps.reporter.outputs.value }}
23+
level: warning
24+
25+
hadolint:
26+
name: runner / hadolint
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/[email protected]
30+
- uses: haya14busa/action-cond@v1
31+
id: reporter
32+
with:
33+
cond: ${{ github.event_name == 'pull_request' }}
34+
if_true: "github-pr-review"
35+
if_false: "github-check"
36+
- uses: reviewdog/[email protected]
37+
with:
38+
github_token: ${{ secrets.github_token }}
39+
reporter: ${{ steps.reporter.outputs.value }}
40+
level: warning
41+
42+
misspell:
43+
name: runner / misspell
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/[email protected]
47+
- uses: reviewdog/action-misspell@v1
48+
with:
49+
github_token: ${{ secrets.github_token }}
50+
reporter: github-check
51+
level: warning
52+
53+
alex:
54+
name: runner / alex
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/[email protected]
58+
- uses: reviewdog/action-alex@v1
59+
with:
60+
github_token: ${{ secrets.github_token }}
61+
reporter: github-check
62+
level: warning

Dockerfile

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,15 @@
1-
FROM openjdk:8-jdk-slim AS build
1+
FROM codenarc/codenarc:2.2.0-groovy3.0.8
22

33
RUN DEBIAN_FRONTEND=noninteractive \
4-
apt-get update && \
5-
apt-get install -y git && \
6-
apt-get clean && rm -rf /var/lib/apt/lists/*
4+
apt-get update && \
5+
apt-get install --no-install-recommends -y wget git && \
6+
apt-get clean && rm -rf /var/lib/apt/lists/*
77

8-
WORKDIR /code
8+
ENV REVIEWDOG_VERSION=v0.13.0
99

10-
RUN git clone -b master --depth 1 https://github.com/asaasdev/CodeNarc.git
10+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
11+
RUN wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b /usr/local/bin/ ${REVIEWDOG_VERSION}
1112

12-
WORKDIR /code/CodeNarc
13+
COPY entrypoint.sh /entrypoint.sh
1314

14-
RUN ./gradlew --no-daemon jar
15-
16-
FROM groovy:3.0.6
17-
18-
USER root
19-
20-
RUN DEBIAN_FRONTEND=noninteractive \
21-
apt-get update && \
22-
apt-get install -y git && \
23-
apt-get clean && rm -rf /var/lib/apt/lists/*
24-
25-
USER groovy
26-
27-
ENV CODENARC_VER=2.0.0
28-
ENV SLF4J_VER=1.7.30
29-
ENV GMETRICS_VERSION=1.1
30-
ENV GROOVY_JAR=$GROOVY_HOME/lib/*
31-
ENV HOME_JARS=/home/groovy/*
32-
33-
RUN wget https://repo1.maven.org/maven2/org/slf4j/slf4j-api/$SLF4J_VER/slf4j-api-$SLF4J_VER.jar
34-
RUN wget https://repo1.maven.org/maven2/org/slf4j/slf4j-simple/$SLF4J_VER/slf4j-simple-$SLF4J_VER.jar
35-
RUN wget https://github.com/dx42/gmetrics/releases/download/v$GMETRICS_VERSION/gmetrics-$GMETRICS_VERSION.jar
36-
37-
COPY --from=build /code/CodeNarc/build/libs/CodeNarc-$CODENARC_VER.jar odeNarc-$CODENARC_VER.jar
38-
39-
COPY codenarc /usr/bin
40-
41-
WORKDIR /app
42-
43-
ENTRYPOINT ["codenarc"]
15+
ENTRYPOINT ["/entrypoint.sh"]

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 Asaas
3+
Copyright (c) 2020 Asaas, reviewdog developers
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
# codenarc-docker
22

3-
Groovy image with CodeNarc and dependencies.
3+
CodeNarc image with reviewdog.
4+
5+
- codenarc/codenarc:2.2.0-groovy3.0.8
6+
- reviewdog v0.13.0

codenarc

Lines changed: 0 additions & 3 deletions
This file was deleted.

entrypoint.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
set -e
3+
4+
if [ -n "${GITHUB_WORKSPACE}" ] ; then
5+
cd "${GITHUB_WORKSPACE}/${INPUT_WORKDIR}" || exit
6+
fi
7+
8+
export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"
9+
10+
java -jar /lib/codenarc-all.jar -report="${INPUT_REPORT:-compact:stdout}" -rulesetfiles="${INPUT_RULESETFILES}" \
11+
| reviewdog -efm="%f:%l:%m" -efm="%f:%r:%m" \
12+
-name="codenarc" \
13+
-reporter="${INPUT_REPORTER:-github-pr-check}" \
14+
-filter-mode="${INPUT_FILTER_MODE}" \
15+
-fail-on-error="${INPUT_FAIL_ON_ERROR}" \
16+
-level="${INPUT_LEVEL}" \
17+
${INPUT_REVIEWDOG_FLAGS}

0 commit comments

Comments
 (0)