Skip to content

Commit

Permalink
feat(ci): add simple workflows (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcao13 authored Aug 14, 2023
1 parent 2b38050 commit f9abc17
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 6 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: CI build and push

concurrency:
group: ci-${{ github.run_id }}
cancel-in-progress: true

on:
push:
branches:
- main
- v[0-9]+
- v[0-9]+.[0-9]+
- cryostat-v[0-9]+.[0-9]+
pull_request_target:
types:
- opened
- reopened
- synchronize
- labeled
- unlabeled
branches:
- main
- v[0-9]+
- v[0-9]+.[0-9]+
- cryostat-v[0-9]+.[0-9]+

jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '17', '20' ]
env:
TESTCONTAINERS_RYUK_DISABLED: true
cache-name: cache-yarn
name: Build and test Java ${{ matrix.java }}
permissions:
packages: write
contents: read
if: ${{ github.repository_owner == 'cryostatio' }}
steps:
# - name: Fail if PR and safe-to-test label NOT applied
# if: ${{ github.event_name == 'pull_request_target' && !contains(github.event.pull_request.labels.*.name, 'safe-to-test') }}
# run: exit 1
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
submodules: true
fetch-depth: 0
- uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: 'maven'
- name: maven-settings
uses: s4u/maven-settings-action@v2
with:
servers: '[{"id": "github", "username": "dummy", "password": "${{ secrets.GITHUB_TOKEN }}"}]'
githubServer: false
- run: git submodule init && git submodule update
- name: Cache yarn packages
uses: actions/cache@v3
with:
path: "./src/main/webui/.yarn/cache"
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Initialize web assets
run: |
cd src/main/webui
yarn install && yarn yarn:frzinstall
cd -
- name: Update podman
run: |
sudo apt-get -y purge podman
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/Release.key | gpg --dearmor | sudo tee /etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg > /dev/null
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg] \
https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/ /" \
| sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list > /dev/null
sudo apt-get update -qq
sudo apt-get -qq -y install podman
- name: Install podman-docker
run: |
sudo apt-get -y purge moby-cli
sudo apt install -y podman-docker
- name: Setup docker host
run: echo "DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock" >> "$GITHUB_ENV"
- name: Set up testcontainers for podman
run: |
echo ryuk.container.privileged=true > ~/.testcontainers.properties
- run: systemctl --user enable --now podman.socket
- name: Build db image
run: sh db/build.sh
- name: Run tests
run: ./mvnw -B -U clean verify
28 changes: 28 additions & 0 deletions .github/workflows/dependent-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Dependent Issues

on:
pull_request_target:
types:
- opened
- edited
- reopened
- synchronize

# Schedule a daily check. Used in referencing cross-repository
# issues or pull requests
schedule:
- cron: '0 0 * * *'

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: z0al/dependent-issues@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# (Optional) Enable checking for dependencies in issues.
# Enable by setting the value to "on". Default "off"
check_issues: off

keywords: depends on, blocked by, based on
19 changes: 19 additions & 0 deletions .github/workflows/pr-labeled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Require semantic labels

on:
pull_request:
types:
- opened
- labeled
- unlabeled
- synchronize

jobs:
check-pr-label-and-comment:
runs-on: ubuntu-latest
steps:
- uses: yashhy/[email protected]
with:
# This list is duplicated from release-drafter.yml
required_labels: 'chore,ci,cleanup,docs,feat,fix,perf,refactor,style,test'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Cryostat3

[![CI build and push](https://github.com/cryostatio/cryostat3/actions/workflows/ci.yaml/badge.svg)](https://github.com/cryostatio/cryostat3/actions/workflows/ci.yaml)
[![Google Group : Cryostat Development](https://img.shields.io/badge/Google%20Group-Cryostat%20Development-blue.svg)](https://groups.google.com/g/cryostat-development)

This project uses Quarkus, the Supersonic Subatomic Java Framework.

If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ .
Expand Down
12 changes: 6 additions & 6 deletions src/test/java/itest/bases/StandardSelfTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ public abstract class StandardSelfTest {
public static void waitForJdp() {
Logger logger = Logger.getLogger(StandardSelfTest.class);
boolean found = false;
long deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(15);
long deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(30);
String selfURL = getSelfReferenceConnectUrl();
while (!found && System.nanoTime() < deadline) {
logger.infov(
"Waiting for self-discovery at {0} via JDP...", getSelfReferenceConnectUrl());
logger.infov("Waiting for self-discovery at {0} via JDP...", selfURL);
CompletableFuture<Boolean> queryFound = new CompletableFuture<>();
ForkJoinPool.commonPool()
.submit(
Expand All @@ -90,11 +90,11 @@ public static void waitForJdp() {
arr.getJsonObject(0)
.getString(
"connectUrl"),
getSelfReferenceConnectUrl()));
selfURL));
});
});
try {
found |= queryFound.get(500, TimeUnit.MILLISECONDS);
found |= queryFound.get(1000, TimeUnit.MILLISECONDS);
Thread.sleep(1000);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
logger.warn(e);
Expand Down Expand Up @@ -169,7 +169,7 @@ public static String getSelfReferenceConnectUrl() {
});
});
});
String hostname = hostnameFuture.get(2, TimeUnit.SECONDS);
String hostname = hostnameFuture.get(5, TimeUnit.SECONDS);

return String.format("service:jmx:rmi:///jndi/rmi://%s:%d/jmxrmi", hostname, 9091);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
Expand Down

0 comments on commit f9abc17

Please sign in to comment.