name: ci on: push: branches: [ main ] pull_request: jobs: lint: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 - uses: jdx/mise-action@146a28175021df8ca24f8ee1828cc2a60f980bd5 # v3 - name: Run golangci-lint uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8 with: install-mode: none args: --timeout 5m test: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 - uses: jdx/mise-action@146a28175021df8ca24f8ee1828cc2a60f980bd5 # v3 - name: Run tests run: go test -v -race -coverpkg=./... -coverprofile=coverage.txt ./... - name: Upload results to Codecov uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5 with: token: ${{ secrets.CODECOV_TOKEN }} flags: unit test-e2e-forgejo: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 - name: Set up Go uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5 with: go-version-file: go.mod # We can not use "jobs..services". # We want to mount the config file, which is only available after "Checkout". - name: Start Forgejo working-directory: test/e2e/forgejo run: docker compose up --wait - name: Run tests run: go test -tags e2e_forgejo -v -race -coverpkg=./... -coverprofile=coverage.txt ./test/e2e/forgejo - name: Upload results to Codecov uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5 with: token: ${{ secrets.CODECOV_TOKEN }} flags: e2e go-mod-tidy: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 - uses: jdx/mise-action@146a28175021df8ca24f8ee1828cc2a60f980bd5 # v3 - name: Run go mod tidy run: go mod tidy - name: Check uncommitted changes run: git diff --exit-code - if: failure() run: echo "::error::Check failed, please run 'go mod tidy' and commit the changes."