Files
gotenberg/.github/workflows/continuous-integration.yml

191 lines
5.0 KiB
YAML

name: Continuous Integration
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ (github.event_name == 'pull_request' && github.event.pull_request.number) || 'main' }}
cancel-in-progress: true
permissions:
contents: write
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
cache: false
- name: Checkout source code
uses: actions/checkout@v4
- name: Run linters
uses: golangci/golangci-lint-action@v6
with:
version: v1.63.4
tests:
needs:
- lint
name: Tests
# TODO: once arm64 actions are available, also run the tests on this architecture.
# See: https://github.com/actions/virtual-environments/issues/2552#issuecomment-771478000.
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Checkout source code
uses: actions/checkout@v4
- name: Build testing environment
run: make build build-tests
- name: Run tests
run: make tests-once
- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
snapshot_amd64:
if: github.event_name == 'pull_request'
needs:
- tests
name: Snapshot linux/amd64
uses: ./.github/workflows/gotenberg-build-push.yml
secrets: inherit
with:
runs_on: 'ubuntu-latest'
platform: 'linux/amd64'
gotenberg_version: pr-${{ github.event.pull_request.number }}
alternate_repository: 'snapshot'
snapshot_386:
if: github.event_name == 'pull_request'
needs:
- tests
name: Snapshot linux/386
uses: ./.github/workflows/gotenberg-build-push.yml
secrets: inherit
with:
runs_on: 'ubuntu-latest'
platform: 'linux/386'
gotenberg_version: pr-${{ github.event.pull_request.number }}
alternate_repository: 'snapshot'
snapshot_arm64:
if: github.event_name == 'pull_request'
needs:
- tests
name: Snapshot linux/arm64
uses: ./.github/workflows/gotenberg-build-push.yml
secrets: inherit
with:
runs_on: 'ubuntu-24.04-arm'
platform: 'linux/arm64'
gotenberg_version: pr-${{ github.event.pull_request.number }}
alternate_repository: 'snapshot'
snapshot_arm_v7:
if: github.event_name == 'pull_request'
needs:
- tests
name: Snapshot linux/arm/v7
uses: ./.github/workflows/gotenberg-build-push.yml
secrets: inherit
with:
runs_on: 'ubuntu-24.04-arm'
platform: 'linux/arm/v7'
gotenberg_version: pr-${{ github.event.pull_request.number }}
alternate_repository: 'snapshot'
merge_clean_snapshot_tags:
needs:
- snapshot_amd64
- snapshot_386
- snapshot_arm64
- snapshot_arm_v7
name: Merge and clean snapshot tags
uses: ./.github/workflows/gotenberg-merge-clean.yml
secrets: inherit
with:
tags: "${{ needs.snapshot_amd64.outputs.tags }},${{ needs.snapshot_386.outputs.tags }},${{ needs.snapshot_arm64.outputs.tags }},${{ needs.snapshot_arm_v7.outputs.tags }}"
edge_amd64:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs:
- tests
name: Edge linux/amd64
uses: ./.github/workflows/gotenberg-build-push.yml
secrets: inherit
with:
runs_on: 'ubuntu-latest'
platform: 'linux/amd64'
gotenberg_version: 'edge'
edge_386:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs:
- tests
name: Edge linux/386
uses: ./.github/workflows/gotenberg-build-push.yml
secrets: inherit
with:
runs_on: 'ubuntu-latest'
platform: 'linux/386'
gotenberg_version: 'edge'
edge_arm64:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs:
- tests
name: Edge linux/arm64
uses: ./.github/workflows/gotenberg-build-push.yml
secrets: inherit
with:
runs_on: 'ubuntu-24.04-arm'
platform: 'linux/arm64'
gotenberg_version: 'edge'
edge_arm_v7:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs:
- tests
name: Edge linux/arm/v7
uses: ./.github/workflows/gotenberg-build-push.yml
secrets: inherit
with:
runs_on: 'ubuntu-24.04-arm'
platform: 'linux/arm/v7'
gotenberg_version: 'edge'
merge_clean_edge_tags:
needs:
- edge_amd64
- edge_386
- edge_arm64
- edge_arm_v7
name: Merge and clean edge tags
uses: ./.github/workflows/gotenberg-merge-clean.yml
secrets: inherit
with:
tags: "${{ needs.edge_amd64.outputs.tags }},${{ needs.edge_386.outputs.tags }},${{ needs.edge_arm64.outputs.tags }},${{ needs.edge_arm_v7.outputs.tags }}"
alternate_registry: 'thecodingmachine'