Skip to content

Commit

Permalink
project: add initial boilerplate
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@cern.ch>
  • Loading branch information
MrFreezeex committed Jun 21, 2022
0 parents commit 1c82205
Show file tree
Hide file tree
Showing 7 changed files with 533 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: goreleaser

on:
create:

jobs:
goreleaser:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
terraform-provider-ceph
.terraform
terraform.tfstate
terraform.tfstate.backup
*.swp
terraform.log
.vscode
dist/
87 changes: 87 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---

stages:
- build
- security
- qa
- misc
- release

include:
- template: SAST.gitlab-ci.yml
- template: Security/Dependency-Scanning.gitlab-ci.yml
- template: Security/Secret-Detection.gitlab-ci.yml

build:
stage: build
image: golang:1.17
script:
- make build
artifacts:
expose_as: 'terraform-provider-ceph'
paths:
- terraform-provider-ceph

sast:
stage: security
needs: []

dependency_scanning:
stage: security
needs: []

secret_detection:
stage: security
needs: []

golang-lint:
stage: qa
needs: []
image: golangci/golangci-lint:v1.45
script:
- golangci-lint run -v

test-go-generate:
stage: qa
needs: []
image: golang:1.17
variables:
TERRAFORM_VERSION: 1.1.8
script:
- apt-get update && apt-get install zip -y
- wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip
- unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/local/bin
- go generate
- |
git diff --compact-summary --exit-code ||
(echo;
echo "Unexpected difference in directories after code generation. Run 'go generate' command and commit.";
exit 1)
code_navigation:
stage: misc
image: sourcegraph/lsif-go:v1
needs: []
script:
- lsif-go
allow_failure: true # recommended
artifacts:
reports:
lsif: dump.lsif

release:
stage: release
image:
name: goreleaser/goreleaser:v1.9.2
entrypoint: ['']
only:
- tags
variables:
# Disable shallow cloning so that goreleaser can diff between tags to
# generate a changelog.
GIT_DEPTH: 0
before_script:
- apk add gpg-agent
- gpg --import < $GPG_PRIVATE_KEY_FILE
script:
- goreleaser release --rm-dist
Loading

0 comments on commit 1c82205

Please sign in to comment.