move around c/i and add publish script
This commit is contained in:
parent
fadc13b6e6
commit
ce4679b9f8
8 changed files with 73 additions and 238 deletions
31
.forgejo/workflows/build-latest.yml
Normal file
31
.forgejo/workflows/build-latest.yml
Normal file
|
|
@ -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
|
||||
37
.forgejo/workflows/build-tag.yml
Normal file
37
.forgejo/workflows/build-tag.yml
Normal file
|
|
@ -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
|
||||
|
|
@ -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
|
||||
# - name: Upload coverage to Codecov
|
||||
# uses: codecov/codecov-action@v3
|
||||
# with:
|
||||
# file: ./lcov.info
|
||||
# fail_ci_if_error: false
|
||||
45
.github/BADGE_SETUP.md
vendored
45
.github/BADGE_SETUP.md
vendored
|
|
@ -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).
|
||||
64
.github/WORKFLOWS_GUIDE.md
vendored
64
.github/WORKFLOWS_GUIDE.md
vendored
|
|
@ -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`
|
||||
42
.github/workflows/build.yml
vendored
42
.github/workflows/build.yml
vendored
|
|
@ -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
|
||||
48
.github/workflows/pr-test.yml
vendored
48
.github/workflows/pr-test.yml
vendored
|
|
@ -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
|
||||
34
.github/workflows/update-badges.yml
vendored
34
.github/workflows/update-badges.yml
vendored
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue