Merge pull request #105 from JenswBE/clarify-docs #337
Workflow file for this run
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: Test, build and publish | |
on: | |
push: | |
branches: [main] | |
tags: ["*"] | |
pull_request: | |
env: | |
GO_VERSION: "1.22" # Also update Dockerfile when bumping | |
DOCKER_HUB_USER: jenswbebot | |
DOCKER_HUB_REPO: jenswbe/dead-link-checker | |
PLATFORMS: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Derive docker_tag | |
id: vars | |
shell: python | |
run: | | |
import os | |
tag = os.environ['GITHUB_REF'].split('/').pop() | |
if tag == 'main': | |
tag = 'latest' | |
with open(os.environ['GITHUB_OUTPUT'], 'a') as output: | |
output.write(f"docker_tag={tag}{os.linesep}") | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
check-latest: true | |
go-version: ${{ env.GO_VERSION }} | |
- name: Pull common linter configs | |
run: wget -O .golangci.yml https://raw.githubusercontent.com/JenswBE/setup/main/programming_configs/golang/.golangci.yml | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: latest | |
args: --timeout=5m | |
- name: Start E2E services | |
working-directory: e2e | |
run: | | |
docker compose up -d | |
sleep 5s | |
- name: Run E2E tests | |
working-directory: e2e | |
run: go test --tags e2e ./... | |
- name: Set up QEMU | |
if: github.event_name == 'push' | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
if: github.event_name == 'push' | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
if: github.event_name == 'push' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ env.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- name: Build and push | |
if: github.event_name == 'push' | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: ${{ env.PLATFORMS }} | |
push: true | |
tags: ${{ env.DOCKER_HUB_REPO }}:${{ steps.vars.outputs.docker_tag }} | |
- name: Update repo description | |
if: github.event_name == 'push' | |
uses: peter-evans/dockerhub-description@v4 | |
with: | |
username: ${{ env.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
repository: ${{ env.DOCKER_HUB_REPO }} |