-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #640 from Shikkanime/dev
ci: delete and merge some ci
- Loading branch information
Showing
4 changed files
with
67 additions
and
193 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,134 +1,70 @@ | ||
name: Development workflow | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened, edited] | ||
push: | ||
branches: | ||
- dev | ||
branches: [dev] | ||
|
||
env: | ||
REGISTRY_IMAGE: registry.shikkanime.fr:5000/shikkanime-core | ||
JAVA_VERSION: 21 | ||
|
||
jobs: | ||
test: | ||
validate-pr-title: | ||
if: github.event_name == 'pull_request' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: PR Conventional Commit Validation | ||
uses: ytanikin/[email protected] | ||
with: | ||
task_types: '["feat","fix","docs","test","ci","refactor","perf","chore","revert"]' | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 21 | ||
- name: Set up JDK ${{ env.JAVA_VERSION }} | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: 21 | ||
java-version: ${{ env.JAVA_VERSION }} | ||
distribution: 'corretto' | ||
|
||
- name: Analyze push | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/dev' | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | ||
run: ./gradlew sonar --info | ||
- name: Analyse pull request | ||
if: github.event_name == 'pull_request' && github.event.pull_request.base.ref != 'master' && github.actor != 'dependabot[bot]' | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | ||
run: ./gradlew sonar --info -Dsonar.pullrequest.key=${{ github.event.pull_request.number }} -Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} -Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }} -Dsonar.qualitygate.wait=true | ||
- name: Analyse pull request | ||
if: github.event_name == 'pull_request' && (github.event.pull_request.base.ref == 'master' || github.actor == 'dependabot[bot]') | ||
run: ./gradlew clean test --info | ||
|
||
build: | ||
test-compose: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: | ||
- linux/amd64 | ||
- linux/arm64/v8 | ||
|
||
platform: [linux/amd64, linux/arm64/v8] | ||
runs-on: ubuntu-latest | ||
|
||
needs: | ||
- test | ||
|
||
needs: [test] | ||
steps: | ||
- name: Prepare | ||
run: | | ||
platform=${{ matrix.platform }} | ||
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY_IMAGE }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: registry.shikkanime.fr:5000 | ||
username: ziedelth | ||
password: ${{ secrets.REGISTRY_PASSWORD }} | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK ${{ env.JAVA_VERSION }} | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: ${{ env.JAVA_VERSION }} | ||
distribution: 'corretto' | ||
- name: Build | ||
run: gradle clean installDist -x test | ||
|
||
- name: Build and push by digest | ||
id: build | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
platforms: ${{ matrix.platform }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true | ||
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:buildcache | ||
cache-to: type=registry,ref=${{ env.REGISTRY_IMAGE }}:buildcache | ||
|
||
- name: Export digest | ||
run: | | ||
mkdir -p /tmp/digests | ||
digest="${{ steps.build.outputs.digest }}" | ||
touch "/tmp/digests/${digest#sha256:}" | ||
- name: Upload digest | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: digests-${{ env.PLATFORM_PAIR }} | ||
path: /tmp/digests/* | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
merge: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
steps: | ||
- name: Download digests | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: /tmp/digests | ||
pattern: digests-* | ||
merge-multiple: true | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY_IMAGE }} | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: registry.shikkanime.fr:5000 | ||
username: ziedelth | ||
password: ${{ secrets.REGISTRY_PASSWORD }} | ||
|
||
- name: Create manifest list and push | ||
working-directory: /tmp/digests | ||
run: | | ||
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | ||
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) | ||
- name: Inspect image | ||
run: | | ||
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} | ||
- name: Start services | ||
run: docker compose up -d --build --wait | ||
- name: Stop services | ||
run: docker compose down |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,26 +15,6 @@ jobs: | |
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Get next version | ||
uses: reecetech/[email protected] | ||
id: version | ||
with: | ||
scheme: conventional_commits | ||
|
||
- name: Generate Git Tag | ||
id: generate_tag | ||
run: | | ||
NEW_TAG="${{ steps.version.outputs.v-version }}" | ||
echo "Generated new tag: $NEW_TAG" | ||
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV | ||
- name: Push Git Tag | ||
run: | | ||
git config user.name "GitHub Actions" | ||
git config user.email "[email protected]" | ||
git tag $NEW_TAG | ||
git push origin $NEW_TAG | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
|
@@ -65,4 +45,29 @@ jobs: | |
tags: ${{ env.REGISTRY_IMAGE }}:latest,${{ env.REGISTRY_IMAGE }}:${{ steps.version.outputs.v-version }} | ||
platforms: linux/arm64/v8 | ||
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:buildcache | ||
cache-to: type=registry,ref=${{ env.REGISTRY_IMAGE }}:buildcache | ||
cache-to: type=registry,ref=${{ env.REGISTRY_IMAGE }}:buildcache | ||
|
||
- name: Get next version | ||
uses: reecetech/[email protected] | ||
id: version | ||
with: | ||
scheme: conventional_commits | ||
|
||
- name: Generate Git Tag | ||
id: generate_tag | ||
run: | | ||
NEW_TAG="${{ steps.version.outputs.v-version }}" | ||
echo "Generated new tag: $NEW_TAG" | ||
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV | ||
- name: Push Git Tag | ||
run: | | ||
git config user.name "GitHub Actions" | ||
git config user.email "[email protected]" | ||
git tag $NEW_TAG | ||
git push origin $NEW_TAG | ||
- uses: marvinpinto/[email protected] | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
prerelease: false |
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