[small]Feature/53 #76
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI - Test | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
env: | |
LASTFM_API_KEY: ${{ secrets.LASTFM_KEY }} | |
LASTFM_API_SECRET: ${{ secrets.LASTFM_SECRET }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
cache: gradle | |
- name: Install Xvfb | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y xvfb | |
- name: Setup xvfb and run tests | |
run: Xvfb :1 -screen 0 1600x1200x24 & | |
- run: ./gradlew test jacocoTestReport sonar | |
env: | |
DISPLAY: :1 | |
- name: Tear down xvfb | |
run: killall Xvfb | |
- name: Setting LastFM API Key and Secret | |
run: | | |
echo "LASTFM_API_KEY=$LASTFM_API_KEY" >> gradle.properties | |
echo "LASTFM_API_SECRET=$LASTFM_API_SECRET" >> gradle.properties | |
./gradlew settingCredentials | |
- name: Packaging | |
run: ./gradlew distZip | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: jmetadata | |
path: build/distributions/ | |
retention-days: 30 |