Skip to content

Commit

Permalink
release to sonatype using GH Actions (#889)
Browse files Browse the repository at this point in the history
* release to sonatype using GH Actions

* move basic checks to GH Actions

* added unit tests workflow

* check headers

* remove unit tests from travis job

* try this hack

* integration tests with minikube

* integration tests for kube lease

* fix name

* also enable on release branch

* run tests everyday at 2am

* integration tests with maven

* Fix CI release

* sonatypeProfileName "com.lightbend" in projectSettings
* correction of tags

* add a timeout to the hanging step

on travis this step took 6.41, so 10m seems like a reasonable start.
hopefully after the timeout we'll be able to see some logs...

* Add more logging

it's shown after the timeout

* Add missing '&'

* Scala 2.13.5 everywhere

Co-authored-by: Patrik Nordwall <patrik.nordwall@gmail.com>
Co-authored-by: Arnout Engelen <arnout@bzzt.net>
  • Loading branch information
3 people authored Apr 26, 2021
1 parent 56a745f commit 329d794
Show file tree
Hide file tree
Showing 15 changed files with 403 additions and 254 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Basic checks

on:
pull_request:
push:
branches:
- master
- release-*
tags-ignore: [ v.* ]

jobs:
check-code-style:
name: Check Code Style
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
fetch-depth: 0

- name: Checkout GitHub merge
if: github.event.pull_request
run: |-
git fetch origin pull/${{ github.event.pull_request.number }}/merge:scratch
git checkout scratch
- name: Set up JDK 11
uses: olafurpg/setup-scala@v10
with:
java-version: adopt@1.11.0-9

- name: Cache Coursier cache
uses: coursier/cache-action@v5

- name: Code style check, compilation and binary-compatibility check
run: sbt "scalafmtCheckAll;headerCheckAll;+IntegrationTest/compile;mimaReportBinaryIssues"

check-docs:
name: Check Docs
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Checkout GitHub merge
if: github.event.pull_request
run: |-
git fetch origin pull/${{ github.event.pull_request.number }}/merge:scratch
git checkout scratch
- name: Set up JDK 11
uses: olafurpg/setup-scala@v10
with:
java-version: adopt@1.11.0-9

- name: Cache Coursier cache
uses: coursier/cache-action@v5

- name: Create all API docs for artifacts/website and all reference docs
run: sbt "unidoc; docs/paradox"
46 changes: 46 additions & 0 deletions .github/workflows/integration-tests-kube-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Integration test for Kubernetes API

on:
pull_request:
push:
branches:
- master
- release-*
tags-ignore: [ v.* ]
schedule:
- cron: '0 2 * * *' # every day 2am

jobs:
integration-test:
name: Integration Tests for Kubernetes API
runs-on: ubuntu-18.04
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Checkout GitHub merge
if: github.event.pull_request
run: |-
git fetch origin pull/${{ github.event.pull_request.number }}/merge:scratch
git checkout scratch
- name: Set up JDK adopt@1.11.0-9
uses: olafurpg/setup-scala@v10
with:
java-version: adopt@1.11.0-9

- name: Cache Coursier cache
uses: coursier/cache-action@v5

- name: Start docker
run: |-
./scripts/setup-minikube-for-linux.sh
./integration-test/kubernetes-api/test.sh
- name: Print logs on failure
if: ${{ failure() }}
run: find . -name "*.log" -exec ./scripts/cat-log.sh {} \;
46 changes: 46 additions & 0 deletions .github/workflows/integration-tests-kube-dns.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Integration test for Kubernetes DNS

on:
pull_request:
push:
branches:
- master
- release-*
tags-ignore: [ v.* ]
schedule:
- cron: '0 2 * * *' # every day 2am

jobs:
integration-test:
name: Integration Tests for Kubernetes DNS
runs-on: ubuntu-18.04
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Checkout GitHub merge
if: github.event.pull_request
run: |-
git fetch origin pull/${{ github.event.pull_request.number }}/merge:scratch
git checkout scratch
- name: Set up JDK adopt@1.11.0-9
uses: olafurpg/setup-scala@v10
with:
java-version: adopt@1.11.0-9

- name: Cache Coursier cache
uses: coursier/cache-action@v5

- name: Start docker
run: |-
./scripts/setup-minikube-for-linux.sh
./integration-test/kubernetes-dns/test.sh
- name: Print logs on failure
if: ${{ failure() }}
run: find . -name "*.log" -exec ./scripts/cat-log.sh {} \;
56 changes: 56 additions & 0 deletions .github/workflows/integration-tests-lease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Integration test for Kubernetes Lease

on:
pull_request:
push:
branches:
- master
- release-*
tags-ignore: [ v.* ]
schedule:
- cron: '0 2 * * *' # every day 2am

jobs:
integration-test:
name: Integration test for Kubernetes Lease
runs-on: ubuntu-18.04
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Checkout GitHub merge
if: github.event.pull_request
run: |-
git fetch origin pull/${{ github.event.pull_request.number }}/merge:scratch
git checkout scratch
- name: Set up JDK adopt@1.11.0-9
uses: olafurpg/setup-scala@v10
with:
java-version: adopt@1.11.0-9

- name: Cache Coursier cache
uses: coursier/cache-action@v5

- name: Start docker
timeout-minutes: 15
run: |-
echo 'Starting minikube'
./scripts/setup-minikube-for-linux.sh
echo 'Creating namespace'
kubectl create namespace lease
echo 'Creating resources'
kubectl apply -f ./lease-kubernetes/lease.yml
echo 'Adding proxy port'
kubectl proxy --port=8080 &
echo 'Running tests'
sbt ";lease-kubernetes/it:test"
./lease-kubernetes-int-test/minikube-test.sh
- name: Print logs on failure
if: ${{ failure() }}
run: find . -name "*.log" -exec ./scripts/cat-log.sh {} \;
47 changes: 47 additions & 0 deletions .github/workflows/integration-tests-maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Integration test for Kubernetes API with Maven

on:
pull_request:
push:
branches:
- master
- release-*
tags-ignore: [ v.* ]
# Different than its sibilings, we don't configure this workflow to run as a cron job.
# The cron build compiles against Akka 2.6 and Akka HTTP 10.2, but the Maven example uses 2.5 and 10.1
# see https://github.com/akka/akka-management/issues/744

jobs:
integration-test:
name: Integration Tests for Kubernetes API with Maven
runs-on: ubuntu-18.04
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Checkout GitHub merge
if: github.event.pull_request
run: |-
git fetch origin pull/${{ github.event.pull_request.number }}/merge:scratch
git checkout scratch
- name: Set up JDK adopt@1.11.0-9
uses: olafurpg/setup-scala@v10
with:
java-version: adopt@1.11.0-9

- name: Cache Coursier cache
uses: coursier/cache-action@v5

- name: Start docker
run: |-
./scripts/setup-minikube-for-linux.sh
./integration-test/kubernetes-api-java/test.sh
- name: Print logs on failure
if: ${{ failure() }}
run: find . -name "*.log" -exec ./scripts/cat-log.sh {} \;
1 change: 1 addition & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
# branches to consider in the event; optional, defaults to all
branches:
- master
- release-*

jobs:
update_release_draft:
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release

on:
push:
branches:
- master
- release-*
tags: ["*"]

jobs:
release:
# runs on main repo only
if: github.repository == 'akka/akka-management'
name: Release
# the release environment provides access to secrets required in the release process
# https://github.com/akka/akka-management/settings/environments
environment: release
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
fetch-depth: 0

- name: Checkout GitHub merge
if: github.event.pull_request
run: |-
git fetch origin pull/${{ github.event.pull_request.number }}/merge:scratch
git checkout scratch
- name: Setup Scala with JDK 8
uses: olafurpg/setup-scala@v10

- name: Cache Coursier cache
uses: coursier/cache-action@v5

- name: Whitesource check policies and update
env:
WHITESOURCE_PASSWORD: ${{ secrets.WHITESOURCE_PASSWORD }}
run: sbt ";whitesourceCheckPolicies ;whitesourceUpdate"

- name: Publish artifacts for all Scala versions
env:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
run: sbt ci-release

- name: Publish API and reference documentation
env:
GUSTAV_KEY: ${{ secrets.GUSTAV_KEY }}
GUSTAV_PASSPHRASE: ${{ secrets.GUSTAV_PASSPHRASE }}
run: |+
eval "$(ssh-agent -s)"
echo $GUSTAV_KEY | base64 -di > .github/id_rsa
chmod 600 .github/id_rsa
ssh-keygen -p -P "$GUSTAV_PASSPHRASE" -N "" -f .github/id_rsa
ssh-add .github/id_rsa
sbt "++2.13.5 docs/publishRsync"
55 changes: 55 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Unit Tests

on:
pull_request:
push:
branches:
- master
- release-*
tags-ignore: [ v.* ]
schedule:
- cron: '0 2 * * *' # every day 2am

jobs:
test:
name: Build and Test
runs-on: ubuntu-18.04
strategy:
fail-fast: false
matrix:
include:
- { java-version: adopt@1.8, scala-version: 2.12.13, sbt-opts: '' }
- { java-version: adopt@1.11.0-9, scala-version: 2.12.13, sbt-opts: '-J-XX:+UnlockExperimentalVMOptions -J-XX:+UseJVMCICompiler' }
- { java-version: adopt@1.8, scala-version: 2.13.5, sbt-opts: '' }
- { java-version: adopt@1.11.0-9, scala-version: 2.13.5, sbt-opts: '-J-XX:+UnlockExperimentalVMOptions -J-XX:+UseJVMCICompiler' }
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Checkout GitHub merge
if: github.event.pull_request
run: |-
git fetch origin pull/${{ github.event.pull_request.number }}/merge:scratch
git checkout scratch
- name: Setup JDK ${{ matrix.java-version }}
uses: olafurpg/setup-scala@v10
with:
java-version: ${{ matrix.java-version }}

- name: Cache Coursier cache
uses: coursier/cache-action@v5

# hack to solve "Cannot assign requested address" issue - https://github.community/t/github-action-and-oserror-errno-99-cannot-assign-requested-address/173973/1
- name: Add the current IP address, long hostname and short hostname record to /etc/hosts file
run: |
echo -e "$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)\t$(hostname -f) $(hostname -s)" | sudo tee -a /etc/hosts
- name: Run tests with Scala ${{ matrix.scala-version }} and Java ${{ matrix.java-version }}
run: sbt "++${{ matrix.scala-version }} test" ${{ matrix.sbt-opts }}

- name: Print logs on failure
if: ${{ failure() }}
run: find . -name "*.log" -exec ./scripts/cat-log.sh {} \;
Loading

0 comments on commit 329d794

Please sign in to comment.