You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before the practice make sure that the maven JDK and your local JDK are the same!
First we need to create a workflow file in the main branch:
file: .github/workflows/main.yml
In main.yml file we start giving the actions name to the file and use the "pull request" event in the action "on"
name: CI Testing Actionon:
pull_request:
branch:
- mainpush:
branch:
- main
Configures the job to run on the latest version of an Ubuntu Linux runner. This means that the job will execute on a fresh virtual machine hosted by GitHub.
jobs:
build:
runs-on: ubuntu-latest
Each item nested under this section is a separate action or shell script. The uses keyword specifies that this step will run v3 of the actions/checkout action. This is an action that checks out your repository onto the runner, allowing you to run scripts or other actions against your code . You should use the checkout action any time your workflow will run against the repository's code.
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11uses: actions/setup-java@v3with:
java-version: '11'distribution: 'temurin'cache: maven
This step uses the actions/setup-java@v3 action to install the specified version of java. This puts both the node and npm commands in your PATH.
- name: Build with Mavenrun: mvn -B package --file pom.xml
The run keyword tells the job to execute a command on the runner. In this case, you are using mvn to install the file testing package.
This should be the result:
name: Java CI with Mavenon:
pull_request:
branch:
- mainpush:
branch:
- mainjobs:
build:
runs-on: ubuntu-lateststeps:
- uses: actions/checkout@v3
- name: Set up JDK 11uses: actions/setup-java@v3with:
java-version: '11'distribution: 'temurin'cache: maven
- name: Build with Mavenrun: mvn -B package --file pom.xml