Skip to content

Commit

Permalink
Add github actions for testing & building releases
Browse files Browse the repository at this point in the history
  • Loading branch information
stevedlawrence committed Jan 17, 2020
1 parent 4786174 commit 3da5ccb
Showing 1 changed file with 95 additions and 0 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: NiFi Daffodil Processors

on: [push, pull_request]

jobs:
test:
name: Java ${{ matrix.java_version }}, ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
java_version: [ '8.x', '9.x', '11.x' ]
os: [ 'ubuntu-latest', 'windows-latest' ]
steps:

############################################################
# Setup
############################################################

- name: Checkout Repository
uses: actions/checkout@v1.0.0

- name: Install Java
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java_version }}

############################################################
# Build/Test/Package
############################################################

- name: Compile
run: mvn compile test-compile

- name: Test
run: mvn test

- name: Install
run: mvn install -DskipTests

############################################################
# Create release if tagged
############################################################

- name: Release Info
id: release_info
run: |
if [[ '${{ github.ref }}' == refs/tags/v* ]] && [[ '${{ matrix.java_version }}' == '8.x' ]] && [[ '${{ matrix.os }}' == 'ubuntu-latest' ]]
then
echo ::set-output name=is_release::true
echo ::set-output name=tag::$(echo ${{ github.ref }} | cut -dv -f2)
else
echo ::set-output name=is_release::false
fi
shell: bash

- name: Create Release
id: create_release
if: steps.release_info.outputs.is_release == 'true'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: v${{ steps.release_info.outputs.tag }}
draft: false
prerelease: false

- name: Upload Release Artifact
if: steps.release_info.outputs.is_release == 'true'
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# This pulls from the CREATE RELEASE step above, referencing it's ID to
# get its outputs object, which include a `upload_url`
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./nifi-daffodil-nar/target/nifi-daffodil-nar-${{ steps.release_info.outputs.tag }}.nar
asset_name: nifi-daffodil-nar-${{ steps.release_info.outputs.tag }}.nar
asset_content_type: application/zip

0 comments on commit 3da5ccb

Please sign in to comment.