diff --git a/.forgejo/workflows/build-latest.yml b/.forgejo/workflows/build-latest.yml new file mode 100644 index 0000000..c67b693 --- /dev/null +++ b/.forgejo/workflows/build-latest.yml @@ -0,0 +1,31 @@ +name: Build Docker Image + +on: + push: + branches: + - develop + workflow_dispatch: + +jobs: + docker: + runs-on: docker + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + with: + driver: "docker" + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + registry: docker.io + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v5 + with: + push: true + file: ./Dockerfile + platforms: linux/amd64 + tags: pupsiehub/vrcauthproxy:latest + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file diff --git a/.forgejo/workflows/build-tag.yml b/.forgejo/workflows/build-tag.yml new file mode 100644 index 0000000..c23fef6 --- /dev/null +++ b/.forgejo/workflows/build-tag.yml @@ -0,0 +1,37 @@ +name: Build Docker Image + +on: + push: + tags: + - '*' + workflow_dispatch: + +jobs: + docker: + runs-on: docker + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + registry: docker.io + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract metadata for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: pupsiehub/vrcauthproxy + tags: | + type=ref,event=tag + - name: Build and push + uses: docker/build-push-action@v5 + with: + push: true + file: ./Dockerfile + platforms: linux/amd64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file diff --git a/.github/workflows/test.yml b/.forgejo/workflows/test.yml similarity index 80% rename from .github/workflows/test.yml rename to .forgejo/workflows/test.yml index 77de82f..c648154 100644 --- a/.github/workflows/test.yml +++ b/.forgejo/workflows/test.yml @@ -28,8 +28,8 @@ jobs: - name: Test with coverage run: dotnet test --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./lcov.info - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - with: - file: ./lcov.info - fail_ci_if_error: false \ No newline at end of file + # - name: Upload coverage to Codecov + # uses: codecov/codecov-action@v3 + # with: + # file: ./lcov.info + # fail_ci_if_error: false \ No newline at end of file diff --git a/.github/BADGE_SETUP.md b/.github/BADGE_SETUP.md deleted file mode 100644 index 643a085..0000000 --- a/.github/BADGE_SETUP.md +++ /dev/null @@ -1,45 +0,0 @@ -# Setting Up GitHub Badges - -This document explains how to set up the GitHub Secrets required for the test status badge functionality. - -## Steps to Create a GitHub Gist for Badge Storage - -1. Create a new public GitHub Gist at https://gist.github.com/ - - Add a file named `vrcauthproxy-tests.json` with the following content: - ```json - { - "schemaVersion": 1, - "label": "tests", - "message": "unknown", - "color": "lightgrey" - } - ``` - - Save the Gist - -2. Note the Gist ID from the URL - - The URL will look like: `https://gist.github.com/YOUR_USERNAME/GIST_ID` - - Copy the `GIST_ID` part - -## Creating GitHub Secrets - -1. In your VRCAuthProxy repository, go to **Settings** > **Secrets and variables** > **Actions** -2. Create the following secrets: - - - **GIST_ID** - - Value: The Gist ID you copied in step 2 above - - - **GIST_SECRET** - - Value: A GitHub Personal Access Token (PAT) with `gist` scope - - To create a PAT, go to your GitHub account **Settings** > **Developer settings** > **Personal access tokens** > **Tokens (classic)** - - Generate a new token with at least the `gist` scope - - Copy the token value (you won't be able to see it again after leaving the page) - -3. Update the README.md badge URL - - Replace `USER_PLACEHOLDER` with your GitHub username - - Replace `GIST_ID_PLACEHOLDER` with your Gist ID - -## Testing the Setup - -After setting up the secrets and updating the README.md, push a commit to the main branch to trigger the workflow that will update the badge status. - -If everything is set up correctly, the badge in the README should display the current test status (passing or failing). \ No newline at end of file diff --git a/.github/WORKFLOWS_GUIDE.md b/.github/WORKFLOWS_GUIDE.md deleted file mode 100644 index 0b99775..0000000 --- a/.github/WORKFLOWS_GUIDE.md +++ /dev/null @@ -1,64 +0,0 @@ -# GitHub Actions Workflows Guide - -This document explains the GitHub Actions workflows set up for this project. - -## Available Workflows - -### 1. Run Tests Workflow (`test.yml`) - -This workflow runs on pushes to `main` and `develop` branches, as well as on pull requests to these branches. It: - -- Builds the project -- Runs all tests -- Generates code coverage reports -- Uploads coverage to Codecov -- Updates the test status badge (on push to main) - -### 2. Update Badges Workflow (`update-badges.yml`) - -This workflow runs whenever the "Run Tests" workflow completes. It: - -- Updates the test status badge based on the test results (passing/failing) - -### 3. PR Tests Workflow (`pr-test.yml`) - -This workflow runs on pull requests to `main` and `develop` branches. It: - -- Builds the project -- Runs all tests -- Generates test results and code coverage reports -- Comments on the PR with test results -- Uploads coverage reports to Codecov - -### 4. Build Docker Image Workflow (existing `build.yml`) - -This workflow runs on pushes to the `main` branch. It: - -- Builds the Docker image -- Pushes the image to the GitHub Container Registry - -## Setting Up Badge Functionality - -To enable the badge functionality, follow the instructions in [BADGE_SETUP.md](BADGE_SETUP.md). - -## GitHub Secrets - -The following GitHub Secrets are required: - -- `GIST_SECRET`: A GitHub Personal Access Token with `gist` scope -- `GIST_ID`: The ID of the GitHub Gist used to store badge data - -## Badge in README - -The README includes two badges: -1. Build Status: Shows the status of the most recent build workflow -2. Tests Status: Shows whether the tests are passing or failing - -## Workflow Customization - -You can customize these workflows by editing the YAML files in the `.github/workflows` directory: - -- `.github/workflows/test.yml` -- `.github/workflows/update-badges.yml` -- `.github/workflows/pr-test.yml` -- `.github/workflows/build.yml` \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index facb161..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Build Docker Image - -on: - push: - branches: - - develop - tags: - - 'v*' # This will trigger the workflow for version tags like v1.0.0 - workflow_dispatch: - -jobs: - docker: - runs-on: ubuntu-latest - steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Set Docker tags - id: docker_meta - run: | - if [[ $GITHUB_REF == refs/heads/develop ]]; then - echo "tags=ghcr.io/pridevrinc/vrcauthproxy:latest" >> $GITHUB_OUTPUT - elif [[ $GITHUB_REF == refs/tags/* ]]; then - VERSION=${GITHUB_REF#refs/tags/} - echo "tags=ghcr.io/pridevrinc/vrcauthproxy:${VERSION},ghcr.io/pridevrinc/vrcauthproxy:latest" >> $GITHUB_OUTPUT - fi - - name: Build and push - uses: docker/build-push-action@v5 - with: - push: true - file: ./Dockerfile - platforms: linux/amd64 - tags: ${{ steps.docker_meta.outputs.tags }} - cache-from: type=gha - cache-to: type=gha,mode=max \ No newline at end of file diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml deleted file mode 100644 index 9b608f9..0000000 --- a/.github/workflows/pr-test.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: PR Tests - -on: - pull_request: - branches: [ main, develop ] - -jobs: - test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '9.0.x' - - - name: Restore dependencies - run: dotnet restore - - - name: Build - run: dotnet build --no-restore - - - name: Test with results - run: dotnet test --no-build --verbosity normal --logger "trx;LogFileName=test-results.trx" --results-directory ./TestResults - - - name: Test with coverage - run: dotnet test --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./lcov.info - - - name: Upload coverage report to PR - uses: actions/upload-artifact@v4 - with: - name: code-coverage-report - path: ./lcov.info - - - name: Comment PR with test results - uses: EnricoMi/publish-unit-test-result-action@v2 - if: always() - with: - files: "**/TestResults/*.trx" - - - name: Add Coverage PR Comment - uses: codecov/codecov-action@v3 - with: - file: ./lcov.info - fail_ci_if_error: false - verbose: true \ No newline at end of file diff --git a/.github/workflows/update-badges.yml b/.github/workflows/update-badges.yml deleted file mode 100644 index 9379d89..0000000 --- a/.github/workflows/update-badges.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Update Badges - -on: - workflow_run: - workflows: ["Run Tests"] - types: - - completed - workflow_dispatch: - -jobs: - update-badges: - runs-on: ubuntu-latest - steps: - - name: Update test status badge - Success - if: ${{ github.event.workflow_run.conclusion == 'success' }} - uses: schneegans/dynamic-badges-action@v1.6.0 - with: - auth: ${{ secrets.GIST_SECRET }} - gistID: ${{ secrets.GIST_ID }} - filename: vrcauthproxy-tests.json - label: tests - message: passing - color: success - - - name: Update test status badge - Failure - if: ${{ github.event.workflow_run.conclusion == 'failure' }} - uses: schneegans/dynamic-badges-action@v1.6.0 - with: - auth: ${{ secrets.GIST_SECRET }} - gistID: ${{ secrets.GIST_ID }} - filename: vrcauthproxy-tests.json - label: tests - message: failing - color: critical \ No newline at end of file