-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from numary/feat/add_goReleaser
feat(CI): Add GoReleaser
- Loading branch information
Showing
8 changed files
with
170 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
name: Main | ||
jobs: | ||
oas: | ||
name: 'OAS Readme' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: readmeio/github-readme-sync@v2 | ||
with: | ||
readme-oas-key: ${{ secrets.README_OAS_KEY }} | ||
oas-file-path: './spec/http.yml' | ||
api-version: 'v1.0.0' | ||
terraform: | ||
name: 'Terraform' | ||
runs-on: ubuntu-latest | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
steps: | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.16' | ||
- uses: actions/checkout@v2 | ||
- name: Configure git for private modules | ||
env: | ||
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
run: git config --global url."https://altitude:${TOKEN}@github.com".insteadOf "https://github.com" | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: get deps | ||
run: go get | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
version: latest | ||
args: build --parallelism 4 --rm-dist --skip-validate | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: eu-west-1 | ||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
- name: Build, tag, and push image to Amazon ECR | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
ECR_REPOSITORY: numary-preprod-ecr | ||
IMAGE_TAG: ${{ github.sha }} | ||
run: | | ||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | ||
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Pull Request - Open | ||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
jobs: | ||
Test: | ||
name: 'Test' | ||
runs-on: ubuntu-latest | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
steps: | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.16' | ||
- uses: actions/checkout@v2 | ||
- name: Configure git for private modules | ||
env: | ||
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
run: git config --global url."https://altitude:${TOKEN}@github.com".insteadOf "https://github.com" | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: get deps | ||
run: go get | ||
- name: run tests | ||
run: go test -v -coverpkg=./... -coverprofile=coverage.out ./... | ||
Lint: | ||
name: 'Lint' | ||
runs-on: ubuntu-latest | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
steps: | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.16' | ||
- uses: actions/checkout@v2 | ||
- name: Configure git for private modules | ||
env: | ||
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
run: git config --global url."https://altitude:${TOKEN}@github.com".insteadOf "https://github.com" | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: get deps | ||
run: go get | ||
- name: run vet | ||
run: go vet . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,43 @@ | ||
name: release | ||
on: | ||
release: | ||
types: | ||
- created | ||
types: [created] | ||
permissions: | ||
contents: write | ||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- arch: amd64 | ||
cc: gcc | ||
|
||
env: | ||
GOOS: linux | ||
GOARCH: ${{ matrix.arch }} | ||
|
||
steps: | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.16' | ||
|
||
- uses: actions/checkout@v2 | ||
|
||
- name: Configure git for private modules | ||
env: | ||
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
run: git config --global url."https://altitude:${TOKEN}@github.com".insteadOf "https://github.com" | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cache/go-build | ||
~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: get deps | ||
run: go get | ||
|
||
- id: get-release | ||
uses: bruceadams/get-release@v1.2.2 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
|
||
- name: build | ||
run: | | ||
CGO_ENABLED=1 go build -o numary | ||
tar -czvf numary-${{ steps.get-release.outputs.tag_name }}-${{ env.GOOS }}-${{ env.GOARCH }}.tar.gz numary | ||
- name: upload release | ||
uses: actions/upload-release-asset@v1.0.2 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
upload_url: ${{ steps.get-release.outputs.upload_url }} | ||
asset_path: numary-${{ steps.get-release.outputs.tag_name }}-${{ env.GOOS }}-${{ env.GOARCH }}.tar.gz | ||
asset_name: numary-${{ steps.get-release.outputs.tag_name }}-${{ env.GOOS }}-${{ env.GOARCH }}.tar.gz | ||
asset_content_type: application/gzip | ||
version: latest | ||
args: release --parallelism 2 --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
numary | ||
coverage.out | ||
coverage.out | ||
/dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
before: | ||
hooks: | ||
- go build -o numary | ||
builds: | ||
- env: | ||
- CGO_ENABLED=1 | ||
goos: | ||
- linux | ||
binary: numary | ||
archives: | ||
- replacements: | ||
linux: Linux | ||
amd64: x86_64 | ||
checksum: | ||
name_template: 'checksums.txt' | ||
snapshot: | ||
name_template: "{{ .Tag }}-next" | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
FROM alpine:latest | ||
|
||
ADD numary /usr/local/bin/numary | ||
ADD dist/ledger_linux_amd64/numary /usr/local/bin/numary | ||
|
||
EXPOSE 3068 | ||
|
||
CMD ["numary", "server", "start"] | ||
CMD ["numary", "server", "start"] |