Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from GitLab-CI to GitHub Actions #1033

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/test-sqlite.yaml
Original file line number Diff line number Diff line change
@@ -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 ./...
58 changes: 58 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -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 ./...
19 changes: 0 additions & 19 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions script/complete_couch2.sh
Original file line number Diff line number Diff line change
@@ -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!
Expand Down