feat: add a basic CI script #10
Workflow file for this run
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | name: CI (lints, tests (todo), and builds) | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-lint-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: 1.22 | |
| cache-dependency-path: src/go.sum | |
| - name: Verify dependencies | |
| run: go mod verify | |
| working-directory: src | |
| - name: Install dependencies | |
| run: go mod tidy | |
| working-directory: src | |
| - name: Build | |
| run: go build ./... | |
| working-directory: src | |
| - name: Lint code (go vet) | |
| run: go vet ./... | |
| working-directory: src | |
| - name: Run tests | |
| run: go test ./... | |
| working-directory: src | |
| - name: install staticcheck | |
| run: go install honnef.co/go/tools/cmd/staticcheck@latest | |
| working-directory: src | |
| - name: Lint code (staticcheck) | |
| run: staticcheck ./... | |
| working-directory: src | |
| check-example-plugins: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: 1.22 | |
| cache-dependency-path: src/go.sum | |
| - name: Verify dependencies (for zoraxy) | |
| run: go mod verify | |
| working-directory: src | |
| - name: Install dependencies (for zoraxy) | |
| run: go mod tidy | |
| working-directory: src | |
| - name: Example plugins are up to date and build successfully | |
| run: | | |
| bash build-all.sh && git diff --exit-code # if code fails to build, or if there are code changes, this step will fail | |
| working-directory: example/plugins | |
| # TODO: if possible, it may be good to test whether the plugins correctly | |
| # report their introspection data when run with the -introspect flag. |