Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test github action #1

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
93 changes: 93 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Maven

on:
pull_request:
branches: [ "master" ]

jobs:
build:
name : Code Check
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'
cache: maven

# prepare Github Checks (just to display result elegantly)
- name: Prepare Build Check
uses: LouisBrunner/[email protected]
id: build_check
with:
name: Build Code
token: ${{ secrets.GITHUB_TOKEN }}
status: queued

- name: Prepare Unit tests Check
uses: LouisBrunner/[email protected]
id: unitTests_check
with:
name: Unit Tests
token: ${{ secrets.GITHUB_TOKEN }}
status: queued

# Build Code
- name: Build Starting
uses: LouisBrunner/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
check_id: ${{ steps.build_check.outputs.check_id }}
status: in_progress

- name: Build
id: build
continue-on-error: true
run: mvn --batch-mode -DskipTests -Dskip.yarn package

- name: Build Conclusion
uses: LouisBrunner/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
check_id: ${{ steps.build_check.outputs.check_id }}
status: completed
conclusion: ${{ steps.build.outcome }}

# Build Code
- name: Unit Tests Starting
uses: LouisBrunner/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
check_id: ${{ steps.unitTests_check.outputs.check_id }}
status: in_progress

- name: Unit Tests
id: unitTests
continue-on-error: true
run: mvn test '-Dtest=!org.eclipse.leshan.integration.tests.**' -DfailIfNoTests=false -Dskip.yarn

- name: Unit Tests Conclusion
uses: LouisBrunner/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
check_id: ${{ steps.unitTests_check.outputs.check_id }}
status: completed
conclusion: ${{ steps.unitTests.outcome }}

#- name: Integration Tests
# run: mvn test '-Dtest=org.eclipse.leshan.integration.tests.**' -Dsurefire.rerunFailingTestsCount=3 -DfailIfNoTests=false -Dskip.yarn -Dmaven.test.failure.ignore=true

- name: Report
uses: mikepenz/[email protected]
if: always()
with:
check_name: Tests Report
report_paths: '**/target/surefire-reports/*.xml'
fail_on_failure: true
2 changes: 2 additions & 0 deletions leshan-core/src/main/java/org/eclipse/leshan/core/LwM2m.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*******************************************************************************/
package org.eclipse.leshan.core;


// Some code modification to test github action
public interface LwM2m {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
*******************************************************************************/
package org.eclipse.leshan.core;

import static org.junit.Assert.*;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.eclipse.leshan.core.LwM2m.LwM2mVersion;
import org.eclipse.leshan.core.LwM2m.Version;
Expand All @@ -24,7 +25,7 @@
public class VersionTest {
@Test
public void is_supported_tests() {
assertTrue(LwM2mVersion.isSupported("1.0"));
assertTrue(LwM2mVersion.isSupported("&&&1.0.&zd"));
assertTrue(LwM2mVersion.isSupported("1.1"));
assertFalse(LwM2mVersion.isSupported("1.2"));
assertFalse(LwM2mVersion.isSupported(""));
Expand Down