Skip to content

Commit

Permalink
Merge pull request #640 from Shikkanime/dev
Browse files Browse the repository at this point in the history
ci: delete and merge some ci
  • Loading branch information
Ziedelth authored Aug 23, 2024
2 parents acf8932 + 2665312 commit 68a0ca3
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 193 deletions.
142 changes: 39 additions & 103 deletions .github/workflows/development_workflow.yml
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
67 changes: 0 additions & 67 deletions .github/workflows/pull_request_workflow.yml

This file was deleted.

47 changes: 26 additions & 21 deletions .github/workflows/release_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions .github/workflows/update-gradle-wrapper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
pull-requests: write

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Update Gradle Wrapper
uses: gradle-update/update-gradle-wrapper-action@v1
uses: gradle-update/update-gradle-wrapper-action@v1.0.20
with:
reviewers: Ziedelth
base-branch: dev
Expand Down

0 comments on commit 68a0ca3

Please sign in to comment.