Skip to content

Commit

Permalink
Implement continuous deployment (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
FelicianoTech committed Jul 9, 2023
1 parent f5f291c commit 8f84a15
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 9 deletions.
61 changes: 52 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,73 @@
version: 2.1

orbs:
gor: hubci/goreleaser@2.3
codecov: codecov/codecov@3.2

workflows:
main:
main-wf:
jobs:
- test
- gor/release:
name: goreleaser-snapshot
version: "1.17.2"
go-version: "1.20.3"
dry-run: true
post-steps:
- persist_to_workspace:
root: "."
paths:
- "dist"
release-wf:
jobs:
- build
- test:
filters: &semverFilters
branches:
ignore: /.*/
tags:
# SemVer regex
only: /^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
- gor/release:
name: goreleaser-publish
version: "1.17.2"
go-version: "1.20.3"
filters: *semverFilters
post-steps:
- persist_to_workspace:
root: "."
paths:
- "dist"
context: goreleaser-ctx

jobs:
build:
test:
docker:
- image: cimg/go:1.20
- image: cimg/go:1.20.3
steps:
- checkout
- restore_cache:
keys:
- go-mod-v1-{{ checksum "go.sum" }}
- go-mod-v1-{{ checksum "go.sum" }}
- run:
name: "Download Dependancies"
command: |
go mod download
curl -sSL "https://github.com/magefile/mage/releases/download/v1.14.0/mage_1.14.0_Linux-64bit.tar.gz" | sudo tar -xz --no-same-owner -C /usr/local/bin mage
mage --version
- run:
name: "Test with GoTestSum"
command: |
mkdir ./test-output
gotestsum --junitfile ./test-output/unit-tests.xml
- save_cache:
key: go-mod-v1-{{ checksum "go.sum" }}
paths:
- /home/circleci/go/pkg/mod
- store_test_results:
path: ./test-output
- store_artifacts:
path: test-output/unit-tests.xml
- run:
name: "Try compiling"
command: go build ./...
- codecov/upload
- save_cache:
key: go-mod-v1-{{ checksum "go.sum" }}
paths:
- "/home/circleci/.cache/go-build"
18 changes: 18 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
project_name: feedhub

builds:
- skip: true

archives:
- format: tar.gz
format_overrides:
- goos: windows
format: zip
name_template: >-
{{ .ProjectName }}-v{{ .Version }}-{{ if eq .Os "darwin" }}macos{{ else }}{{ .Os }}{{ end }}-{{ .Arch }}{{ if .Arm }}hf{{ end }}
files:
- LICENSE
- README.md

checksum:
name_template: "{{ .ProjectName }}-v{{ .Version }}-checksums.txt"

0 comments on commit 8f84a15

Please sign in to comment.