This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ❌ not testable | |
fn greeting_hard_to_test(nb: i32, name: &str) { | |
for _ in 0..nb { | |
println!("hi {}", name); | |
} | |
} | |
// ✅ easy to test | |
trait Logger { | |
fn log(&mut self, value: String); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM registry.access.redhat.com/ubi8/ubi-minimal as nativebuilder | |
RUN mkdir -p /tmp/ssl \ | |
&& cp /usr/lib64/libstdc++.so.6.0.25 /tmp/ssl/libstdc++.so.6 \ | |
&& cp /usr/lib64/libgcc_s-8-20191121.so.1 /tmp/ssl/libgcc_s.so.1 \ | |
&& cp /usr/lib64/libz.so.1 /tmp/ssl/libz.so.1 | |
FROM gcr.io/distroless/base | |
COPY --from=nativebuilder /tmp/ssl/ / | |
ENV LD_LIBRARY_PATH / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Deploy | |
run: | | |
gcloud components install beta --quiet | |
gcloud beta run deploy ${{ secrets.GCP_APP_NAME }} \ | |
--image gcr.io/${{ secrets.GCP_PROJECT }}/${{ secrets.GCP_APP_NAME }} \ | |
--platform ${{ secrets.GCP_PLATFORM }} \ | |
--allow-unauthenticated --service-account ${{ secrets.GCP_EMAIL }} \ | |
--region ${{ secrets.GCP_REGION }} \ | |
--set-env-vars DISABLE_SIGNAL_HANDLERS=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Login to GCP | |
uses: GoogleCloudPlatform/github-actions/setup-gcloud@master | |
with: | |
service_account_email: ${{ secrets.GCP_EMAIL }} | |
service_account_key: ${{ secrets.GCP_ACCOUNT_KEY }} | |
project_id: ${{ secrets.GCP_PROJECT }} | |
export_default_credentials: true | |
- name: Push the Docker image to GCP | |
run: | | |
gcloud auth configure-docker --quiet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dockerize: | |
runs-on: ubuntu-latest | |
name: Embed the native executable in a Docker container | |
needs: native_build | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@master | |
- name: Download the binary | |
uses: actions/download-artifact@v1 | |
with: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM quay.io/quarkus/centos-quarkus-maven:19.3.1-java8 | |
USER root | |
COPY src /usr/src/app/src | |
COPY pom.xml /usr/src/app | |
RUN mvn -f /usr/src/app/pom.xml -Pnative clean verify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Build native executable | |
uses: maxday/quarkus-native-build-docker-action@1 | |
with: | |
outputName: app-runner | |
- name: Upload native executable | |
uses: actions/upload-artifact@v1 | |
with: | |
name: native-executable | |
path: app-runner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: [push] | |
jobs: | |
native_build: | |
runs-on: ubuntu-latest | |
name: Build native Quarkus app | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mvn io.quarkus:quarkus-maven-plugin:1.3.0.Final:create \ | |
-DprojectGroupId=io.github.maxday \ | |
-DprojectArtifactId=quarkus-demo-actions \ | |
-DclassName="io.github.maxday.GreetingResource" \ | |
-Dpath="/hello" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let groupQuery = [ | |
{ | |
$group: { | |
_id: { repo : "$repo", type: "$type" }, | |
count: { $sum: 1 } | |
} | |
}, | |
{ | |
$sort: { | |
"count": -1 |
NewerOlder