name: signal-cli CI
-on: [push, pull_request]
+on: [ push, pull_request ]
jobs:
build:
java: [ '11', '16' ]
steps:
- - uses: actions/checkout@v1
- - name: Set up JDK
- uses: actions/setup-java@v1
- with:
- java-version: ${{ matrix.java }}
- - name: Build with Gradle
- run: ./gradlew build
- - name: Compress archive
- run: gzip -n -9 build/distributions/signal-cli-*.tar
- - name: Archive production artifacts
- uses: actions/upload-artifact@v2
- with:
- name: signal-cli-archive-${{ matrix.java }}
- path: build/distributions/signal-cli-*.tar.gz
+ - uses: actions/checkout@v1
+ - name: Set up JDK
+ uses: actions/setup-java@v1
+ with:
+ java-version: ${{ matrix.java }}
+ - name: Build with Gradle
+ run: ./gradlew build
+ - name: Compress archive
+ run: gzip -n -9 build/distributions/signal-cli-*.tar
+ - name: Archive production artifacts
+ uses: actions/upload-artifact@v2
+ with:
+ name: signal-cli-archive-${{ matrix.java }}
+ path: build/distributions/signal-cli-*.tar.gz
on:
push:
- branches: [master, ]
+ branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
- branches: [master]
+ branches: [ master ]
schedule:
- cron: '0 7 * * 4'
steps:
- - name: Setup Java JDK
- uses: actions/setup-java@v1
- with:
- java-version: 11
-
- - name: Checkout repository
- uses: actions/checkout@v2
- with:
- # We must fetch at least the immediate parents so that if this is
- # a pull request then we can checkout the head.
- fetch-depth: 2
-
- # If this run was triggered by a pull request event, then checkout
- # the head of the pull request instead of the merge commit.
- - run: git checkout HEAD^2
- if: ${{ github.event_name == 'pull_request' }}
-
- # Initializes the CodeQL tools for scanning.
- - name: Initialize CodeQL
- uses: github/codeql-action/init@v1
- # Override language selection by uncommenting this and choosing your languages
- # with:
- # languages: go, javascript, csharp, python, cpp, java
-
- # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
- # If this step fails, then you should remove it and run the build manually (see below)
- - name: Autobuild
- uses: github/codeql-action/autobuild@v1
-
- # âšī¸ Command-line programs to run using the OS shell.
- # đ https://git.io/JvXDl
-
- # âī¸ If the Autobuild fails above, remove it and uncomment the following three lines
- # and modify them (or add more) to build your code if your project
- # uses a compiled language
-
- #- run: |
- # make bootstrap
- # make release
-
- - name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v1
+ - name: Setup Java JDK
+ uses: actions/setup-java@v1
+ with:
+ java-version: 11
+
+ - name: Checkout repository
+ uses: actions/checkout@v2
+ with:
+ # We must fetch at least the immediate parents so that if this is
+ # a pull request then we can checkout the head.
+ fetch-depth: 2
+
+ # If this run was triggered by a pull request event, then checkout
+ # the head of the pull request instead of the merge commit.
+ - run: git checkout HEAD^2
+ if: ${{ github.event_name == 'pull_request' }}
+
+ # Initializes the CodeQL tools for scanning.
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v1
+ # Override language selection by uncommenting this and choosing your languages
+ # with:
+ # languages: go, javascript, csharp, python, cpp, java
+
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
+ # If this step fails, then you should remove it and run the build manually (see below)
+ - name: Autobuild
+ uses: github/codeql-action/autobuild@v1
+
+ # âšī¸ Command-line programs to run using the OS shell.
+ # đ https://git.io/JvXDl
+
+ # âī¸ If the Autobuild fails above, remove it and uncomment the following three lines
+ # and modify them (or add more) to build your code if your project
+ # uses a compiled language
+
+ #- run: |
+ # make bootstrap
+ # make release
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v1
<option name="JD_P_AT_EMPTY_LINES" value="false" />
</JavaCodeStyleSettings>
<JetCodeStyleSettings>
- <option name="PACKAGES_TO_USE_STAR_IMPORTS">
- <value>
- <package name="java.util" alias="false" withSubpackages="false" />
- <package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
- <package name="io.ktor" alias="false" withSubpackages="true" />
- </value>
- </option>
- <option name="PACKAGES_IMPORT_LAYOUT">
- <value>
- <package name="" alias="false" withSubpackages="true" />
- <package name="java" alias="false" withSubpackages="true" />
- <package name="javax" alias="false" withSubpackages="true" />
- <package name="kotlin" alias="false" withSubpackages="true" />
- <package name="" alias="true" withSubpackages="true" />
- </value>
- </option>
+ <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
<rules />
</arrangement>
</codeStyleSettings>
+ <codeStyleSettings language="kotlin">
+ <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
+ </codeStyleSettings>
</code_scheme>
</component>
\ No newline at end of file
tasks.withType<Jar> {
manifest {
attributes(
- "Implementation-Title" to project.name,
- "Implementation-Version" to project.version,
- "Main-Class" to application.mainClass.get()
+ "Implementation-Title" to project.name,
+ "Implementation-Version" to project.version,
+ "Main-Class" to application.mainClass.get()
)
}
}
var graalVMHome = ""
doFirst {
graalVMHome = System.getenv("GRAALVM_HOME")
- ?: throw GradleException("Required GRAALVM_HOME environment variable not set.")
+ ?: throw GradleException("Required GRAALVM_HOME environment variable not set.")
}
doLast {
exec {
workingDir = File(".")
- commandLine("$graalVMHome/bin/native-image",
- "-H:Path=$nativeBinaryOutputPath",
- "-H:Name=$nativeBinaryName",
- "-H:JNIConfigurationFiles=graalvm-config-dir/jni-config.json",
- "-H:DynamicProxyConfigurationFiles=graalvm-config-dir/proxy-config.json",
- "-H:ResourceConfigurationFiles=graalvm-config-dir/resource-config.json",
- "-H:ReflectionConfigurationFiles=graalvm-config-dir/reflect-config.json",
- "--no-fallback",
- "--allow-incomplete-classpath",
- "--report-unsupported-elements-at-runtime",
- "--enable-url-protocols=http,https",
- "--enable-https",
- "--enable-all-security-services",
- "-cp",
- sourceSets.main.get().runtimeClasspath.asPath,
- application.mainClass.get())
+ commandLine(
+ "$graalVMHome/bin/native-image",
+ "-H:Path=$nativeBinaryOutputPath",
+ "-H:Name=$nativeBinaryName",
+ "-H:JNIConfigurationFiles=graalvm-config-dir/jni-config.json",
+ "-H:DynamicProxyConfigurationFiles=graalvm-config-dir/proxy-config.json",
+ "-H:ResourceConfigurationFiles=graalvm-config-dir/resource-config.json",
+ "-H:ReflectionConfigurationFiles=graalvm-config-dir/reflect-config.json",
+ "--no-fallback",
+ "--allow-incomplete-classpath",
+ "--report-unsupported-elements-at-runtime",
+ "--enable-url-protocols=http,https",
+ "--enable-https",
+ "--enable-all-security-services",
+ "-cp",
+ sourceSets.main.get().runtimeClasspath.asPath,
+ application.mainClass.get()
+ )
}
}
}
class CheckLibVersionsPlugin : Plugin<Project> {
override fun apply(project: Project) {
project.task("checkLibVersions") {
- description = "Find any 3rd party libraries which have released new versions to the central Maven repo since we last upgraded."
+ description =
+ "Find any 3rd party libraries which have released new versions to the central Maven repo since we last upgraded."
doLast {
project.configurations.flatMap { it.allDependencies }
- .toSet()
- .forEach { checkDependency(it) }
+ .toSet()
+ .forEach { checkDependency(it) }
}
}
}
#!/bin/sh
if [ $# -ne 2 ]; then
- echo "Usage: $0 NUMBER_1 NUMBER_2"
- exit 1
+ echo "Usage: $0 NUMBER_1 NUMBER_2"
+ exit 1
fi
set -e
# To update graalvm config, set GRAALVM_HOME, e.g:
# export GRAALVM_HOME=/usr/lib/jvm/java-11-graalvm
if [ ! -z "$GRAALVM_HOME" ]; then
- export JAVA_HOME=$GRAALVM_HOME
- export SIGNAL_CLI_OPTS='-agentlib:native-image-agent=config-merge-dir=graalvm-config-dir/'
+ export JAVA_HOME=$GRAALVM_HOME
+ export SIGNAL_CLI_OPTS='-agentlib:native-image-agent=config-merge-dir=graalvm-config-dir/'
fi
export SIGNAL_CLI="$PWD/build/install/signal-cli/bin/signal-cli"
./gradlew installDist
function run() {
- set -x
- "$SIGNAL_CLI" --service-environment="sandbox" $@
- set +x
+ set -x
+ "$SIGNAL_CLI" --service-environment="sandbox" $@
+ set +x
}
function run_main() {
- run --config="$PATH_MAIN" $@
+ run --config="$PATH_MAIN" $@
}
function run_linked() {
- run --config="$PATH_LINK" $@
+ run --config="$PATH_LINK" $@
}
function register() {
- NUMBER=$1
- PIN=$2
- echo -n "Enter a captcha token (https://signalcaptchas.org/registration/generate.html): "
- read CAPTCHA
- run_main -u "$NUMBER" register --captcha "$CAPTCHA"
- echo -n "Enter validation code for ${NUMBER}: "
- read CODE
- if [ -z "$PIN" ]; then
- run_main -u "$NUMBER" verify "$CODE"
- else
- run_main -u "$NUMBER" verify "$CODE" --pin "$PIN"
- fi
+ NUMBER=$1
+ PIN=$2
+ echo -n "Enter a captcha token (https://signalcaptchas.org/registration/generate.html): "
+ read CAPTCHA
+ run_main -u "$NUMBER" register --captcha "$CAPTCHA"
+ echo -n "Enter validation code for ${NUMBER}: "
+ read CODE
+ if [ -z "$PIN" ]; then
+ run_main -u "$NUMBER" verify "$CODE"
+ else
+ run_main -u "$NUMBER" verify "$CODE" --pin "$PIN"
+ fi
}
function link() {
- NUMBER=$1
- LINK_CODE_FILE="$PATH_TEST_CONFIG/link_code"
- rm -f "$LINK_CODE_FILE"
- mkfifo "$LINK_CODE_FILE"
- run_linked link -n "test-device" > "$LINK_CODE_FILE" &
- read LINK_CODE < "$LINK_CODE_FILE"
- run_main -u "$NUMBER" addDevice --uri "$LINK_CODE"
- wait
- run_linked -u "$NUMBER" send --note-to-self -m hi
- run_main -u "$NUMBER" receive
- run_linked -u "$NUMBER" receive
- run_main -u "$NUMBER" receive
+ NUMBER=$1
+ LINK_CODE_FILE="$PATH_TEST_CONFIG/link_code"
+ rm -f "$LINK_CODE_FILE"
+ mkfifo "$LINK_CODE_FILE"
+ run_linked link -n "test-device" >"$LINK_CODE_FILE" &
+ read LINK_CODE <"$LINK_CODE_FILE"
+ run_main -u "$NUMBER" addDevice --uri "$LINK_CODE"
+ wait
+ run_linked -u "$NUMBER" send --note-to-self -m hi
+ run_main -u "$NUMBER" receive
+ run_linked -u "$NUMBER" receive
+ run_main -u "$NUMBER" receive
}
run_main --version
## Basic send/receive
for OUTPUT in "plain-text" "json"; do
- run_main -u "$NUMBER_1" --output="$OUTPUT" getUserStatus "$NUMBER_1" "$NUMBER_2" "+111111111"
- run_main -u "$NUMBER_1" send "$NUMBER_2" -m hi
- run_main -u "$NUMBER_2" send "$NUMBER_1" -m hi
- run_main -u "$NUMBER_1" send -g "$GROUP_ID" -m hi -a LICENSE
- TIMESTAMP=$(uname -a | run_main -u "$NUMBER_1" send "$NUMBER_2")
- run_main -u "$NUMBER_2" sendReaction "$NUMBER_1" -e đ -a "$NUMBER_1" -t "$TIMESTAMP"
- run_main -u "$NUMBER_1" remoteDelete "$NUMBER_2" -t "$TIMESTAMP"
- run_main -u "$NUMBER_2" --output="$OUTPUT" receive
- run_main -u "$NUMBER_1" --output="$OUTPUT" receive
- run_main -u "$NUMBER_1" send -e "$NUMBER_2"
- run_main -u "$NUMBER_2" --output="$OUTPUT" receive
+ run_main -u "$NUMBER_1" --output="$OUTPUT" getUserStatus "$NUMBER_1" "$NUMBER_2" "+111111111"
+ run_main -u "$NUMBER_1" send "$NUMBER_2" -m hi
+ run_main -u "$NUMBER_2" send "$NUMBER_1" -m hi
+ run_main -u "$NUMBER_1" send -g "$GROUP_ID" -m hi -a LICENSE
+ TIMESTAMP=$(uname -a | run_main -u "$NUMBER_1" send "$NUMBER_2")
+ run_main -u "$NUMBER_2" sendReaction "$NUMBER_1" -e đ -a "$NUMBER_1" -t "$TIMESTAMP"
+ run_main -u "$NUMBER_1" remoteDelete "$NUMBER_2" -t "$TIMESTAMP"
+ run_main -u "$NUMBER_2" --output="$OUTPUT" receive
+ run_main -u "$NUMBER_1" --output="$OUTPUT" receive
+ run_main -u "$NUMBER_1" send -e "$NUMBER_2"
+ run_main -u "$NUMBER_2" --output="$OUTPUT" receive
done
## Profile
run_main -u "$NUMBER_1" updateProfile --given-name=GIVEN --family-name=FAMILY --about=ABOUT --about-emoji=EMOJI --avatar=LICENSE
-
## Provisioning
link "$NUMBER_1"
link "$NUMBER_2"
run_main -u "$NUMBER_1" sendContacts
for OUTPUT in "plain-text" "json"; do
- run_main -u "$NUMBER_1" send "$NUMBER_2" -m hi
- run_main -u "$NUMBER_2" send "$NUMBER_1" -m hi
- run_main -u "$NUMBER_2" --output="$OUTPUT" receive
- run_main -u "$NUMBER_1" --output="$OUTPUT" receive
- run_linked -u "$NUMBER_1" --output="$OUTPUT" receive
+ run_main -u "$NUMBER_1" send "$NUMBER_2" -m hi
+ run_main -u "$NUMBER_2" send "$NUMBER_1" -m hi
+ run_main -u "$NUMBER_2" --output="$OUTPUT" receive
+ run_main -u "$NUMBER_1" --output="$OUTPUT" receive
+ run_linked -u "$NUMBER_1" --output="$OUTPUT" receive
done
run_main -u "$NUMBER_1" removeDevice -d 2