Skip to content

Merge pull request #228 from estesp/update-deps #251

Merge pull request #228 from estesp/update-deps

Merge pull request #228 from estesp/update-deps #251

Workflow file for this run

name: CI
on:
push:
branches:
- main
- 'release/**'
pull_request:
branches:
- main
- 'release/**'
jobs:
#
# golangci-lint
#
linters:
name: Linters
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
matrix:
go-version: [1.20.6]
os: [ubuntu-20.04, macos-12, windows-2019]
steps:
- uses: actions/checkout@v3
with:
path: src/github.com/estesp/manifest-tool
- name: Set env
shell: bash
run: |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- uses: golangci/golangci-lint-action@v3
with:
version: v1.51.1
skip-cache: true
working-directory: src/github.com/estesp/manifest-tool/v2
args: --timeout=5m
#
# Project checks
#
project:
name: DCO/Vendor Checks
runs-on: ubuntu-20.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
with:
path: src/github.com/estesp/manifest-tool
fetch-depth: 100
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.6
- name: Set env
shell: bash
run: |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- name: Install dependencies
env:
GO111MODULE: off
run: go get -u github.com/vbatts/git-validation
- name: DCO
env:
GITHUB_COMMIT_URL: ${{ github.event.pull_request.commits_url }}
DCO_VERBOSITY: "-q"
DCO_RANGE: ""
working-directory: src/github.com/estesp/manifest-tool
run: |
if [ -z "${GITHUB_COMMIT_URL}" ]; then
DCO_RANGE=$(jq -r '.before +".."+ .after' ${GITHUB_EVENT_PATH})
else
DCO_RANGE=$(curl ${GITHUB_COMMIT_URL} | jq -r '.[0].parents[0].sha +".."+ .[-1].sha')
fi
GIT_CHECK_EXCLUDE="./v2/vendor" git-validation -range "${DCO_RANGE}" -run DCO,short-subject,dangling-whitespace
- name: Vendor
working-directory: src/github.com/estesp/manifest-tool
run: ./hack/vendor.sh
#
# Build binaries
#
binaries:
name: Build
runs-on: ${{ matrix.os }}
timeout-minutes: 10
needs: [project, linters]
strategy:
matrix:
os: [ubuntu-20.04, macos-12, windows-2019]
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.20.6'
- name: Set env
shell: bash
run: |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- uses: actions/checkout@v3
with:
path: src/github.com/estesp/manifest-tool
- name: Make
run: |
make clean
make binary
working-directory: src/github.com/estesp/manifest-tool
#
# Integration testing
#
tests:
name: Integration tests
runs-on: ubuntu-20.04
timeout-minutes: 10
needs: [project, linters]
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.20.6'
- name: Set env
shell: bash
run: |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- uses: actions/checkout@v3
with:
path: src/github.com/estesp/manifest-tool
- name: Make binary
run: make binary
working-directory: src/github.com/estesp/manifest-tool
- name: Set up bats
run: |
git clone https://github.com/bats-core/bats-core.git
cd bats-core
sudo ./install.sh /usr/local
# we need to have a known name (that isn't localhost) for local registry TLS
sudo echo "127.0.0.1 myregistry.local" | sudo tee -a /etc/hosts
- name: Run tests
env:
RUNTIME_TOOL: docker
run: |
bats integration/public-registry-tests.bats
bats integration/local-registry-tests.bats
bats integration/local-registry-tests-tls.bats
working-directory: src/github.com/estesp/manifest-tool
#
# Cross-built architectures
#
cross:
name: Cross-builds
runs-on: ubuntu-20.04
timeout-minutes: 10
needs: [project, linters]
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.20.6'
- name: Set env
shell: bash
run: |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- uses: actions/checkout@v3
with:
path: src/github.com/estesp/manifest-tool
- name: Make cross-built binaries
run: make cross
working-directory: src/github.com/estesp/manifest-tool