Skip to content

Merge pull request #96 from jeremyje/dependabot/go_modules/golang.org… #238

Merge pull request #96 from jeremyje/dependabot/go_modules/golang.org…

Merge pull request #96 from jeremyje/dependabot/go_modules/golang.org… #238

Workflow file for this run

# Copyright 2023 Jeremy Edwards
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: CI
on:
push:
tags: ["v*"]
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checks out a copy of your repository on the ubuntu-latest machine
- name: Checkout Code
uses: actions/checkout@v3
# https://github.com/actions/setup-go
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.19'
- name: Clean
run: make clean
- name: Test
run: make test-25
- name: Coverage
run: make coverage.txt
- name: Push Code Coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: ./coverage.txt # optional
flags: unittests # optional
name: codecov-umbrella # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
- name: Binaries
run: make all -j$(nproc)
# https://github.com/docker/login-action#github-packages-docker-registry
- name: Login to GitHub Container Registry
if: startsWith(github.ref, 'refs/tags/')
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
if: startsWith(github.ref, 'refs/tags/')
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
if: startsWith(github.ref, 'refs/tags/')
uses: docker/setup-buildx-action@v2
- name: Build Images
if: startsWith(github.ref, 'refs/tags/')
run: make DOCKER_PUSH=--push images
- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
generate_release_notes: true
draft: true
prerelease: false
files: |
LICENSE
build/bin/linux_amd64/coretemp-exporter
build/bin/windows_amd64/coretemp-exporter.exe
build/bin/linux_amd64/converter
build/bin/windows_amd64/converter.exe
- name: Publish Application
uses: actions/upload-artifact@v3
if: startsWith(github.ref, 'refs/tags/')
with:
name: release.tar.gz
path: |
LICENSE
build/bin/linux_amd64/coretemp-exporter
build/bin/windows_amd64/coretemp-exporter.exe
build/bin/linux_amd64/converter
build/bin/windows_amd64/converter.exe