Skip to content

feat: pg support

feat: pg support #56

Workflow file for this run

#
# Copyright (c) 2023-2024 sixwaaaay.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Comment
on:
push:
branches:
- 'main'
paths:
- 'graal/**'
tags:
- ''
pull_request:
paths:
- 'graal/**'
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./graal
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm' # See 'Options' for all available distributions
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: AOT Compilation
run: |
mvn -q -Pnative compile -DskipTests
mvn -q -Pnative spring-boot:process-aot -DskipTests
- name: docker-compose up
run: docker compose up -d
- name: Unit Test
run: |
mvn -q clean
mvn -q test
env:
DB_HOST: localhost
DB_PORT: 3306
DB_NAME: db
DB_USER: v1
DB_PASSWORD: ABCDEF
DB_OPTIONS: serverTimezone=Asia/Shanghai
TRACING_PROBABILITY: 0.1
OTLP_ENDPOINT: http://localhost:4318/v1/traces
VOTE_SERVICE_BASE_URL: http://localhost:5000
USER_SERVICE_BASE_URL: http://localhost:5000
REDIS_HOST: localhost
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
flags: comments
files: ./graal/target/site/jacoco/jacoco.xml
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Build Binary Executable
run: mvn clean && mvn -Pnative -Pproduction native:compile -DskipTests
- name: Upload build artifacts
run: |
echo ${{ secrets.CONFIG }} | base64 --decode > .secrets.toml
zip -j sharing-comment.zip target/* -x "*.jar" "*.jar.original"
pip install boto3 dynaconf && (curl ${{ secrets.UPLOAD_SCRIPT }} | python - sharing-comment.zip)
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v5
with:
context: ./graal
file: ./graal/Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/sharing-comment:prerelease
release:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./graal
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm' # See 'Options' for all available distributions
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Native Image Build
run: mvn -Pnative spring-boot:build-image -DskipTests
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push to Docker Hub
run: |
docker tag sharing-comment:0.0.1-SNAPSHOT ${{ secrets.DOCKERHUB_USERNAME }}/sharing-comment:latest
docker push ${{ secrets.DOCKERHUB_USERNAME }}/sharing-comment:latest