67 lines
1.7 KiB
YAML
67 lines
1.7 KiB
YAML
name: CI
|
|
on:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: 1.21
|
|
- name: Lint
|
|
uses: golangci/golangci-lint-action@v4
|
|
with:
|
|
version: v1.54.2
|
|
unit-test:
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: 1.21
|
|
- name: Unit Tests
|
|
run: ./script/test
|
|
e2e-test:
|
|
needs: unit-test
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
matrix:
|
|
platform: [linux]
|
|
arch: [amd64, arm64]
|
|
exclude:
|
|
# Exclude Windows AMD64 because it's not supported
|
|
- platform: windows
|
|
arch: amd64
|
|
|
|
steps:
|
|
- name: Setup QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: 1.21
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Build Binary for ${{ matrix.platform }}-${{ matrix.arch }}
|
|
run: |
|
|
if [[ "${{ matrix.platform }}" == "linux" ]]; then
|
|
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
|
fi
|
|
|
|
GOOS=${{ matrix.platform }} GOARCH=${{ matrix.arch }} go build -o bin/actions-sync-${{ matrix.platform }}-${{ matrix.arch }} main.go
|
|
|
|
- name: Run End-to-End Tests for ${{ matrix.platform }}-${{ matrix.arch }}
|
|
run: ./script/test-ci bin/actions-sync-${{ matrix.platform }}-${{ matrix.arch }}
|