Skip to content

Commit

Permalink
Create go.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mjm918 authored Aug 14, 2024
1 parent 628386a commit c658df4
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Go

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:

build:
name: Build, Test and Package on All Platforms
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22.5'

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...

- name: Package
run: |
mkdir -p release
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
tar -czvf release/${{ github.repository }}_${{ github.run_number }}_linux_amd64.tar.gz ./*
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
tar -czvf release/${{ github.repository }}_${{ github.run_number }}_darwin_amd64.tar.gz ./*
else
zip -r release\\${{ github.repository }}_${{ github.run_number }}_windows_amd64.zip .\\*
shell: bash

- name: Upload Release Assets
uses: actions/upload-artifact@v3
with:
name: release
path: release

0 comments on commit c658df4

Please sign in to comment.