diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index 950fb2a1..18195842 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -6,11 +6,11 @@ on: pull_request: env: - GOLATEST: 1.14 + GO_LATEST: 1.14 jobs: - build-test-upload: - name: Build, run tests and upload build artifacts + test-deploy: + name: Test and deploy runs-on: ${{ matrix.os }} strategy: matrix: @@ -23,16 +23,16 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Install Go + - name: Set up Go uses: actions/setup-go@v2 with: go-version: ${{ matrix.go }} - - name: Build Linux/macOS + - name: Build for Linux/macOS if: startsWith(matrix.os, 'windows-') != true run: go build -i -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/version.date=`date -u +%FT%TZ`" -o sftpgo - - name: Build Windows + - name: Build for Windows if: startsWith(matrix.os, 'windows-') run: | $GIT_COMMIT = (git describe --always --dirty) | Out-String @@ -46,15 +46,14 @@ jobs: - name: Run test cases using SQLite provider run: go test -v ./... -coverprofile=coverage.txt -covermode=atomic - - name: Upload to Codecov - if: ${{ matrix.go == env.GOLATEST && startsWith(matrix.os, 'windows-') != true }} + - name: Upload coverage to Codecov + if: ${{ matrix.go == env.GO_LATEST && startsWith(matrix.os, 'windows-') != true }} uses: codecov/codecov-action@v1 with: file: ./coverage.txt fail_ci_if_error: false - name: Run test cases using bolt provider - if: ${{ matrix.go == env.GOLATEST }} run: | go test -v ./config -covermode=atomic go test -v ./httpd -covermode=atomic @@ -64,13 +63,12 @@ jobs: SFTPGO_DATA_PROVIDER__NAME: 'sftpgo_bolt.db' - name: Run test cases using memory provider - if: ${{ matrix.go == env.GOLATEST }} run: go test -v ./... -covermode=atomic env: SFTPGO_DATA_PROVIDER__DRIVER: memory SFTPGO_DATA_PROVIDER__NAME: '' - - name: Prepare artifacts Linux/macOS + - name: Prepare build artifact for Linux/macOS if: startsWith(matrix.os, 'windows-') != true run: | mkdir output @@ -79,25 +77,25 @@ jobs: cp -r templates output/ cp -r static output/ - - name: Prepare artifacts Windows + - name: Prepare build artifact for Windows if: startsWith(matrix.os, 'windows-') run: | mkdir output - xcopy .\sftpgo.exe .\output - xcopy .\sftpgo.json .\output + copy .\sftpgo.exe .\output + copy .\sftpgo.json .\output mkdir output\templates xcopy .\templates .\output\templates\ /E mkdir output\static xcopy .\static .\output\static\ /E - - name: Upload artifacts + - name: Upload build artifact uses: actions/upload-artifact@v2 with: name: sftpgo-${{ matrix.os }}-go${{ matrix.go }} path: output - tests-postgresql-mysql: - name: Run test cases using PostgreSQL/MySQL data providers + test-postgresql-mysql: + name: Test with PostgreSQL/MySQL runs-on: ubuntu-latest services: @@ -132,7 +130,7 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Install Go + - name: Set up Go uses: actions/setup-go@v2 with: go-version: 1.14 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e561d35c..c6ba6373 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,15 +1,15 @@ -name: Release a tag +name: Release on: push: tags: 'v*' env: - GOVERSION: 1.14 + GO_VERSION: 1.14 jobs: create-release: - name: Create Release + name: Create runs-on: ubuntu-latest steps: - name: Create Release @@ -27,24 +27,24 @@ jobs: run: echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url.txt shell: bash - - name: 'Store release upload URL' + - name: Store release upload URL uses: actions/upload-artifact@v2 with: name: upload_url path: ./upload_url.txt - upload-src-with-deps: - name: Upload sources with dependencies + release-sources-with-deps: + name: Publish sources needs: create-release runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Install Go + - name: Set up Go uses: actions/setup-go@v2 with: - go-version: ${{ env.GOVERSION }} + go-version: ${{ env.GO_VERSION }} - - name: Get version + - name: Get SFTPGo version id: get_version run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} @@ -56,11 +56,12 @@ jobs: env: SFTPGO_VERSION: ${{ steps.get_version.outputs.VERSION }} - - uses: actions/download-artifact@v2 + - name: Download release upload URL + uses: actions/download-artifact@v2 with: name: upload_url - - name: Get upload URL + - name: Get release upload URL id: upload_url run: | URL=$(cat upload_url.txt) @@ -78,8 +79,8 @@ jobs: asset_name: sftpgo_${{ steps.get_version.outputs.VERSION }}_src_with_deps.tar.xz asset_content_type: application/x-xz - build: - name: Build Release + publish: + name: Publish binary needs: create-release runs-on: ${{ matrix.os }} strategy: @@ -88,10 +89,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Install Go + - name: Set up Go uses: actions/setup-go@v2 with: - go-version: ${{ env.GOVERSION }} + go-version: ${{ env.GO_VERSION }} - name: Set up Python if: startsWith(matrix.os, 'windows-') @@ -99,11 +100,11 @@ jobs: with: python-version: 3.x - - name: Build Linux/macOS + - name: Build for Linux/macOS if: startsWith(matrix.os, 'windows-') != true run: go build -i -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/version.date=`date -u +%FT%TZ`" -o sftpgo - - name: Build Windows + - name: Build for Windows if: startsWith(matrix.os, 'windows-') run: | $GIT_COMMIT = (git describe --always --dirty) | Out-String @@ -114,7 +115,7 @@ jobs: run: ./sftpgo initprovider shell: bash - - name: Get version + - name: Get SFTPGo version id: get_version run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} shell: bash @@ -135,7 +136,7 @@ jobs: env: MATRIX_OS: ${{ matrix.os }} - - name: Build REST API CLI + - name: Build REST API CLI for Windows if: startsWith(matrix.os, 'windows-') run: | python -m pip install --upgrade pip setuptools wheel @@ -144,7 +145,7 @@ jobs: pip install pyinstaller pyinstaller --hidden-import="pkg_resources.py2_warn" --noupx --onefile examples\rest-api-cli\sftpgo_api_cli.py - - name: Prepare release Linux/macOS + - name: Prepare Release for Linux/macOS if: startsWith(matrix.os, 'windows-') != true run: | mkdir -p output/{init,examples/rest-api-cli,sqlite} @@ -171,7 +172,7 @@ jobs: SFTPGO_VERSION: ${{ steps.get_version.outputs.VERSION }} OS: ${{ steps.get_os_name.outputs.OS }} - - name: Prepare release Windows + - name: Prepare Release for Windows if: startsWith(matrix.os, 'windows-') run: | mkdir output @@ -189,18 +190,19 @@ jobs: SFTPGO_ISS_VERSION: ${{ steps.get_version.outputs.VERSION }} SFTPGO_ISS_DOC_URL: https://github.com/drakkan/sftpgo/blob/${{ steps.get_version.outputs.VERSION }}/README.md - - uses: actions/download-artifact@v2 + - name: Download release upload URL + uses: actions/download-artifact@v2 with: name: upload_url - - name: Get upload URL + - name: Get release upload URL id: upload_url run: | URL=$(cat upload_url.txt) echo "::set-output name=url::${URL}" shell: bash - - name: Upload Release Linux/macOS + - name: Upload Linux/macOS Release if: startsWith(matrix.os, 'windows-') != true uses: actions/upload-release-asset@v1 env: @@ -211,7 +213,7 @@ jobs: asset_name: sftpgo_${{ steps.get_version.outputs.VERSION }}_${{ steps.get_os_name.outputs.OS }}_x86_64.tar.xz asset_content_type: application/x-xz - - name: Upload Release Windows + - name: Upload Windows Release if: startsWith(matrix.os, 'windows-') uses: actions/upload-release-asset@v1 env: diff --git a/windows-installer/sftpgo.iss b/windows-installer/sftpgo.iss index c007b77c..63612833 100644 --- a/windows-installer/sftpgo.iss +++ b/windows-installer/sftpgo.iss @@ -28,13 +28,12 @@ DefaultGroupName={#MyAppName} LicenseFile={#MyAppDir}\LICENSE.txt OutputDir={#MyOutputDir} OutputBaseFilename=sftpgo_windows_x86_64 -Compression=lzma SolidCompression=yes WizardStyle=modern ArchitecturesInstallIn64BitMode=x64 PrivilegesRequired=admin ArchitecturesAllowed=x64 -MinVersion=6.1 +MinVersion=10 VersionInfoVersion={#MyVersionInfo} [Languages]