|
| 1 | +name: build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + schedule: |
| 8 | + - cron: '0 4 * * MON-FRI' # run every weekday at 4AM (https://docs.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule) |
| 9 | + workflow_dispatch: |
| 10 | + pull_request: |
| 11 | + branches: |
| 12 | + - master |
| 13 | + |
| 14 | +jobs: |
| 15 | + |
| 16 | + build: |
| 17 | + env: |
| 18 | + BUILD_OUTPUT_DIRECTORY: dist |
| 19 | + EXECUTABLE_NAME: arduino-language-server |
| 20 | + strategy: |
| 21 | + matrix: |
| 22 | + config: |
| 23 | + - os: ubuntu-16.04 |
| 24 | + ExecutableSuffix: '' |
| 25 | + Exports: '' |
| 26 | + - os: macos-latest |
| 27 | + ExecutableSuffix: '' |
| 28 | + Exports: 'CGO_ENABLED=1 MACOSX_DEPLOYMENT_TARGET=10.14 ' |
| 29 | + - os: windows-2016 |
| 30 | + ExecutableSuffix: '.exe' |
| 31 | + Exports: '' |
| 32 | + runs-on: ${{ matrix.config.os }} |
| 33 | + steps: |
| 34 | + - name: Checkout |
| 35 | + uses: actions/checkout@v2 |
| 36 | + |
| 37 | + - name: Install Go |
| 38 | + uses: actions/setup-go@v2 |
| 39 | + with: |
| 40 | + go-version: '1.13' |
| 41 | + |
| 42 | + - name: Build and Test |
| 43 | + run: | |
| 44 | + ${{ matrix.config.Exports }}go build -o "${{ github.workspace }}/${{ env.BUILD_OUTPUT_DIRECTORY }}/${{ runner.OS }}_amd64/${{ env.EXECUTABLE_NAME }}${{ matrix.config.ExecutableSuffix }}" |
| 45 | + go test ./... |
| 46 | +
|
| 47 | + - name: Create archive |
| 48 | + 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/*" |
| 49 | + |
| 50 | + - name: Upload Workflow Artifact [GitHub Actions] |
| 51 | + uses: actions/upload-artifact@v2 |
| 52 | + with: |
| 53 | + name: binary_${{ runner.OS }} |
| 54 | + # this makes the artifact a .zip of the .zip archive, which is currently necessary to preserve the executable file permissions |
| 55 | + # see: https://github.com/actions/upload-artifact/issues/38 |
| 56 | + path: ${{ env.BUILD_OUTPUT_DIRECTORY }}/archive/${{ env.EXECUTABLE_NAME }}_${{ runner.OS }}_amd64.zip |
| 57 | + |
| 58 | + - name: Publish Nightly [S3] |
| 59 | + if: github.event_name == 'schedule` || github.event_name == 'workflow_dispatch' |
| 60 | + |
| 61 | + with: |
| 62 | + aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 63 | + aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 64 | + aws_bucket: arduino-downloads-prod-beagle |
| 65 | + source_dir: ${{ env.BUILD_OUTPUT_DIRECTORY }}/archive/${{ env.EXECUTABLE_NAME }}_${{ runner.OS }}_amd64.zip |
| 66 | + destination_dir: arduino-language-server/nightly/ |
0 commit comments