Merge pull request #276 from estesp/update-go #346
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.23.3] | |
os: [ubuntu-22.04, macos-14, windows-2019] | |
steps: | |
- uses: actions/checkout@v4 | |
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@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- uses: golangci/golangci-lint-action@v6 | |
with: | |
version: v1.60.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@v4 | |
with: | |
path: src/github.com/estesp/manifest-tool | |
fetch-depth: 100 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23.3' | |
- name: Set env | |
shell: bash | |
run: | | |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV | |
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH | |
- name: Install dependencies | |
run: go install -v github.com/vbatts/git-validation@latest | |
- 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-22.04, macos-14, windows-2019] | |
steps: | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23.3' | |
- name: Set env | |
shell: bash | |
run: | | |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV | |
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH | |
- uses: actions/checkout@v4 | |
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@v5 | |
with: | |
go-version: '1.23.3' | |
- name: Set env | |
shell: bash | |
run: | | |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV | |
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH | |
- uses: actions/checkout@v4 | |
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@v5 | |
with: | |
go-version: '1.23.3' | |
- name: Set env | |
shell: bash | |
run: | | |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV | |
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH | |
- uses: actions/checkout@v4 | |
with: | |
path: src/github.com/estesp/manifest-tool | |
- name: Make cross-built binaries | |
run: make cross | |
working-directory: src/github.com/estesp/manifest-tool |