Skip to content

Commit 3b99c8b

Browse files
committed
Port CI to GitHub Actions
This should emulate the behavior of the previous Azure Pipeline CI build. The only exception is the build artifact is now stored as a GitHub Actions workflow artifact rather than on Azure Pipeline. To work around the actions/upload-artifact action's behavior of removing executable file permissions from the workflow artifacts, I uploaded the archive file as the artifact. The downside to this workaround is you get a .zip file inside of a .zip file: binary_Linux.zip |_ arduino-language-server_Linux_amd64.zip |_ arduino-language-server
1 parent 50e988f commit 3b99c8b

File tree

2 files changed

+66
-61
lines changed

2 files changed

+66
-61
lines changed

.github/workflows/build.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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+
uses: kittaakos/[email protected]
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/

azure-pipelines.yml

-61
This file was deleted.

0 commit comments

Comments
 (0)