Skip to content

Commit

Permalink
feat(#217): Add Github Workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
rm3l committed Mar 6, 2021
1 parent 8ec9a8c commit d31b370
Show file tree
Hide file tree
Showing 5 changed files with 287 additions and 2 deletions.
156 changes: 156 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# Copyright (c) 2021 Armel Soro
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
name: CI

on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v2

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

- uses: actions/cache@master
#Using master because of the multi-paths feature (reportedly only available on master at the moment)
with:
path: |
~/.gradle/wrapper
~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Prepare scripts
run: |
chmod +x gradlew
chmod +x tools/*.sh
- name: Prepare local.properties
run: |
echo "github.username=${MAONI_GITHUB_USERNAME}" > local.properties
echo "github.passwordToken=${MAONI_GITHUB_PASSWORD_TOKEN}" >> local.properties
echo "jira.rest.baseUrl=${MAONI_JIRA_REST_BASEURL}" >> local.properties
echo "jira.username=${MAONI_JIRA_USERNAME}" >> local.properties
echo "jira.password=${MAONI_JIRA_PASSWORD}" >> local.properties
- name: Prepare maoni-keystore.properties
run: |
mkdir -p ~/.droid
echo "keystore=${KEYSTORE}" > ~/.droid/maoni-keystore.properties
echo "storePassword=${STORE_PASSWORD}" >> ~/.droid/maoni-keystore.properties
echo "keyAlias=${KEY_ALIAS}" >> ~/.droid/maoni-keystore.properties
echo "keyPassword=${KEY_PASSWORD}" >> ~/.droid/maoni-keystore.properties
- name: Download dependencies
run: ./gradlew androidDependencies --stacktrace

- name: Run Tests
run: ./gradlew clean lintDebug testDebug --stacktrace

- name: Build APK
run: ./gradlew assembleDebug --stacktrace

- name: Archive sample app artifacts
uses: actions/upload-artifact@v2
with:
name: maoni-sample build outputs
path: |
maoni-sample/build/outputs
- name: Archive build reports
uses: actions/upload-artifact@v2
with:
name: reports
path: |
**/build/reports
- name: Archive test results
uses: actions/upload-artifact@v2
with:
name: reports
path: |
**/build/test-results
publishLibraries:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
needs: build

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v2

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

# Base64 decodes and pipes the GPG key content into the secret file
- name: Prepare environment
env:
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
run: |
git fetch --unshallow
sudo bash -c "echo '$GPG_KEY_CONTENTS' | base64 -d > '$SIGNING_SECRET_KEY_RING_FILE'"
- uses: actions/cache@master
#Using master because of the multi-paths feature (reportedly only available on master at the moment)
with:
path: |
~/.gradle/wrapper
~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew

# Generates other artifacts (javadocJar is optional)
- name: Build other artifacts
run: ./gradlew javadoc

# Runs upload, and then closes & releases the repository
- name: Publish to MavenCentral
run: ./gradlew publishToSonatype --max-workers 1 closeAndReleaseStagingRepository
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
41 changes: 41 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) 2021 Armel Soro
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
name: Coverage

on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches: [ master ]

jobs:
report_coverage:

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v2

- name: Code Coverage
run: bash <(curl -s https://codecov.io/bash)
44 changes: 44 additions & 0 deletions .github/workflows/translations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright (c) 2021 Armel Soro
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
name: Translations

on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches: [ master ]

jobs:
import_translations:

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v2

- name: Prepare scripts
run: chmod +x tools/import-translations-github.sh

- name: Import translations from Crowdin if needed
run: ./tools/import-translations-github.sh
44 changes: 44 additions & 0 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright (c) 2021 Armel Soro
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
name: Website

on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches: [ master ]

jobs:
update_gh_pages_branch:

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v2

- name: Prepare scripts
run: chmod +x tools/update-github-pages.sh

- name: Update Github Pages branch
run: ./tools/update-github-pages.sh
4 changes: 2 additions & 2 deletions tools/import-translations-github.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ if [ "$CIRCLE_PULL_REQUEST" == "" ]; then

#go to home and setup git
cd $HOME
git config --global user.email "circle_ci@rm3l.org"
git config --global user.name "Cir Cle"
git config --global user.email "maoni+github_actions@rm3l.org"
git config --global user.name "Maoni Github Actions"

git clone --branch=master https://$GITHUB_API_KEY@github.com/rm3l/maoni.git master > /dev/null

Expand Down

0 comments on commit d31b370

Please sign in to comment.