diff --git a/.forgejo/README.md b/.forgejo/README.md new file mode 100644 index 0000000..9a90c02 --- /dev/null +++ b/.forgejo/README.md @@ -0,0 +1,17 @@ +# Forgejo workflows + +This folder contains CI workflows for the three application areas in this repository: + +- `backend.yml` for the .NET API and integration tests +- `web.yml` for the Nuxt front-end +- `addin.yml` for the Office add-in task pane + +These workflows use the standard GitHub Actions syntax supported by Forgejo/Gitea runners. + +## Notes + +- The backend workflow runs `dotnet restore`, `dotnet build`, and `dotnet test` on the solution. +- The web workflow runs `npm install`, `npm run test`, and `npm run build` inside the `web` folder. +- The add-in workflow runs `npm install`, `npm test`, `npm run validate`, and `npm run build` inside the `addin` folder. + +If your Forgejo instance uses self-hosted runners, ensure Docker is enabled for the backend integration tests. diff --git a/.forgejo/workflows/addin.yml b/.forgejo/workflows/addin.yml new file mode 100644 index 0000000..713a135 --- /dev/null +++ b/.forgejo/workflows/addin.yml @@ -0,0 +1,48 @@ +name: Add-in CI + +on: + push: + branches: + - main + - master + paths: + - 'addin/**' + - 'docker-compose.yml' + - '.forgejo/workflows/addin.yml' + pull_request: + paths: + - 'addin/**' + - 'docker-compose.yml' + - '.forgejo/workflows/addin.yml' + +permissions: + contents: read + +jobs: + build-and-test: + name: Build and test Word add-in + runs-on: ubuntu-latest + timeout-minutes: 25 + defaults: + run: + working-directory: addin + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + run: npm install --no-fund --no-audit + + - name: Run tests + run: npm test -- --runInBand + + - name: Validate manifest + run: npm run validate + + - name: Build add-in + run: npm run build diff --git a/.forgejo/workflows/backend.yml b/.forgejo/workflows/backend.yml new file mode 100644 index 0000000..3d6df29 --- /dev/null +++ b/.forgejo/workflows/backend.yml @@ -0,0 +1,50 @@ +name: Deploy DocEdit Backend CI + +on: + push: + tags: + - "backend-*.*.*" + workflow_dispatch: + + env: + # Container Registry + REGISTRY_URL: ${{ vars.CONTAINER_REGISTRY }} + REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }} + REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }} + + # Docker Image + WEB_IMAGE_NAME: chamomind/ecourt-note + IMAGE_TAG: ${{ github.ref_name }} + + # SSH Deployment + DEPLOY_HOST: ${{ vars.SSH_DEPLOY_HOST }} + DEPLOY_USER: ${{ vars.SSH_DEPLOY_USER }} + + # Notifications + DISCORD_WEBHOOK_URL: ${{ vars.DISCORD_WEBHOOK_URL }} + NEXT_PUBLIC_APP_URL: ${{ vars.NEXT_PUBLIC_APP_URL }} + +jobs: + build-and-test: + name: Build and test backend + runs-on: ubuntu-latest + timeout-minutes: 30 + env: + DOTNET_CLI_TELEMETRY_OPTOUT: '1' + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup .NET SDK + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Restore solution + run: dotnet restore backend/WordVersioning.slnx + + - name: Build solution + run: dotnet build backend/WordVersioning.slnx --configuration Release --no-restore + + - name: Run tests + run: dotnet test backend/WordVersioning.slnx --configuration Release --no-build --logger "trx;LogFileName=backend-tests.trx" diff --git a/.forgejo/workflows/web.yml b/.forgejo/workflows/web.yml new file mode 100644 index 0000000..fa94fd2 --- /dev/null +++ b/.forgejo/workflows/web.yml @@ -0,0 +1,45 @@ +name: Web CI + +on: + push: + branches: + - main + - master + paths: + - 'web/**' + - 'docker-compose.yml' + - '.forgejo/workflows/web.yml' + pull_request: + paths: + - 'web/**' + - 'docker-compose.yml' + - '.forgejo/workflows/web.yml' + +permissions: + contents: read + +jobs: + build-and-test: + name: Build and test web app + runs-on: ubuntu-latest + timeout-minutes: 20 + defaults: + run: + working-directory: web + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + run: npm install --no-fund --no-audit + + - name: Run tests + run: npm run test + + - name: Build app + run: npm run build