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

Build and deploy with GitHub Actions #247

Merged
merged 4 commits into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- [ ] the code follows the [Clean Code](https://clean-code-developer.com/) guidelines.
- [ ] the necessary tests are either created or updated.
- [ ] all status checks (Travis CI, SonarCloud, etc.) pass.
- [ ] all status checks (GitHub Actions, SonarCloud, etc.) pass.
- [ ] your commit history is cleaned up.
- [ ] you updated the changelog.
- [ ] you updated necessary documentation within [retest/docs](https://github.com/retest/docs).
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
on: [push, pull_request]

env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
beatngu13 marked this conversation as resolved.
Show resolved Hide resolved

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Check out repo
uses: actions/checkout@v2

# fetch unshallow to enable blame for Sonar
- name: Fetch unshallow
run: git fetch --prune --unshallow

- name: Set up JDK 8
uses: actions/setup-java@v1
with:
java-version: 8

- name: Cache Maven
uses: actions/cache@v1
with:
path: ~/.m2/repository/
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-

- name: Cache Sonar
uses: actions/cache@v1
with:
path: ~/.sonar/cache/
key: ${{ runner.os }}-sonar

- name: Build with Maven
run: >
mvn --batch-mode verify sonar:sonar -Pcoverage
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.organization=retest
-Dsonar.projectKey=de.retest:recheck.cli
51 changes: 51 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
on:
push:
tags: v*

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Check out repo
uses: actions/checkout@v2

- name: Set up JDK 8
uses: actions/setup-java@v1
with:
java-version: 8

- name: Cache Maven
uses: actions/cache@v1
with:
path: ~/.m2/repository/
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-

- name: Package with Maven
id: maven_package
run: |
mvn --batch-mode package -DskipTests
cd ./target/
echo "::set-output name=zip_name::$(echo recheck.cli-*-bin.zip)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we use the same wildcard directly in L50?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I know … did some research and found this issue:

actions/upload-release-asset#4

Maintainer (@IAmHughes) suggests this approach.


- name: Create release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true

- name: Upload release asset
id: upload_release_asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/${{ steps.maven_package.outputs.zip_name }}
asset_name: ${{ steps.maven_package.outputs.zip_name }}
asset_content_type: application/zip
9 changes: 0 additions & 9 deletions .travis.settings.xml

This file was deleted.

32 changes: 0 additions & 32 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# <a href="https://retest.dev"><img src="https://assets.retest.org/retest/ci/logos/recheck-screen.svg" width="300"/></a>.cli

[![Build Status](https://travis-ci.com/retest/recheck.cli.svg?branch=master)](https://travis-ci.com/retest/recheck.cli)
![.github/workflows/build.yml](https://github.com/retest/recheck.cli/workflows/.github/workflows/build.yml/badge.svg)
[![license](https://img.shields.io/badge/license-AGPL-brightgreen.svg)](https://github.com/retest/recheck.cli/blob/master/LICENSE)
[![PRs welcome](https://img.shields.io/badge/PRs-welcome-ff69b4.svg)](https://github.com/retest/recheck.cli/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
[![code with hearth by retest](https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%99%A5%20by-retest-C1D82F.svg)](https://retest.de/)
Expand Down
12 changes: 0 additions & 12 deletions ci/script.sh

This file was deleted.