Skip to content

support arm image build #195

support arm image build

support arm image build #195

Workflow file for this run

name: CI
on:
pull_request:
branches:
- main
push:
tags:
- 'v*'
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup
uses: actions/setup-go@v3
with:
go-version: '1.22'
cache: true
- name: Run tests with coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ARGOCD_URL: ${{ secrets.ARGOCD_URL }}
ARGOCD_TOKEN: ${{ secrets.ARGOCD_TOKEN }}
ARGOCD_TEST_CLUSTER: ${{ secrets.ARGOCD_TEST_CLUSTER }}
ARGOCD_TEST_NAMESPACE: ${{ secrets.ARGOCD_TEST_NAMESPACE }}
run: |
go test -coverprofile=coverage.txt -v ./...
go tool cover -html=coverage.txt
ci:
needs: test
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' }}
outputs:
tag: ${{ steps.tag.outputs.tag }}
strategy:
matrix:
os: [ linux, darwin, windows ]
arch: [ amd64, arm64 ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.22'
cache: true
- name: New Artifact Dir
run: mkdir artifact
- name: Build ${{ matrix.os }}
env:
CGO_ENABLED: 0
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
run: |
if [ ${GOOS} == windows ];then
export app=workflow-tools.exe
else
export app=workflow-tools
fi
go build -o ${app} .
tar -zcvf ${GOOS}_${GOARCH}.tar.gz ./${app}
rm -rf ./${app}
mv ${GOOS}_${GOARCH}.tar.gz artifact
- name: Upload binary
uses: actions/upload-artifact@v3
if: startsWith(github.ref, 'refs/tags/')
with:
name: binary
path: ${{ github.workspace }}/artifact
if-no-files-found: error
release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [ test, ci ]
steps:
- uses: actions/checkout@v3
- name: Download binary
uses: actions/download-artifact@v3
with:
name: binary
path: public/
- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
body_path: README.md
files: |
public/linux_amd64.tar.gz
public/windows_amd64.tar.gz
public/darwin_amd64.tar.gz
public/linux_arm64.tar.gz
public/windows_arm64.tar.gz
public/darwin_arm64.tar.gz