144 lines
3.4 KiB
YAML
144 lines
3.4 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "pics"
|
|
paths-ignore:
|
|
- "docs/**"
|
|
- "VERSION"
|
|
- ".bumpversion.cfg"
|
|
- "**.md"
|
|
- "catalog-info.yaml"
|
|
- "mkdocs.yml"
|
|
- "philips-repo.yaml"
|
|
|
|
pull_request:
|
|
branches: [pics]
|
|
paths-ignore:
|
|
- "docs/**"
|
|
- "VERSION"
|
|
- ".bumpversion.cfg"
|
|
- "**.md"
|
|
- "catalog-info.yaml"
|
|
- "mkdocs.yml"
|
|
- "philips-repo.yaml"
|
|
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
Lint:
|
|
name: Lint - golangci-lint
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v4
|
|
with:
|
|
go-version: "1.21"
|
|
cache: false
|
|
- name: golangci-lint
|
|
uses: golangci/golangci-lint-action@v3
|
|
with:
|
|
version: v1.54
|
|
|
|
Tests:
|
|
name: Tests - Executing unit tests
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Extract branch name
|
|
uses: vazco/github-actions-branch-name@v1
|
|
id: branch
|
|
|
|
- name: Set up Go 1.21
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.21.x
|
|
id: go
|
|
|
|
- name: Downloads golang mods
|
|
run: |
|
|
go mod download
|
|
|
|
- name: Verify Code Generation
|
|
run: |
|
|
make verify-generate
|
|
|
|
- name: Build
|
|
run: |
|
|
make build
|
|
|
|
- name: Test
|
|
run: |
|
|
make test
|
|
|
|
Build:
|
|
needs: [Tests, Lint]
|
|
name: Build - Building and publishig Docker images
|
|
runs-on: ubuntu-22.04
|
|
outputs:
|
|
oauth2proxyPRTag: ${{ steps.setVariables.outputs.prTag }}
|
|
oauth2proxyCITag: ${{ steps.setVariables.outputs.betaTag }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Build Docker image
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: ${{ github.workspace }}
|
|
push: false
|
|
tags: docker.eu1.hsdp.io/reporting:${{ github.run_id }}
|
|
|
|
Bump-version:
|
|
runs-on: ubuntu-22.04
|
|
name: Bumping the version
|
|
needs: [Build]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.10"
|
|
|
|
- name: Bump version
|
|
id: bump-version
|
|
shell: bash
|
|
run: |
|
|
pip3 install --root-user-action=ignore --upgrade bumpversion
|
|
sudo apt-get update && sudo apt-get install -y xmlstarlet --no-install-recommends
|
|
bumpversion patch
|
|
version=`cat VERSION`
|
|
echo "VERSION=$version" >> "$GITHUB_ENV"
|
|
echo "VERSION=$version" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Commit
|
|
uses: EndBug/add-and-commit@v9
|
|
with:
|
|
default_author: github_actions
|
|
add: .bumpversion.cfg VERSION
|
|
message: "[no ci] Bump version."
|
|
|
|
Publish:
|
|
runs-on: ubuntu-22.04
|
|
name: Publish to docker repository
|
|
needs: [Bump-version]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Docker login
|
|
run: |
|
|
docker login --username '${{ secrets.DOCKER_USER }}' --password '${{ secrets.DOCKER_PSWD }}' '${{ secrets.DOCKER_REPO }}'
|
|
|
|
- name: Publish Docker image
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: ${{ github.workspace }}
|
|
push: true
|
|
tags: docker.eu1.hsdp.io/reporting:${{ needs.Bump-version.outputs }}
|