Skip to content

Commit

Permalink
Merge pull request #9 from yinebebt/circleci-project-setup
Browse files Browse the repository at this point in the history
CircleCI config
  • Loading branch information
yinebebt authored Aug 15, 2024
2 parents 2d3e0fb + d336b27 commit 6a3d4c2
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
version: 2.1
jobs:
test-go:
# Install go modules and run tests
docker:
- image: cimg/go:1.20
steps:
- checkout
- restore_cache:
key: go-mod-{{ checksum "go.sum" }}
- run:
name: Download Go modules
command: go mod download
- save_cache:
key: go-mod-{{ checksum "go.sum" }}
paths:
- /home/circleci/go/pkg/mod
- run:
name: Run tests
command: gotestsum --junitfile junit.xml
- store_test_results:
path: junit.xml
build-go-executables:
# Build go executables and store them as artifacts
docker:
- image: cimg/go:1.20
steps:
- checkout
- restore_cache:
key: go-mod-{{ checksum "go.sum" }}
- run:
name: Download Go modules
command: go mod download
- save_cache:
key: go-mod-{{ checksum "go.sum" }}
paths:
- /home/circleci/go/pkg/mod
- run:
name: Create the ~/artifacts directory if it doesn't exist
command: mkdir -p ~/artifacts
- run:
name: Build executables
command: go build -o ~/artifacts ./...
- store_artifacts:
path: ~/artifacts
destination: executables
deploy:
# This is an example deploy job, not actually used by the workflow
docker:
- image: cimg/base:stable
steps:
# Replace this with steps to deploy to users
- run:
name: deploy
command: '#e.g. ./deploy.sh'
- run:
name: found github actions config
command: ':'
workflows:
build-and-test:
jobs:
- test-go
- build-go-executables:
requires:
- test-go
# - deploy:
# requires:
# - build-go-executables

0 comments on commit 6a3d4c2

Please sign in to comment.