diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..590e58c --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true + +charset = utf-8 + +indent_style = space +indent_size = 4 + +[*.yml] +indent_size = 2 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..c75e875 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: weekly diff --git a/.github/workflows/automerge-dependabot.yml b/.github/workflows/automerge-dependabot.yml new file mode 100644 index 0000000..477c6b7 --- /dev/null +++ b/.github/workflows/automerge-dependabot.yml @@ -0,0 +1,19 @@ +name: Dependabot auto-merge + +on: + workflow_call: + +permissions: + pull-requests: write + contents: write + +jobs: + dependabot: + runs-on: ubuntu-latest + if: ${{ github.actor == 'dependabot[bot]' }} + steps: + - name: Enable auto-merge for Dependabot PRs + run: gh pr merge --auto --rebase "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0f8bea9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,48 @@ +name: Build + +on: + workflow_call: + inputs: + java-version: + type: string + description: The Java version to set up. See https://github.com/actions/setup-java/blob/v4/action.yml#L6 + default: '21' + secrets: + GH_TOKEN_REPO: + description: Token to access private repositories of the lernejo org + required: true + CODECOV_TOKEN: + description: Repository Codecov token. See https://github.com/codecov/codecov-action/blob/v4/action.yml#L5 + required: true + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: ${{ inputs.java-version }} + cache: maven + + - name: Debug JDK info + run: | + java -version + ./mvnw -version + echo $JAVA_HOME + + - name: Run tests + run: ./mvnw -U test -Dgithub_token="$GH_TOKEN_REPO" -DfailIfNoTests + env: + GH_TOKEN_REPO: ${{ secrets.GH_TOKEN_REPO }} + + - uses: codecov/codecov-action@v4 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + if: ${{ env.CODECOV_TOKEN != '' }} + with: + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3d3b2e4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +### IntelliJ IDEA ### +.idea/ +*.iml diff --git a/README.md b/README.md index 9eda5e3..4e722b9 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # reusable-workflows + Reusable GH workflows for the grading ecosystem