Skip to content

Commit 6bf7110

Browse files
authored
Replace travis with github actions (#102)
1 parent 21e6bdf commit 6bf7110

8 files changed

Lines changed: 130 additions & 65 deletions

File tree

.github/workflows/check.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Run dependency and spotbugs checks
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Run tests"]
6+
types:
7+
- completed
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
run-checks:
14+
name: Run dependency and spotbugs checks
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Setup java
21+
uses: actions/setup-java@v4
22+
with:
23+
java-version: '8'
24+
distribution: 'temurin'
25+
cache: maven
26+
27+
- name: Run dependency check
28+
run: |
29+
./mvnw org.owasp:dependency-check-maven:check
30+
31+
- name: Archive dependency report
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: dependency-report
35+
path: target/dependency-check-report.html
36+
37+
- name: Run spotbugs check
38+
run: |
39+
./mvnw spotbugs:check

.github/workflows/publish.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Publish to maven repository
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
package_and_publish:
13+
name: Publish to maven repository
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Setup java SDK 8
19+
uses: actions/setup-java@v4
20+
with:
21+
java-version: '8'
22+
distribution: 'temurin'
23+
cache: maven
24+
-
25+
name: Import GPG key
26+
uses: crazy-max/ghaction-import-gpg@v6
27+
with:
28+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
29+
#passphrase: ${{ secrets.PASSPHRASE }}
30+
31+
- name: Create bundle and upload to oss.sonatype.org (staging)
32+
# Fail on first error
33+
run: |
34+
set -e
35+
version=${{ github.event.release.name }}
36+
artifact=smart-id-java-client-$version
37+
echo "[INFO] Artifact name: $artifact"
38+
./mvnw versions:set -DnewVersion="$version"
39+
./mvnw package -DskipTests
40+
gpg -ab pom.xml
41+
cd target
42+
gpg -ab $artifact.jar
43+
gpg -ab $artifact-sources.jar
44+
gpg -ab $artifact-javadoc.jar
45+
jar -cvf bundle.jar ../pom.xml ../pom.xml.asc $artifact.jar $artifact.jar.asc $artifact-javadoc.jar $artifact-javadoc.jar.asc $artifact-sources.jar $artifact-sources.jar.asc
46+
CODE=$(curl -w "%{http_code}" -o curl_response.txt -s -ujorlina2 -u ${{ secrets.SONATYPEUN }}:${{ secrets.SONATYPEPW }} --request POST -F "file=@bundle.jar" "https://oss.sonatype.org/service/local/staging/bundle_upload")
47+
echo "[INFO] ------------------------------------------------------------------------"
48+
echo "[INFO] Upload to oss.sonatype.org ResponseCode: $CODE"
49+
cat curl_response.txt
50+
echo -e "\n[INFO] Login to oss.sonatype.org for releasing $artifact"
51+
echo "[INFO] ------------------------------------------------------------------------"
52+
[[ $CODE == 201 ]] && exit 0 || exit 1
53+

.github/workflows/tests.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Run tests
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
run-tests:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
java-version: ['8', '11', '17']
18+
name: Run tests with java SDK ${{ matrix.java-version }}
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Setup java
24+
uses: actions/setup-java@v4
25+
with:
26+
java-version: ${{ matrix.java-version }}
27+
distribution: 'temurin'
28+
cache: maven
29+
30+
- name: Check JAVA version (v${{ matrix.java-version }})
31+
run: java -version
32+
33+
- name: Run tests
34+
# Fail on first error
35+
run: |
36+
set -e
37+
mvn test

.travis.yml

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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Build Status](https://app.travis-ci.com/SK-EID/smart-id-java-client.svg?branch=master)](https://app.travis-ci.com/SK-EID/smart-id-java-client)
1+
[![Tests](https://github.com/SK-EID/smart-id-java-client/actions/workflows/tests.yaml/badge.svg)](https://github.com/SK-EID/smart-id-java-client/actions/workflows/tests.yaml)
22
[![Dependencies](https://img.shields.io/librariesio/release/maven/ee.sk.smartid:smart-id-java-client)](https://libraries.io/maven/ee.sk.smartid:smart-id-java-client)
33
[![Coverage Status](https://img.shields.io/codecov/c/github/SK-EID/smart-id-java-client.svg)](https://codecov.io/github/SK-EID/smart-id-java-client/)
44
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/ee.sk.smartid/smart-id-java-client/badge.svg)](https://maven-badges.herokuapp.com/maven-central/ee.sk.smartid/smart-id-java-client)

private.key.enc

-2.5 KB
Binary file not shown.

publish.sh

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

travis.sh

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

0 commit comments

Comments
 (0)