Implement retrieval client for better unit testing #156
Workflow file for this run
This file contains hidden or 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: Builds | |
| permissions: | |
| contents: read | |
| on: | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| build-docker: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - | |
| name: Checkout | |
| uses: actions/checkout@v4 | |
| - | |
| name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - | |
| name: Build | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: false | |
| build-windows: | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| arch: [amd64, arm64] | |
| steps: | |
| - | |
| name: Checkout | |
| uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: ">=1.19.7" | |
| - | |
| name: Set GOARCH environment variable | |
| run: | | |
| if ("${{ matrix.arch }}" -eq "amd64") { | |
| echo "GOARCH=amd64" >> $env:GITHUB_ENV | |
| } elseif ("${{ matrix.arch }}" -eq "arm64") { | |
| echo "GOARCH=arm64" >> $env:GITHUB_ENV | |
| } | |
| shell: powershell | |
| - | |
| name: Go Build | |
| run: go build -o ./win-build/ssh-sync-${{ matrix.arch }}.exe -ldflags "-X main.version=${{github.ref_name}}" | |
| shell: powershell | |
| - | |
| name: Inno Build | |
| run: | | |
| & "${env:ProgramFiles(x86)}\Inno Setup 6\iscc.exe" /dMyAppVersion="${{github.ref_name}}" /dMyAppArch="${{ matrix.arch }}" "$env:GITHUB_WORKSPACE\win-build\setup.iss" | |
| shell: powershell | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| arch: [amd64, arm64, arm] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: ">=1.19.7" | |
| - name: Set GOARCH environment variable | |
| run: | | |
| if [ "${{ matrix.arch }}" = "amd64" ]; then | |
| echo "GOARCH=amd64" >> $GITHUB_ENV | |
| elif [ "${{ matrix.arch }}" = "arm64" ]; then | |
| echo "GOARCH=arm64" >> $GITHUB_ENV | |
| elif [ "${{ matrix.arch }}" = "arm" ]; then | |
| echo "GOARCH=arm" >> $GITHUB_ENV | |
| echo "GOARM=7" >> $GITHUB_ENV | |
| fi | |
| - name: Go Build | |
| run: go build -o ssh-sync-${{ matrix.arch }} -ldflags "-X main.version=${{github.ref_name}}" | |
| - name: Install FPM | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ruby ruby-dev rubygems build-essential rpm zstd | |
| sudo gem install --no-document fpm | |
| - name: Create test packages | |
| run: | | |
| # Create a .deb package | |
| fpm -s dir -t deb -a ${{ matrix.arch }} -n ssh-sync -v "test-build" --description "ssh-sync test build" \ | |
| --deb-no-default-config-files \ | |
| ./ssh-sync-${{ matrix.arch }}=/usr/local/bin/ssh-sync | |
| # Create an .rpm package | |
| fpm -s dir -t rpm -a ${{ matrix.arch }} -n ssh-sync -v "test-build" --description "ssh-sync test build" \ | |
| ./ssh-sync-${{ matrix.arch }}=/usr/local/bin/ssh-sync | |
| # Create an Arch Linux package (.tar.zst) | |
| fpm -s dir -t tar -a ${{ matrix.arch }} -n ssh-sync -v "test-build" --description "ssh-sync test build" \ | |
| ./ssh-sync-${{ matrix.arch }}=/usr/local/bin/ssh-sync | |
| # Compress with zstd and rename to follow Arch naming convention | |
| mv ssh-sync.tar ssh-sync-test-build-${{ matrix.arch }}.tar | |
| zstd ssh-sync-test-build-${{ matrix.arch }}.tar -o ssh-sync-test-build-${{ matrix.arch }}.pkg.tar.zst | |
| rm ssh-sync-test-build-${{ matrix.arch }}.tar | |
| - name: Verify packages were created | |
| run: | | |
| echo "Created packages:" | |
| ls -la *.deb *.rpm *.pkg.tar.zst | |
| unit-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: ">=1.19.7" | |
| - name: Run unit tests | |
| run: go test ./... |