| 1 |
name: CI |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
pull_request: |
| 6 |
|
| 7 |
jobs: |
| 8 |
staticcheck: |
| 9 |
runs-on: ubuntu-latest |
| 10 |
steps: |
| 11 |
- uses: actions/checkout@v2 |
| 12 |
- uses: dominikh/staticcheck-action@v1 |
| 13 |
|
| 14 |
tests: |
| 15 |
strategy: |
| 16 |
matrix: |
| 17 |
os: |
| 18 |
- macos-latest |
| 19 |
- ubuntu-latest |
| 20 |
- windows-latest |
| 21 |
runs-on: ${{ matrix.os }} |
| 22 |
|
| 23 |
steps: |
| 24 |
- uses: actions/checkout@v4 |
| 25 |
|
| 26 |
- uses: actions/setup-go@v5 |
| 27 |
with: |
| 28 |
|
| 29 |
go-version: 'stable' |
| 30 |
|
| 31 |
- name: Ensure all files were formatted as per gofmt |
| 32 |
if: matrix.os == 'ubuntu-latest' |
| 33 |
run: | |
| 34 |
[ "$(gofmt -l $(find . -name '*.go') 2>&1)" = "" ] |
| 35 |
|
| 36 |
- name: install rsync |
| 37 |
if: matrix.os == 'ubuntu-latest' |
| 38 |
run: | |
| 39 |
docker build --pull --no-cache --rm -t=rsync-debian -f testdata/ci-debian.Dockerfile . |
| 40 |
docker build --pull --no-cache --rm -t=rsync-fedora -f testdata/ci-fedora.Dockerfile . |
| 41 |
|
| 42 |
- name: install rsync |
| 43 |
if: matrix.os == 'windows-latest' |
| 44 |
run: choco install rsync |
| 45 |
|
| 46 |
- name: run tests (linux) |
| 47 |
if: matrix.os == 'ubuntu-latest' |
| 48 |
run: | |
| 49 |
go test -v ./... |
| 50 |
echo "::group::rsync from Debian" |
| 51 |
docker run -v $PWD:/usr/src/rsync/ -w /usr/src/rsync rsync-debian go test ./... |
| 52 |
echo "::endgroup::" |
| 53 |
echo "::group::rsync from Fedora" |
| 54 |
docker run -v $PWD:/usr/src/rsync/ -w /usr/src/rsync rsync-fedora go test ./... |
| 55 |
echo "::endgroup::" |
| 56 |
|
| 57 |
- name: run tests (macos) |
| 58 |
if: matrix.os == 'macos-latest' |
| 59 |
run: sudo go test -v ./... |
| 60 |
|
| 61 |
- name: run tests (windows) |
| 62 |
if: matrix.os == 'windows-latest' |
| 63 |
run: go test -v ./... |