diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4b1f503 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,66 @@ +name: build + +on: + push: + branches: + - master + schedule: + - cron: '0 4 * * MON-FRI' # run every weekday at 4AM (https://docs.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule) + workflow_dispatch: + pull_request: + branches: + - master + +jobs: + + build: + env: + BUILD_OUTPUT_DIRECTORY: dist + EXECUTABLE_NAME: arduino-language-server + strategy: + matrix: + config: + - os: ubuntu-16.04 + ExecutableSuffix: '' + Exports: '' + - os: macos-latest + ExecutableSuffix: '' + Exports: 'CGO_ENABLED=1 MACOSX_DEPLOYMENT_TARGET=10.14 ' + - os: windows-2016 + ExecutableSuffix: '.exe' + Exports: '' + runs-on: ${{ matrix.config.os }} + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: '1.13' + + - name: Build and Test + run: | + ${{ matrix.config.Exports }}go build -o "${{ github.workspace }}/${{ env.BUILD_OUTPUT_DIRECTORY }}/${{ runner.OS }}_amd64/${{ env.EXECUTABLE_NAME }}${{ matrix.config.ExecutableSuffix }}" + go test ./... + + - name: Create archive + run: 7z a "${{ github.workspace }}/${{ env.BUILD_OUTPUT_DIRECTORY }}/archive/${{ env.EXECUTABLE_NAME }}_${{ runner.OS }}_amd64.zip" "${{ github.workspace }}/${{ env.BUILD_OUTPUT_DIRECTORY }}/${{ runner.OS }}_amd64/*" + + - name: Upload Workflow Artifact [GitHub Actions] + uses: actions/upload-artifact@v2 + with: + name: binary_${{ runner.OS }} + # this makes the artifact a .zip of the .zip archive, which is currently necessary to preserve the executable file permissions + # see: https://github.com/actions/upload-artifact/issues/38 + path: ${{ env.BUILD_OUTPUT_DIRECTORY }}/archive/${{ env.EXECUTABLE_NAME }}_${{ runner.OS }}_amd64.zip + + - name: Publish Nightly [S3] + if: github.event_name == 'schedule` || github.event_name == 'workflow_dispatch' + uses: kittaakos/upload-s3-action@v0.0.1 + with: + aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws_bucket: arduino-downloads-prod-beagle + source_dir: ${{ env.BUILD_OUTPUT_DIRECTORY }}/archive/${{ env.EXECUTABLE_NAME }}_${{ runner.OS }}_amd64.zip + destination_dir: arduino-language-server/nightly/ diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 5d8d25b..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,61 +0,0 @@ -trigger: - batch: true - branches: - include: - - master - -schedules: -- cron: "0 4 * * Mon-Fri" - displayName: Nightly Build - branches: - include: - - master - -pr: - - master - -variables: - ExecutableName: 'arduino-language-server' - -jobs: -- job: Build - strategy: - matrix: - linux: - imageName: 'ubuntu-16.04' - ExecutableSuffix: '' - Exports: '' - mac: - imageName: 'macOS-latest' - ExecutableSuffix: '' - Exports: 'CGO_ENABLED=1 MACOSX_DEPLOYMENT_TARGET=10.14 ' - windows: - imageName: 'vs2017-win2016' - ExecutableSuffix: '.exe' - Exports: '' - pool: - vmImage: $(imageName) - steps: - - task: GoTool@0 - inputs: - version: '1.13' - - script: | - $(Exports)go build -o "$(Build.BinariesDirectory)/$(Agent.OS)_amd64/$(ExecutableName)$(ExecutableSuffix)" - go test ./... - displayName: 'Build and Test' - - task: ArchiveFiles@2 - inputs: - rootFolderOrFile: '$(Build.BinariesDirectory)/$(Agent.OS)_amd64' - includeRootFolder: false - archiveFile: '$(Build.BinariesDirectory)/archive/$(ExecutableName)_$(Agent.OS)_amd64.zip' - archiveType: 'zip' - - publish: '$(Build.BinariesDirectory)/archive' - artifact: 'binary_$(Agent.OS)' - - task: S3Upload@1 - condition: in(variables['Build.Reason'], 'Manual', 'Schedule') - inputs: - awsCredentials: 'language-server-s3-upload' - bucketName: 'arduino-downloads-prod-beagle' - sourceFolder: '$(Build.BinariesDirectory)/archive' - globExpressions: '*.zip' - targetFolder: 'arduino-language-server/nightly'