From 97456643846fafd73539799cce974dc87d5a3a2b Mon Sep 17 00:00:00 2001 From: Zurdi Date: Fri, 22 Dec 2023 21:55:48 +0100 Subject: [PATCH 1/3] test next rc version --- .github/workflows/build.yml | 114 +++++++++++++++++++++--------------- 1 file changed, 66 insertions(+), 48 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6202df9d9..9bdac7ed3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,11 @@ on: description: "romm version" required: true type: string + releaseCandidate: + description: "release candidate?" + type: boolean + required: true + default: false jobs: build: @@ -16,58 +21,71 @@ jobs: contents: write packages: write steps: - - name: Checkout code - uses: actions/checkout@v3 + # - name: Checkout code + # uses: actions/checkout@v3 - - name: Set environment variables - run: echo "GIT_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV + # - name: Set environment variables + # run: echo "GIT_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV - - name: Set version - run: sed -i 's//'"${{ inputs.version }}"'/' backend/__version__.py + # - name: Set version + # run: sed -i 's//'"${{ inputs.version }}"'/' backend/__version__.py - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + # - name: Set up QEMU + # uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v2 - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + # - name: Login to Docker Hub + # uses: docker/login-action@v2 + # with: + # username: ${{ secrets.DOCKER_USERNAME }} + # password: ${{ secrets.DOCKER_PASSWORD }} - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + # - name: Login to GitHub Container Registry + # uses: docker/login-action@v2 + # with: + # registry: ghcr.io + # username: ${{ github.actor }} + # password: ${{ secrets.GITHUB_TOKEN }} - - name: Generate Docker metadata - id: meta - uses: docker/metadata-action@v4 - with: - images: | - name=zurdi15/romm - name=ghcr.io/zurdi15/romm - flavor: | - # latest on release branch, prefix dev on other branches - latest=true - prefix=${{ github.ref != format('refs/heads/{0}', 'release') && 'dev-' || '' }},onlatest=true - tags: | - type=raw,value=${{ inputs.version }} - labels: | - org.opencontainers.image.version=${{ inputs.version }} - org.opencontainers.image.title="zurdi15/romm" - org.opencontainers.image.description="RomM (stands for Rom Manager) is a game library manager focused in retro gaming. Manage and organize all of your games from a web browser" - org.opencontainers.image.licenses="GPL-3.0" - - name: Build image - uses: docker/build-push-action@v4 - with: - file: docker/Dockerfile - context: . - push: true - platforms: linux/arm64,linux/amd64 - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + - name: Get last image tag + if: ${{ inputs.releaseCandidate }} + run: | + CURRENT_RC_VERSION=$(wget -q -O - "https://hub.docker.com/v2/repositories/zurdi15/romm/tags?page_size=2" | grep -o '"name": *"[^"]*' | grep -o '[^"]*$' | grep "dev-${version}-rc" | cut -d "-" -f 3 | cut -d "." -f 2) + NEXT_RC_VERSION=$(($CURRENT_RC_VERSION + 1)) + echo "NEXT_RC_VERSION=$(($CURRENT_RC_VERSION + 1))" >> $GITHUB_ENV + + - name: Test get last image tag variable + if: ${{ inputs.releaseCandidate }} + run: | + echo $NEXT_RC_VERSION + + # - name: Generate Docker metadata + # id: meta + # uses: docker/metadata-action@v4 + # with: + # images: | + # name=zurdi15/romm + # name=ghcr.io/zurdi15/romm + # flavor: | + # # latest on release branch, prefix dev on other branches + # latest=true + # prefix=${{ github.ref != format('refs/heads/{0}', 'release') && 'dev-' || '' }},onlatest=true + # suffix=${{ github.ref != format('refs/heads/{0}', 'release') && ${{ inputs.releaseCandidate }} && '-rc.' || '' }},onlatest=true + # tags: | + # type=raw,value=${{ inputs.version }} + # labels: | + # org.opencontainers.image.version=${{ inputs.version }} + # org.opencontainers.image.title="zurdi15/romm" + # org.opencontainers.image.description="RomM (stands for Rom Manager) is a game library manager focused in retro gaming. Manage and organize all of your games from a web browser" + # org.opencontainers.image.licenses="GPL-3.0" + # - name: Build image + # uses: docker/build-push-action@v4 + # with: + # file: docker/Dockerfile + # context: . + # push: true + # platforms: linux/arm64,linux/amd64 + # tags: ${{ steps.meta.outputs.tags }} + # labels: ${{ steps.meta.outputs.labels }} From 851b0efc151987a3f4cd6d2c3c2df0904fe4a764 Mon Sep 17 00:00:00 2001 From: Zurdi Date: Fri, 22 Dec 2023 22:07:39 +0100 Subject: [PATCH 2/3] fixed rc version finder --- .github/workflows/build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9bdac7ed3..23c2c2a65 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,8 +52,7 @@ jobs: - name: Get last image tag if: ${{ inputs.releaseCandidate }} run: | - CURRENT_RC_VERSION=$(wget -q -O - "https://hub.docker.com/v2/repositories/zurdi15/romm/tags?page_size=2" | grep -o '"name": *"[^"]*' | grep -o '[^"]*$' | grep "dev-${version}-rc" | cut -d "-" -f 3 | cut -d "." -f 2) - NEXT_RC_VERSION=$(($CURRENT_RC_VERSION + 1)) + CURRENT_RC_VERSION=$(wget -q -O - "https://hub.docker.com/v2/repositories/zurdi15/romm/tags?page_size=2" | grep -o '"name": *"[^"]*' | grep -o '[^"]*$' | grep "dev-${{ inputs.version }}-rc" | cut -d "-" -f 3 | cut -d "." -f 2) echo "NEXT_RC_VERSION=$(($CURRENT_RC_VERSION + 1))" >> $GITHUB_ENV - name: Test get last image tag variable From 366967c7b4f79856b81796f13aa2e08b4385dffe Mon Sep 17 00:00:00 2001 From: Zurdi Date: Fri, 22 Dec 2023 22:40:58 +0100 Subject: [PATCH 3/3] adapted rc tag to build --- .github/workflows/build.yml | 105 +++++++++++++++++------------------- .vscode/tasks.json | 16 +++--- 2 files changed, 58 insertions(+), 63 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 23c2c2a65..6d2396bbd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,70 +21,65 @@ jobs: contents: write packages: write steps: - # - name: Checkout code - # uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v3 - # - name: Set environment variables - # run: echo "GIT_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV + - name: Set environment variables + run: echo "GIT_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV - # - name: Set version - # run: sed -i 's//'"${{ inputs.version }}"'/' backend/__version__.py + - name: Set version + run: sed -i 's//'"${{ inputs.version }}"'/' backend/__version__.py - # - name: Set up QEMU - # uses: docker/setup-qemu-action@v2 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 - # - name: Set up Docker Buildx - # uses: docker/setup-buildx-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - # - name: Login to Docker Hub - # uses: docker/login-action@v2 - # with: - # username: ${{ secrets.DOCKER_USERNAME }} - # password: ${{ secrets.DOCKER_PASSWORD }} + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} - # - name: Login to GitHub Container Registry - # uses: docker/login-action@v2 - # with: - # registry: ghcr.io - # username: ${{ github.actor }} - # password: ${{ secrets.GITHUB_TOKEN }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Get last image tag + - name: Get last image rc version if: ${{ inputs.releaseCandidate }} run: | CURRENT_RC_VERSION=$(wget -q -O - "https://hub.docker.com/v2/repositories/zurdi15/romm/tags?page_size=2" | grep -o '"name": *"[^"]*' | grep -o '[^"]*$' | grep "dev-${{ inputs.version }}-rc" | cut -d "-" -f 3 | cut -d "." -f 2) echo "NEXT_RC_VERSION=$(($CURRENT_RC_VERSION + 1))" >> $GITHUB_ENV - - name: Test get last image tag variable - if: ${{ inputs.releaseCandidate }} - run: | - echo $NEXT_RC_VERSION - - # - name: Generate Docker metadata - # id: meta - # uses: docker/metadata-action@v4 - # with: - # images: | - # name=zurdi15/romm - # name=ghcr.io/zurdi15/romm - # flavor: | - # # latest on release branch, prefix dev on other branches - # latest=true - # prefix=${{ github.ref != format('refs/heads/{0}', 'release') && 'dev-' || '' }},onlatest=true - # suffix=${{ github.ref != format('refs/heads/{0}', 'release') && ${{ inputs.releaseCandidate }} && '-rc.' || '' }},onlatest=true - # tags: | - # type=raw,value=${{ inputs.version }} - # labels: | - # org.opencontainers.image.version=${{ inputs.version }} - # org.opencontainers.image.title="zurdi15/romm" - # org.opencontainers.image.description="RomM (stands for Rom Manager) is a game library manager focused in retro gaming. Manage and organize all of your games from a web browser" - # org.opencontainers.image.licenses="GPL-3.0" - # - name: Build image - # uses: docker/build-push-action@v4 - # with: - # file: docker/Dockerfile - # context: . - # push: true - # platforms: linux/arm64,linux/amd64 - # tags: ${{ steps.meta.outputs.tags }} - # labels: ${{ steps.meta.outputs.labels }} + - name: Generate Docker metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: | + name=zurdi15/romm + name=ghcr.io/zurdi15/romm + flavor: | + # latest on release branch, prefix dev on other branches + latest=true + prefix=${{ github.head_ref != 'release' && 'dev-' || '' }},onlatest=true + suffix=${{ github.head_ref != 'release' && github.head_ref == 'master' && '-rc.$NEXT_RC_VERSION' || '' }},onlatest=false + tags: | + type=raw,value=${{ inputs.version }} + labels: | + org.opencontainers.image.version=${{ inputs.version }} + org.opencontainers.image.title="zurdi15/romm" + org.opencontainers.image.description="RomM (stands for Rom Manager) is a game library manager focused in retro gaming. Manage and organize all of your games from a web browser" + org.opencontainers.image.licenses="GPL-3.0" + - name: Build image + uses: docker/build-push-action@v4 + with: + file: docker/Dockerfile + context: . + push: true + platforms: linux/arm64,linux/amd64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.vscode/tasks.json b/.vscode/tasks.json index d500bbe91..462a5bb3b 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,40 +1,40 @@ { "tasks": [ { + "label": "Launch frontend", "type": "npm", - "script": "dev", "path": "frontend", - "problemMatcher": [], - "label": "Launch frontend" + "script": "dev", + "problemMatcher": [] }, { + "label": "Launch backend", "type": "shell", "command": "cd backend && poetry run python3 main.py", - "label": "Launch backend", "problemMatcher": [] }, { + "label": "Launch worker", "type": "shell", "command": "cd backend && poetry run python3 worker.py", - "label": "Launch worker", "problemMatcher": [] }, { + "label": "Execute tests", "type": "shell", "command": "cd backend && poetry run pytest -vv -c ../pytest.ini", - "label": "Execute tests", "problemMatcher": [] }, { + "label": "Setup development environment", "type": "shell", "command": "docker compose up -d", - "label": "Setup development environment", "problemMatcher": [] }, { + "label": "Setup testing environment", "type": "shell", "command": "export $(cat .env | grep DB_ROOT_PASSWD | xargs) && docker exec -i mariadb mariadb -u root -p$DB_ROOT_PASSWD < backend/romm_test/setup.sql", - "label": "Setup testing environment", "problemMatcher": [] } ]