2021-05-04 16:57:33 -05:00
|
|
|
name: checks
|
|
|
|
on: [pull_request, workflow_dispatch]
|
2020-02-10 17:27:05 -06:00
|
|
|
|
2021-08-30 13:06:20 -05:00
|
|
|
env:
|
2021-08-30 19:01:30 -05:00
|
|
|
ACT_OWNER: ${{ github.repository_owner }}
|
|
|
|
ACT_REPOSITORY: ${{ github.repository }}
|
|
|
|
CACHED_DOCKER_IMAGES: '"node:12-buster" "node:12-buster-slim" "ubuntu:18.04" "ubuntu:latest" "alpine:3.10" "tonistiigi/binfmt:latest"'
|
|
|
|
CACHED_DOCKER_IMAGES_KEY: docker-images-0
|
2021-08-30 13:06:20 -05:00
|
|
|
GO_VERSION: 1.17
|
|
|
|
|
2020-02-10 17:27:05 -06:00
|
|
|
jobs:
|
2020-02-24 16:43:03 -06:00
|
|
|
lint:
|
2021-05-04 16:57:33 -05:00
|
|
|
name: lint
|
2020-02-24 16:43:03 -06:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-03-29 09:55:51 -05:00
|
|
|
- uses: actions/checkout@v2
|
2021-05-03 11:52:03 -05:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2021-03-30 14:26:25 -05:00
|
|
|
- uses: actions/setup-go@v1
|
|
|
|
with:
|
2021-08-30 13:06:20 -05:00
|
|
|
go-version: ${{ env.GO_VERSION }}
|
2021-03-29 09:55:51 -05:00
|
|
|
- uses: golangci/golangci-lint-action@v2
|
|
|
|
env:
|
|
|
|
CGO_ENABLED: 0
|
|
|
|
with:
|
2021-05-18 01:14:49 -05:00
|
|
|
version: v1.40.0
|
2021-05-03 11:52:03 -05:00
|
|
|
- uses: github/super-linter@v3
|
|
|
|
env:
|
|
|
|
DEFAULT_BRANCH: master
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
FILTER_REGEX_EXCLUDE: .*testdata/*
|
2021-05-04 16:57:33 -05:00
|
|
|
VALIDATE_ALL_CODEBASE: false
|
2021-05-03 11:52:03 -05:00
|
|
|
VALIDATE_BASH: false
|
|
|
|
VALIDATE_DOCKERFILE: false
|
|
|
|
VALIDATE_DOCKERFILE_HADOLINT: false
|
|
|
|
VALIDATE_GO: false # it's broken, see commit message
|
|
|
|
VALIDATE_JSCPD: false
|
|
|
|
VALIDATE_SHELL_SHFMT: false
|
2020-02-24 16:43:03 -06:00
|
|
|
|
2021-05-04 16:57:33 -05:00
|
|
|
test-linux:
|
|
|
|
name: test-linux
|
2020-02-10 17:27:05 -06:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-03-29 09:55:51 -05:00
|
|
|
- uses: actions/checkout@v2
|
2021-03-29 11:07:13 -05:00
|
|
|
with:
|
|
|
|
fetch-depth: 2
|
2021-03-29 09:55:51 -05:00
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
- uses: actions/setup-go@v1
|
|
|
|
with:
|
2021-08-30 13:06:20 -05:00
|
|
|
go-version: ${{ env.GO_VERSION }}
|
2021-05-02 10:13:30 -05:00
|
|
|
- uses: actions/cache@v2
|
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
|
|
|
- run: go test -v -cover -coverprofile=coverage.txt -covermode=atomic ./...
|
2021-03-29 09:55:51 -05:00
|
|
|
env:
|
|
|
|
CGO_ENABLED: 0
|
2021-03-29 11:07:13 -05:00
|
|
|
- name: Upload Codecov report
|
2021-06-09 12:30:16 -05:00
|
|
|
uses: codecov/codecov-action@v1.5.2
|
2021-03-29 09:55:51 -05:00
|
|
|
with:
|
|
|
|
files: coverage.txt
|
|
|
|
fail_ci_if_error: true # optional (default = false)
|
|
|
|
|
2021-08-30 19:01:30 -05:00
|
|
|
dump_images:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
continue-on-error: true
|
|
|
|
steps:
|
|
|
|
- uses: actions/cache@v2
|
|
|
|
id: image_cache
|
|
|
|
with:
|
|
|
|
key: ${{ env.CACHED_DOCKER_IMAGES_KEY }}
|
|
|
|
path: |
|
|
|
|
registry
|
|
|
|
docker-registry
|
|
|
|
- name: Pull and export images
|
|
|
|
if: steps.image_cache.outputs.cache-hit != 'true'
|
|
|
|
run: |
|
|
|
|
docker pull registry:2
|
|
|
|
docker image save -o registry registry:2
|
|
|
|
mkdir -p docker-registry
|
|
|
|
docker run -d -p 5000:5000 --name registry -v $PWD/docker-registry:/var/lib/registry registry:2
|
|
|
|
npx wait-on tcp:5000
|
|
|
|
for image in ${{ env.CACHED_DOCKER_IMAGES }}
|
|
|
|
do
|
|
|
|
bash -c 'docker pull "'"$image"'" && docker tag "'"$image"'" "localhost:5000/'"$image"'" && docker push "localhost:5000/'"$image"'"'&
|
|
|
|
done
|
|
|
|
wait
|
|
|
|
|
2021-03-29 09:55:51 -05:00
|
|
|
test-macos:
|
2021-08-30 19:01:30 -05:00
|
|
|
needs: dump_images
|
2021-05-04 16:57:33 -05:00
|
|
|
name: test-macos
|
2021-03-29 09:55:51 -05:00
|
|
|
runs-on: macos-latest
|
|
|
|
continue-on-error: true # Don't let macos test fail whole workflow
|
2021-05-02 10:13:30 -05:00
|
|
|
env:
|
|
|
|
ISO_PATH: ~/.docker/machine/cache/boot2docker.iso
|
2021-03-29 09:55:51 -05:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-08-30 19:01:30 -05:00
|
|
|
- name: Restore Docker Image Cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
id: image_cache
|
|
|
|
continue-on-error: true
|
|
|
|
with:
|
|
|
|
key: ${{ env.CACHED_DOCKER_IMAGES_KEY }}
|
|
|
|
path: |
|
|
|
|
registry
|
|
|
|
docker-registry
|
2021-03-29 09:55:51 -05:00
|
|
|
- uses: actions/setup-go@v1
|
|
|
|
with:
|
2021-08-30 13:06:20 -05:00
|
|
|
go-version: ${{ env.GO_VERSION }}
|
2021-05-02 10:13:30 -05:00
|
|
|
- uses: actions/cache@v2
|
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
|
|
|
- uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
key: boot2docker
|
|
|
|
path: ${{ env.ISO_PATH }}
|
|
|
|
restore-keys: boot2docker
|
|
|
|
- name: Install Docker on macOS
|
|
|
|
run: |
|
|
|
|
printf " 🛠️ Downloading boot2docker.iso 🛠️ \n\n"
|
|
|
|
mkdir -p ~/.docker/machine/cache/
|
|
|
|
test -f ${{ env.ISO_PATH }} && printf " 🛠️ ${{ env.ISO_PATH }} successfully restored 🛠️ \n\n" || wget "https://github.com/boot2docker/boot2docker/releases/download/v19.03.12/boot2docker.iso" -O ${{ env.ISO_PATH }}
|
|
|
|
printf " 🛠️ Installing Docker from Homebrew 🛠️ \n\n"
|
|
|
|
brew install docker docker-machine
|
|
|
|
printf " 🛠️ Creating Docker VM 🛠️ \n\n"
|
|
|
|
docker-machine create --driver virtualbox --virtualbox-boot2docker-url ${{ env.ISO_PATH }} default
|
|
|
|
docker-machine env default
|
|
|
|
printf " 🛠️ Adding Docker VM info to environment 🛠️ \n\n"
|
|
|
|
eval "$(docker-machine env default)"
|
|
|
|
echo "DOCKER_TLS_VERIFY=$DOCKER_TLS_VERIFY" | tee -a $GITHUB_ENV
|
|
|
|
echo "DOCKER_HOST=$DOCKER_HOST" | tee -a $GITHUB_ENV
|
|
|
|
echo "DOCKER_CERT_PATH=$DOCKER_CERT_PATH" | tee -a $GITHUB_ENV
|
|
|
|
echo "DOCKER_MACHINE_NAME=$DOCKER_MACHINE_NAME" | tee -a $GITHUB_ENV
|
|
|
|
printf " 🛠️ Finished installing Docker 🛠️ \n\n"
|
2021-08-30 19:01:30 -05:00
|
|
|
- name: Import images
|
|
|
|
if: steps.image_cache.outputs.cache-hit == 'true'
|
|
|
|
continue-on-error: true
|
|
|
|
run: |
|
|
|
|
echo load registry
|
|
|
|
docker image load -i registry
|
|
|
|
echo Setup local registry
|
|
|
|
docker run -d -p 5000:5000 --name registry -v $PWD/docker-registry:/var/lib/registry registry:2
|
|
|
|
echo pulling images from cache
|
|
|
|
for image in ${{ env.CACHED_DOCKER_IMAGES }}
|
|
|
|
do
|
|
|
|
bash -c '(sleep 1 && docker pull "localhost:5000/'"$image"'" || sleep 2 && docker pull "localhost:5000/'"$image"'" || sleep 10 && docker pull "localhost:5000/'"$image"'") && docker tag "localhost:5000/'"$image"'" "'"$image"'"'&
|
|
|
|
done
|
|
|
|
wait
|
|
|
|
- name: 🛠️ Install Qemu for running containers with different architecture 🛠️
|
|
|
|
run: docker run --rm --privileged tonistiigi/binfmt:latest --install all
|
2021-05-02 10:13:30 -05:00
|
|
|
- run: go test -v -timeout 30m -cover ./...
|
2021-03-29 09:55:51 -05:00
|
|
|
env:
|
2021-03-29 00:02:11 -05:00
|
|
|
CGO_ENABLED: 0
|
2020-02-24 17:04:33 -06:00
|
|
|
|
2020-08-30 00:55:22 -05:00
|
|
|
snapshot:
|
2021-05-04 16:57:33 -05:00
|
|
|
name: snapshot
|
2020-08-30 00:55:22 -05:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-03-29 09:55:51 -05:00
|
|
|
- uses: actions/checkout@v2
|
2021-03-30 14:26:25 -05:00
|
|
|
- uses: actions/setup-go@v1
|
|
|
|
with:
|
2021-08-30 13:06:20 -05:00
|
|
|
go-version: ${{ env.GO_VERSION }}
|
2021-05-02 10:13:30 -05:00
|
|
|
- uses: actions/cache@v2
|
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
2021-03-29 09:55:51 -05:00
|
|
|
- name: GoReleaser
|
|
|
|
uses: goreleaser/goreleaser-action@v2
|
|
|
|
with:
|
|
|
|
version: latest
|
|
|
|
args: release --snapshot --rm-dist
|
2021-05-23 10:32:55 -05:00
|
|
|
- name: Capture x86_64 (64-bit) Linux binary
|
|
|
|
if: ${{ !env.ACT }}
|
2021-03-29 09:55:51 -05:00
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2021-05-23 10:32:55 -05:00
|
|
|
name: act-linux-amd64
|
2021-03-29 09:55:51 -05:00
|
|
|
path: dist/act_linux_amd64/act
|
2021-05-23 10:32:55 -05:00
|
|
|
- name: Capture i386 (32-bit) Linux binary
|
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: act-linux-i386
|
|
|
|
path: dist/act_linux_386/act
|
|
|
|
- name: Capture arm64 (64-bit) Linux binary
|
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: act-linux-arm64
|
|
|
|
path: dist/act_linux_arm64/act
|
|
|
|
- name: Capture armv6 (32-bit) Linux binary
|
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: act-linux-armv6
|
|
|
|
path: dist/act_linux_arm_6/act
|
|
|
|
- name: Capture armv7 (32-bit) Linux binary
|
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: act-linux-armv7
|
|
|
|
path: dist/act_linux_arm_7/act
|
|
|
|
- name: Capture x86_64 (64-bit) Windows binary
|
|
|
|
if: ${{ !env.ACT }}
|
2021-03-29 09:55:51 -05:00
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2021-05-23 10:32:55 -05:00
|
|
|
name: act-windows-amd64
|
2021-03-29 09:55:51 -05:00
|
|
|
path: dist/act_windows_amd64/act.exe
|
2021-05-23 10:32:55 -05:00
|
|
|
- name: Capture i386 (32-bit) Windows binary
|
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: act-windows-i386
|
|
|
|
path: dist/act_windows_386/act.exe
|
2021-08-30 13:06:20 -05:00
|
|
|
- name: Capture arm64 (64-bit) Windows binary
|
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: act-windows-arm64
|
|
|
|
path: dist/act_windows_arm64/act.exe
|
2021-05-23 10:32:55 -05:00
|
|
|
- name: Capture armv7 (32-bit) Windows binary
|
|
|
|
if: ${{ !env.ACT }}
|
2021-03-29 09:55:51 -05:00
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2021-05-23 10:32:55 -05:00
|
|
|
name: act-windows-armv7
|
|
|
|
path: dist/act_windows_arm_7/act.exe
|
|
|
|
- name: Capture x86_64 (64-bit) MacOS binary
|
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: act-macos-amd64
|
2021-03-29 09:55:51 -05:00
|
|
|
path: dist/act_darwin_amd64/act
|
2021-05-23 10:32:55 -05:00
|
|
|
- name: Capture arm64 (64-bit) MacOS binary
|
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: act-macos-arm64
|
|
|
|
path: dist/act_darwin_arm64/act
|