diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml new file mode 100644 index 000000000..547265390 --- /dev/null +++ b/.github/workflows/linter.yaml @@ -0,0 +1,35 @@ +name: linter + +on: + pull_request: + +jobs: + golangcilint: + name: golangci-lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: 1.22 + - name: Main module lint + uses: golangci/golangci-lint-action@v6 + with: + version: v1.57.2 + - name: x/sqlite module lint + uses: golangci/golangci-lint-action@v6 + with: + working-directory: ./x/sqlite + version: v1.57.2 + - name: Main module go.mod + run: | + go mod tidy -compat=1.17 && git diff --exit-code + - name: x/sqlite module go.mod + run: | + cd x/sqlite + go mod tidy && git diff --exit-code + - name: Main module generate + run: | + go generate ./... + git diff --exit-code diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5f43da0bb..c655c94cc 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest permissions: write-all steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 1 diff --git a/.github/workflows/test-sqlite.yaml b/.github/workflows/test-sqlite.yaml new file mode 100644 index 000000000..9e5dc76b2 --- /dev/null +++ b/.github/workflows/test-sqlite.yaml @@ -0,0 +1,24 @@ +name: tests-sqlite + +on: + pull_request: + +jobs: + test: + strategy: + matrix: + go-version: [1.22] # TODO: Add 1.23rc2 + name: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + check-latest: true + go-version: ${{ matrix.go-version }} + - name: Run tests + run: | + cd x/sqlite + go mod download + go test -race -shuffle=on ./... diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 000000000..fde00eebe --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,58 @@ +name: tests + +on: + pull_request: + +env: + COUCHDB_USER: admin + COUCHDB_PASSWORD: abc123 + +jobs: + container-job: + runs-on: ubuntu-latest + container: + image: node:18-bullseye + services: + couchdb: + image: couchdb:2.2.0 + env: + COUCHDB_USER: admin + COUCHDB_PASSWORD: abc123 + ports: + - 5984:5984 + test: + strategy: + matrix: + go-version: [1.22] # TODO: Add 1.23rc2 + name: test + runs-on: ubuntu-latest + # services: + # couchdb: + # env: + # COUCHDB_USER: admin + # COUCHDB_PASSWORD: abc123 + # image: couchdb:2.2.0 + # options: >- + # --health-cmd "curl -sSf http://localhost:5984/_up" + # --health-interval 10s + # --health-timeout 5s + # --health-retries 5 + steps: + - uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + check-latest: true + go-version: ${{ matrix.go-version }} + - name: Prepare CouchDB + run: | + export KIVIK_TEST_DSN_COUCH22=http://${COUCHDB_USER}:${COUCHDB_PASSWORD}@couchdb:5984/ + while ! curl -sSf http://couchdb:5984/; do + echo "Waiting for CouchDB to be ready..." + sleep 5 + done + ./script/complete_couch2.sh ${KIVIK_TEST_DSN_COUCH22} + - name: Run tests + run: | + go mod download + go test -race -shuffle=on ./... diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e6ac86f6f..e2aef8ddc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,15 +17,6 @@ test-x-sqlite: - go mod download - go test -race -shuffle=on ./... -linter-x-sqlite: - stage: test - image: golangci/golangci-lint:v1.57.2 - script: - - cd x/sqlite - - go mod download - - golangci-lint run ./... - - go mod tidy && git diff --exit-code - test: parallel: matrix: @@ -68,16 +59,6 @@ test: - go mod download - go test -race -shuffle=on ./... -linter: - stage: test - image: golangci/golangci-lint:v1.57.2 - script: - - go mod download - - golangci-lint run ./... - - go mod tidy -compat=1.17 && git diff --exit-code - - go generate ./... - - git diff --exit-code - coverage: stage: test image: golang:1.22 diff --git a/script/complete_couch2.sh b/script/complete_couch2.sh index 587ee4de7..a69ca320e 100755 --- a/script/complete_couch2.sh +++ b/script/complete_couch2.sh @@ -1,8 +1,9 @@ #!/bin/sh -e +set -x + for db in _users _replicator _global_changes; do -echo ${1}/${db} - status=$(curl --silent --write-out "%{http_code}" -o /dev/null -u ${COUCHDB_USER}:${COUCHDB_PASSWORD} -X PUT "${1}/${db}") + status=$(curl --write-out "%{http_code}" -o /dev/null -u ${COUCHDB_USER}:${COUCHDB_PASSWORD} -X PUT "${1}/${db}") case ${status} in 2*) # Success!