diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..5b50d13d8 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,71 @@ +version: 2.1 + +executors: + amd64: + machine: + image: ubuntu-2004:current + resource_class: large + arm64: + machine: + image: ubuntu-2004:current + resource_class: arm.large + +jobs: + unit-test: + parameters: + platform: + type: executor + executor: << parameters.platform >> + working_directory: ~/repo + steps: + - checkout + - run: + name: Install Docker Compose + environment: + COMPOSE_VERSION: 'v2.17.1' + command: | + curl -L "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o ~/docker-compose + chmod +x ~/docker-compose + sudo mv ~/docker-compose /usr/local/bin/docker-compose + - run: + name: Set up databases + command: docker-compose up -d + working_directory: ./storage + - run: + name: Set up dataset + command: | + mkdir -p ~/.gorse/dataset + mkdir -p ~/.gorse/download + wget https://cdn.gorse.io/datasets/ml-100k.zip -P ~/.gorse/download + wget https://cdn.gorse.io/datasets/ml-1m.zip -P ~/.gorse/download + wget https://cdn.gorse.io/datasets/pinterest-20.zip -P ~/.gorse/download + wget https://cdn.gorse.io/datasets/frappe.zip -P ~/.gorse/download + wget https://cdn.gorse.io/datasets/ml-tag.zip -P ~/.gorse/download + wget https://cdn.gorse.io/datasets/criteo.zip -P ~/.gorse/download + unzip ~/.gorse/download/ml-100k.zip -d ~/.gorse/dataset + unzip ~/.gorse/download/ml-1m.zip -d ~/.gorse/dataset + unzip ~/.gorse/download/pinterest-20.zip -d ~/.gorse/dataset + unzip ~/.gorse/download/frappe.zip -d ~/.gorse/dataset + unzip ~/.gorse/download/ml-tag.zip -d ~/.gorse/dataset + unzip ~/.gorse/download/criteo.zip -d ~/.gorse/dataset + - restore_cache: + keys: + - go-mod-v4-{{ checksum "go.sum" }} + - run: + name: Install Dependencies + command: go mod download + - save_cache: + key: go-mod-v4-{{ checksum "go.sum" }} + paths: + - "/go/pkg/mod" + - run: + name: Run tests + command: go test -timeout 20m -v ./... + +workflows: + unit-test: + jobs: + - unit-test: + matrix: + parameters: + platform: [amd64, arm64] \ No newline at end of file