linting #643
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
name: firmware-syncer CI | |
on: | |
push: | |
branches: | |
- '*' | |
tags: | |
- 'v*.*.*' | |
- 'v*.*.*-staging' | |
pull_request: | |
branches: | |
- '*' | |
jobs: | |
lint-test-build-artifacts: | |
name: 🏗️ Lint, test and build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.19 | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.19' | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
- name: Configure git for private modules | |
env: | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: git config --global url."https://${TOKEN}:x-oauth-basic@github.com".insteadOf "https://github.com/equinixmetal" | |
- name: Run golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.48.0 | |
args: --config .golangci.yml --timeout=5m | |
- name: Run firmware-syncer tests | |
run: make test | |
- name: Build firmware-syncer executable | |
run: make build-linux | |
- uses: actions/upload-artifact@v3 | |
if: ( contains(github.ref, 'tags') && ! contains(github.ref, 'staging') ) | |
with: | |
name: firmware-syncer-artifacts | |
path: | | |
firmware-syncer | |
firmware-syncer_checksum.txt | |
publish-executables: | |
name: 📦 Publish firmware-syncer executable | |
runs-on: ubuntu-latest | |
if: ( contains(github.ref, 'tags') && ! contains(github.ref, 'staging') ) | |
needs: lint-test-build-artifacts | |
steps: | |
- name: Set up Go 1.19 | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.19' | |
id: go | |
- name: Set git token env var | |
env: | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: git config --global url."https://${TOKEN}:x-oauth-basic@github.com".insteadOf "https://github.com/equinixmetal" | |
- uses: actions/download-artifact@v3 | |
with: | |
name: firmware-syncer-artifacts | |
- name: Create a new release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
- name: release artifact files | |
uses: softprops/action-gh-release@v1 | |
if: contains(github.ref, 'tags') | |
with: | |
files: | | |
firmware-syncer | |
firmware-syncer_checksum.txt |