Skip to content

Merge pull request #55 from lsst-dm/IT-6370/upload-parts-histogram #662

Merge pull request #55 from lsst-dm/IT-6370/upload-parts-histogram

Merge pull request #55 from lsst-dm/IT-6370/upload-parts-histogram #662

Workflow file for this run

---
name: Build and Publish
"on":
push:
branches:
- "**"
tags:
- "v*.*.*"
pull_request:
branches:
- main
- master
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
GOVERSION: 1.25.0
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOVERSION }}
- name: Build
run: go build -v ./...
- name: Vet
run: go vet -v ./...
- name: Test
run: go test -v ./...
hadolint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: Dockerfile
yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run yamllint
uses: bewuethr/yamllint-action@v1
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
golangci-lint:
permissions:
contents: read
pull-requests: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable
- name: golangci-lint
uses: golangci/golangci-lint-action@v8
with:
version: v2.4.0
oci_image:
name: Build OCI Image
needs: build
if: github.repository == 'lsst-dm/deliverator'
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.pick.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Export first tag for downstream jobs
id: pick
run: |
echo "tag=$(echo '${{ steps.meta.outputs.tags }}' | grep sha- | head -n1)" >>"$GITHUB_OUTPUT"
e2e:
name: e2e accaptence test
if: github.event_name != 'pull_request'
needs: oci_image
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: miniouser
AWS_SECRET_ACCESS_KEY: miniopass
steps:
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: runner.debug
with:
detached: true
- name: start minio
uses: infleet/minio-action@v0.0.1
with:
port: "9000"
version: latest
username: ${{ env.AWS_ACCESS_KEY_ID }}
password: ${{ env.AWS_SECRET_ACCESS_KEY }}
- name: install s5cmd
uses: derekn/s5cmd-action@v2
with:
version: 2.3.0
- name: start s3nd
env:
S3ND_ENDPOINT_URL: http://localhost:9000
AWS_REGION: foo
run: docker run -d --name s3nd --network host -v $(pwd):$(pwd) -e S3ND_ENDPOINT_URL -e AWS_REGION -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY ${{ needs.oci_image.outputs.tag }}
- name: create test1 bucket
run: |
s5cmd --endpoint-url http://localhost:9000 mb s3://test1
- name: send a file
run: |
touch foo1
curl -vvv --fail-with-body -d file=$(pwd)/foo1 -d "uri=s3://test1/foo1" http://localhost:15555/upload
- name: Dump s3nd container log on failure
if: failure()
run: |
echo "Job failed, dumping s3nd container log..."
docker logs s3nd || echo "Failed to get s3nd container log"
gh-release:
name: Create GitHub Release
needs: build
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
go-release:
name: Release Go Binaries
needs: gh-release
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux]
goarch: [amd64, arm64]
steps:
- uses: actions/checkout@v4
- uses: wangyoucao577/go-release-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
build_command: make build
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: ${{ env.GOVERSION }}
asset_name: '${{ github.event.repository.name }}-${{ matrix.goos }}-${{ matrix.goarch }}'