diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..df1525f --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,87 @@ +name: CI + +on: + push: + tags: + - "v*" + pull_request: + +env: + GO_VERSION: "1.23.0" + NODE_VERSION: "18" + PNPM_VERSION: "8.6.10" + REGISTRY: code.mrx.ltd + IMAGE_NAME: code.mrx.ltd/pkg/wireguard-srv + +jobs: + backend-check: + name: Backend Check + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + cache: true + + - name: Download Go modules + run: go mod download + + - name: Run Go test + run: go test ./... + + - name: Verify backend build + run: go build -o /tmp/wgui . + + frontend-build: + name: Frontend Build + runs-on: ubuntu-latest + defaults: + run: + working-directory: web + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: ${{ env.PNPM_VERSION }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: pnpm + cache-dependency-path: web/pnpm-lock.yaml + + - name: Install frontend dependencies + run: pnpm install --frozen-lockfile + + - name: Build frontend + run: pnpm build + + docker-publish: + name: Publish Docker Image + if: startsWith(github.ref, 'refs/tags/v') + needs: + - backend-check + - frontend-build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Login registry + run: echo "${{ secrets.DOCKER_PWD }}" | docker login "${{ env.REGISTRY }}" -u "${{ secrets.DOCKER_USER }}" --password-stdin + + - name: Build image + run: docker build -t "${{ env.IMAGE_NAME }}:${GITHUB_REF_NAME}" -t "${{ env.IMAGE_NAME }}:latest" . + + - name: Push image + run: | + docker push "${{ env.IMAGE_NAME }}:${GITHUB_REF_NAME}" + docker push "${{ env.IMAGE_NAME }}:latest" diff --git a/web/stats.html b/web/stats.html index f174adc..dab3061 100644 --- a/web/stats.html +++ b/web/stats.html @@ -4818,7 +4818,7 @@ var drawChart = (function (exports) {