mirror of
https://blitiri.com.ar/repos/chasquid
synced 2026-01-08 17:51:57 +00:00
Since we moved the Docker workflows to Github (after v1.10), they have not been running on tags, so there are no tagged docker images for v1.11, v1.12 and v1.13. This is (hopefully) because we're not explicitly asking for the workflow to be run on tag pushes. This patch (hopefully) fixes that by adding an explicit section in the config to make it run on tag pushes. Thanks to Christoph Mewes (xrstf@github) for reporting this in https://github.com/albertito/chasquid/issues/51.
103 lines
3.4 KiB
YAML
103 lines
3.4 KiB
YAML
name: "docker"
|
|
|
|
on:
|
|
push:
|
|
branches: [ "master", "next" ]
|
|
tags: [ "v*", "test-tag-*" ]
|
|
pull_request:
|
|
# The branches below must be a subset of the branches above
|
|
branches: [ "master", "next" ]
|
|
schedule:
|
|
- cron: '29 21 * * 6'
|
|
|
|
env:
|
|
HAS_DOCKER: ${{ secrets.DOCKER_REGISTRY_USER != '' }}
|
|
HAS_GITLAB: ${{ secrets.GITLAB_REGISTRY_USER != '' }}
|
|
|
|
jobs:
|
|
integration:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Docker info (for debugging)
|
|
run: docker info
|
|
- name: Build test image
|
|
run: docker build -t chasquid-test -f test/Dockerfile .
|
|
- name: Run tests
|
|
run: docker run --name test1 chasquid-test make test
|
|
|
|
coverage:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ">=1.20"
|
|
- name: Install goveralls
|
|
run: go install github.com/mattn/goveralls@latest
|
|
- name: Docker info (for debugging)
|
|
run: docker info
|
|
- name: Build test image
|
|
run: docker build -t chasquid-test -f test/Dockerfile .
|
|
- name: Run coverage tests
|
|
run: docker run --name test1 chasquid-test test/cover.sh
|
|
- name: Extract coverage results
|
|
run: >
|
|
docker cp
|
|
test1:/go/src/blitiri.com.ar/go/chasquid/.coverage/final.out
|
|
.
|
|
- name: Upload coverage results
|
|
run: >
|
|
goveralls
|
|
-coverprofile=final.out
|
|
-repotoken=${{ secrets.COVERALLS_TOKEN }}
|
|
|
|
public-image:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
needs: [integration, coverage]
|
|
if: github.event_name == 'push'
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Build
|
|
run: docker build -t chasquid -f docker/Dockerfile .
|
|
|
|
# Push it to Dockerhub.
|
|
- name: Dockerhub login
|
|
if: env.HAS_DOCKER
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKER_REGISTRY_USER }}
|
|
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
|
|
- name: Dockerhub push
|
|
if: env.HAS_DOCKER
|
|
run: |
|
|
docker tag chasquid index.docker.io/${{ secrets.DOCKER_REGISTRY_USER }}/chasquid:$GITHUB_REF_NAME
|
|
docker push index.docker.io/${{ secrets.DOCKER_REGISTRY_USER }}/chasquid:$GITHUB_REF_NAME
|
|
- name: Dockerhub tag latest
|
|
if: env.HAS_DOCKER && env.GITHUB_REF_NAME == 'master'
|
|
run: |
|
|
docker tag chasquid index.docker.io/${{ secrets.DOCKER_REGISTRY_USER }}/chasquid:latest
|
|
docker push index.docker.io/${{ secrets.DOCKER_REGISTRY_USER }}/chasquid:latest
|
|
|
|
# Push it to Gitlab.
|
|
- name: Gitlab login
|
|
if: env.HAS_GITLAB
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: registry.gitlab.com
|
|
username: ${{ secrets.GITLAB_REGISTRY_USER }}
|
|
password: ${{ secrets.GITLAB_REGISTRY_TOKEN }}
|
|
- name: Gitlab push
|
|
if: env.HAS_GITLAB
|
|
run: |
|
|
docker tag chasquid registry.gitlab.com/albertito/chasquid:$GITHUB_REF_NAME
|
|
docker push registry.gitlab.com/albertito/chasquid:$GITHUB_REF_NAME
|
|
- name: Gitlab tag latest
|
|
if: env.HAS_GITLAB && env.GITHUB_REF_NAME == 'master'
|
|
run: |
|
|
docker tag chasquid registry.gitlab.com/albertito/chasquid:latest
|
|
docker push registry.gitlab.com/albertito/chasquid:latest
|