-
Notifications
You must be signed in to change notification settings - Fork 14
60 lines (51 loc) · 2.1 KB
/
go.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Test
on:
push:
branches:
- master
pull_request:
env:
GOPROXY: ${{ vars.GOPROXY }}
DOCKER_BUILD_ARGS: "${{ vars.DOCKER_BUILD_ARGS }}"
jobs:
test:
name: Test
runs-on: ${{ vars.RUNNER_UBUNTU && fromJSON(vars.RUNNER_UBUNTU) || 'ubuntu-latest' }}
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build docker container image
uses: docker/build-push-action@v3
with:
context: .
file: builder.Dockerfile
pull: true
load: true
push: false
tags: ci-builder
build-args: |
${{ env.DOCKER_BUILD_ARGS }}
- name: "go work"
run: docker run --rm -v $(pwd):/work -w /work --entrypoint "/usr/bin/make" ci-builder go-work
- name: "make all"
run: docker run --rm -v $(pwd):/work -w /work --entrypoint "/usr/bin/make" ci-builder all
- name: "hack - workaround github actions runner filesystem permission issue"
# This hack should not be necessary, but if we don't do it, the
# next step fails during docker build as docker does not have
# permission to read files included in the github workspace that
# were written by the previous step. This is pretty daft as we
# don't even want or need docker to attempt to read these files
# during the image build. Github actions appears to give us no way
# to customise the build context to exclude it trying to read these
# files.
#
# Refs:
# https://docs.github.com/en/actions/creating-actions/dockerfile-support-for-github-actions#user
# https://docs.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners#filesystems-on-github-hosted-runners
# https://github.com/actions/checkout/issues/211
run: |
sudo chown -R $USER:$USER $GITHUB_WORKSPACE
- name: "make check-tidy"
run: docker run --rm -v $(pwd):/work -w /work --entrypoint "/usr/bin/make" ci-builder check-tidy