Skip to content

Commit

Permalink
Better CI pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
cristaloleg committed Jan 22, 2022
1 parent 5de1ca2 commit b6d6be7
Showing 1 changed file with 6 additions and 56 deletions.
62 changes: 6 additions & 56 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,72 +2,22 @@ name: build

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
tag:
description: 'Tag to create'
required: true
default: 'v0.0.0'

# See https://github.com/cristalhq/.github/.github/workflows
jobs:

build:
name: Build & Test
runs-on: ubuntu-latest

steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.15

- name: Check out code
uses: actions/checkout@v2

- name: Download module dependencies
env:
GOPROXY: "https://proxy.golang.org"
run: go mod download

- name: Test
run: go test -v -coverprofile=coverage.txt ./...

- name: Test YAML
run: cd aconfigyaml && go test -v ./...

- name: Test TOML
run: cd aconfigtoml && go test -v ./...

- name: Test HCL
run: cd aconfighcl && go test -v ./...

- name: Test DotEnv
run: cd aconfigdotenv && go test -v ./...

- name: Upload Coverage
uses: codecov/codecov-action@v1
continue-on-error: true
with:
token: ${{secrets.CODECOV_TOKEN}}
file: ./coverage.txt
fail_ci_if_error: false
uses: cristalhq/.github/.github/workflows/build.yml@main

release:
if: github.event_name == 'workflow_dispatch'

name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Checkout with tags
run: git fetch --prune --unshallow --tags

- name: Create release
run: |
git log --format="%C(auto) %H %s" `git tag --sort=-committerdate | head -1`...HEAD > changelog.txt
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
gh release create ${{ github.event.inputs.tag }} -F changelog.txt
uses: cristalhq/.github/.github/workflows/release.yml@main
with:
tag: ${{ github.event.input.tag }}

0 comments on commit b6d6be7

Please sign in to comment.