Skip to content

Port CI to GitHub Actions #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
  • Loading branch information
per1234 committed Jul 31, 2020
commit 3b99c8bae93b89b358ccaae8a339345a3f337540
66 changes: 66 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe It's time to check if the guy merged the fix proposed by Akos in the upstream repo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still open: shallwefootball/upload-s3-action#10
It looks like the PR has some requested changes.

I see there has been a release in the upstream repo since the point we're using in the fork. If I understand correctly, the benefit of using the kittaakos/upload-s3-action action instead of upstream is correct error handling, so, if everything is working correctly, it should be possible to use the upstream instead if you prefer. On the other hand, we won't know whether it's working correctly until after this PR is merged, since this publish step is the only part I didn't test.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still open: shallwefootball/upload-s3-action#10
It looks like the PR has some requested changes.

I will do an update.

On the other hand, we won't know whether it's working correctly until after this PR is merged, since this publish step is the only part I didn't test.

+1 for sticking to the forked action in the PR.

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/
61 changes: 0 additions & 61 deletions azure-pipelines.yml

This file was deleted.