Skip to content
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
251 changes: 158 additions & 93 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,123 +1,188 @@
version: 2.1
# =================================================================
#
# Copyright (C) 2022 Spatial Current, Inc. - All Rights Reserved
# Released as open source under the MIT License. See LICENSE file.
#
# =================================================================

version: "2.1"

executors:

# `arm` uses an ARM machine image.
arm:
machine:
image: ubuntu-2004:202101-01
resource_class: arm.medium

# `base` uses the `cimg/base` docker image.
base:
docker:
- image: circleci/golang:1.12-node
working_directory: /go/src/github.com/spatialcurrent/go-simple-serializer
- image: cimg/base:2020.07

# `macos` uses the macOS machine image.
macos:
macos:
xcode: 12.4.0
resource_class: medium

# `main` uses the `cimg/go:1.17` docker image.
main:
docker:
- image: cimg/go:1.17

# `windows` uses the Windows machine image.
windows:
machine:
image: "windows-server-2019-vs2019:stable"
resource_class: "windows.medium"
shell: "powershell.exe -ExecutionPolicy Bypass"

jobs:
pre_deps_golang:
executor: base
steps:
- checkout
- run: make deps_go
- run: sudo chown -R circleci /go/src
- save_cache:
key: v1-go-src-{{ .Branch }}-{{ .Revision }}
paths:
- /go/src

# `test_go` tests the source code.
test_go:
executor: base
executor: main
steps:
- run: sudo chown -R circleci /go/src
- restore_cache:
keys:
- v1-go-src-{{ .Branch }}-{{ .Revision }}
- run: make deps_go_test
- run: make test_go
- checkout
- run: make fmt
- run: make imports
- run: make test_go
- run: git diff --exit-code

# `test_cli` tests the executable.
test_cli:
executor: base
executor: main
steps:
- run: sudo chown -R circleci /go/src
- restore_cache:
keys:
- v1-go-src-{{ .Branch }}-{{ .Revision }}
- run: make deps_go_test
- run: make install
- checkout
- run: make tidy
- run: make bin/gss
- run: make test_cli
test_javascript:
executor: base
steps:
- run: sudo chown -R circleci /go/src
- restore_cache:
keys:
- v1-go-src-{{ .Branch }}-{{ .Revision }}
- run: make deps_gopherjs
- run: make deps_javascript
- run: npm run test:clean

examples:
executor: base
executor: main
steps:
- run: sudo chown -R circleci /go/src
- restore_cache:
keys:
- v1-go-src-{{ .Branch }}-{{ .Revision }}
- run: make deps_gopherjs
- run: make deps_javascript
- run: npm run build:clean
- checkout
# Update apt cache
- run: sudo apt-get update

# Tidy dependencies
- run: make tidy

# Install ARM dependencies
- run: sudo make deps_arm

# Build shared objects
- run: make build_so

# Run examples
- run: make run_example_c
- run: make run_example_cpp
- run: make run_example_javascript
- run: make run_example_python
build_cli:
executor: base

# `build` builds the executables
build:
executor: main
steps:
- run: sudo chown -R circleci /go/src
- restore_cache:
keys:
- v1-go-src-{{ .Branch }}-{{ .Revision }}
- run: go get github.com/inconshreveable/mousetrap # for windows CLI builds
- run: make build_cli
- checkout

# Update apt cache
- run: sudo apt-get update

# Tidy dependencies
- run: make tidy

# Make gox
- run: make bin/gox

# Print supported OS/Arch combinations
- run: bin/gox -osarch-list

# Build Executeables
- run: make build_release

# Remove gox
- run: rm -f bin/gox

- store_artifacts:
path: bin
destination: /
build_javascript:

- persist_to_workspace:
root: bin
paths:
- gss_darwin_amd64
- gss_darwin_arm64
- gss_freebsd_386
- gss_freebsd_amd64
- gss_freebsd_arm
- gss_linux_386
- gss_linux_amd64
- gss_linux_arm
- gss_linux_arm64
- gss_openbsd_386
- gss_openbsd_amd64
- gss_solaris_amd64
- gss_windows_386.exe
- gss_windows_amd64.exe

# Install arm dependencies
- run: sudo make deps_arm

# Build shared objects
- run: make build_so

# `verify_linux` verifys the linux build
verify_linux:
executor: base
steps:
- run: sudo chown -R circleci /go/src
- restore_cache:
keys:
- v1-go-src-{{ .Branch }}-{{ .Revision }}
- run: make deps_gopherjs
- run: make build_javascript
- store_artifacts:
path: dist
destination: /
build_so:
executor: base
- attach_workspace:
at: bin
- run: bin/gss_linux_386 --help
- run: bin/gss_linux_amd64 --help

# `verify_linux_arm` verifys the linux/arm build
verify_linux_arm:
executor: arm
steps:
- run: sudo chown -R circleci /go/src
- restore_cache:
keys:
- v1-go-src-{{ .Branch }}-{{ .Revision }}
- run: sudo make deps_arm
- run: make build_so
- store_artifacts:
path: bin
destination: /
- attach_workspace:
at: bin
- run: bin/gss_linux_arm --help
- run: bin/gss_linux_arm64 --help

# `verify_macos` verifys the macOS build
verify_macos:
executor: macos
steps:
- attach_workspace:
at: bin
- run: bin/gss_darwin_amd64 --help

# `verify_windows` verifys the windows build
verify_windows:
executor: windows
steps:
- attach_workspace:
at: bin
- run: bin/gss_windows_386.exe --help
- run: bin/gss_windows_amd64.exe --help

workflows:
main:
jobs:
- pre_deps_golang
- test_go:
requires:
- pre_deps_golang
- test_cli:
requires:
- pre_deps_golang
- test_javascript:
requires:
- pre_deps_golang
- examples:
- test_go
- test_cli
- build
- examples
- verify_linux:
requires:
- pre_deps_golang
- build_cli:
- build
- verify_linux_arm:
requires:
- pre_deps_golang
- build_javascript:
- build
- verify_macos:
requires:
- pre_deps_golang
- build_so:
- build
- verify_windows:
requires:
- pre_deps_golang
- build
24 changes: 24 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

##########################################
# DO NOT MAKE LOCAL CHANGES TO THIS FILE #
# #
# Vars in this file can be overridden by #
# exporting them in .envrc.local #
##########################################

# Add local paths for binaries and scripts
PATH_add ./bin
PATH_add ./scripts

##############################################
# Load Local Overrides and Check Environment #
##############################################

# Load a local overrides file. Any changes you want to make for your local
# environment should live in that file.

if [ -e .envrc.local ]
then
source_env .envrc.local
fi
10 changes: 0 additions & 10 deletions .eslintignore

This file was deleted.

35 changes: 0 additions & 35 deletions .eslintrc

This file was deleted.

18 changes: 10 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# compiled binaries
bin
dist

# direnv
.envrc.local

# secrets
secret/

# miscellaneous
.DS_Store
temp
vendor
Gopkg.lock
*.so
*.h
.DS_Store
.npm
node_modules
npm-debug.*
package-lock.json
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Spatial Current, Inc.
Copyright (c) 2022 Spatial Current, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading