Add forgejo actions #852

Merged
mwalbeck merged 3 commits from actions into main 2025-02-13 19:54:38 +00:00
8 changed files with 238 additions and 424 deletions
Showing only changes of commit b4fd843cbd - Show all commits

View file

@ -1,121 +0,0 @@
def main(ctx):
return [
lint(),
test("2_php8.1", "2-php8.1"),
test("2_php8.2", "2-php8.2"),
test("2_php8.3", "2-php8.3"),
test("2_php8.4", "2-php8.4"),
release("2_php8.1", "2-php8.1", app_env = "php8.1"),
release("2_php8.2", "2-php8.2", app_env = "php8.2"),
release("2_php8.3", "2-php8.3", app_env = "php8.3"),
release("2_php8.4", "2-php8.4", app_env = "php8.4", custom_tags = "latest"),
]
def lint():
return {
"kind": "pipeline",
"type": "docker",
"name": "lint",
"steps": [
{
"name": "Lint Dockerfiles",
"image": "hadolint/hadolint:latest-debian",
"pull": "if-not-exists",
"commands": [
"hadolint --version",
"hadolint */Dockerfile",
],
},
],
"trigger": {
"event": [
"pull_request",
"push",
],
"ref": {
"exclude": [
"refs/heads/renovate/*",
],
},
},
}
def test(name, composer_variant, dockerfile = "Dockerfile"):
return {
"kind": "pipeline",
"type": "docker",
"name": "test_%s" % name,
"steps": [
{
"name": "build test",
"image": "plugins/docker",
"pull": "if-not-exists",
"settings": {
"dockerfile": "%s/%s" % (composer_variant, dockerfile),
"username": {
"from_secret": "dockerhub_username",
},
"password": {
"from_secret": "dockerhub_password_ro",
},
"dry_run": "true",
"repo": "mwalbeck/composer",
},
},
],
"trigger": {
"event": [
"pull_request",
],
},
"depends_on": [
"lint",
],
}
def release(name, composer_variant, dockerfile = "Dockerfile", app_env = "", custom_tags = ""):
return {
"kind": "pipeline",
"type": "docker",
"name": "release_%s" % name,
"steps": [
{
"name": "determine tags",
"image": "mwalbeck/determine-docker-tags",
"pull": "if-not-exists",
"environment": {
"VERSION_TYPE": "docker_env",
"APP_NAME": "COMPOSER",
"DOCKERFILE_PATH": "%s/%s" % (composer_variant, dockerfile),
"APP_ENV": app_env,
"CUSTOM_TAGS": custom_tags,
},
},
{
"name": "build and publish",
"image": "plugins/docker",
"pull": "if-not-exists",
"settings": {
"dockerfile": "%s/%s" % (composer_variant, dockerfile),
"username": {
"from_secret": "dockerhub_username",
},
"password": {
"from_secret": "dockerhub_password",
},
"repo": "mwalbeck/composer",
},
},
],
"trigger": {
"branch": [
"master",
],
"event": [
"push",
],
},
"depends_on": [
"lint",
],
}

View file

@ -1,303 +0,0 @@
---
kind: pipeline
type: docker
name: lint
platform:
os: linux
arch: amd64
steps:
- name: Lint Dockerfiles
pull: if-not-exists
image: hadolint/hadolint:latest-debian
commands:
- hadolint --version
- hadolint */Dockerfile
trigger:
event:
- pull_request
- push
ref:
exclude:
- refs/heads/renovate/*
---
kind: pipeline
type: docker
name: test_2_php8.1
platform:
os: linux
arch: amd64
steps:
- name: build test
pull: if-not-exists
image: plugins/docker
settings:
dockerfile: 2-php8.1/Dockerfile
dry_run: true
password:
from_secret: dockerhub_password_ro
repo: mwalbeck/composer
username:
from_secret: dockerhub_username
trigger:
event:
- pull_request
depends_on:
- lint
---
kind: pipeline
type: docker
name: test_2_php8.2
platform:
os: linux
arch: amd64
steps:
- name: build test
pull: if-not-exists
image: plugins/docker
settings:
dockerfile: 2-php8.2/Dockerfile
dry_run: true
password:
from_secret: dockerhub_password_ro
repo: mwalbeck/composer
username:
from_secret: dockerhub_username
trigger:
event:
- pull_request
depends_on:
- lint
---
kind: pipeline
type: docker
name: test_2_php8.3
platform:
os: linux
arch: amd64
steps:
- name: build test
pull: if-not-exists
image: plugins/docker
settings:
dockerfile: 2-php8.3/Dockerfile
dry_run: true
password:
from_secret: dockerhub_password_ro
repo: mwalbeck/composer
username:
from_secret: dockerhub_username
trigger:
event:
- pull_request
depends_on:
- lint
---
kind: pipeline
type: docker
name: test_2_php8.4
platform:
os: linux
arch: amd64
steps:
- name: build test
pull: if-not-exists
image: plugins/docker
settings:
dockerfile: 2-php8.4/Dockerfile
dry_run: true
password:
from_secret: dockerhub_password_ro
repo: mwalbeck/composer
username:
from_secret: dockerhub_username
trigger:
event:
- pull_request
depends_on:
- lint
---
kind: pipeline
type: docker
name: release_2_php8.1
platform:
os: linux
arch: amd64
steps:
- name: determine tags
pull: if-not-exists
image: mwalbeck/determine-docker-tags
environment:
APP_ENV: php8.1
APP_NAME: COMPOSER
DOCKERFILE_PATH: 2-php8.1/Dockerfile
VERSION_TYPE: docker_env
- name: build and publish
pull: if-not-exists
image: plugins/docker
settings:
dockerfile: 2-php8.1/Dockerfile
password:
from_secret: dockerhub_password
repo: mwalbeck/composer
username:
from_secret: dockerhub_username
trigger:
branch:
- master
event:
- push
depends_on:
- lint
---
kind: pipeline
type: docker
name: release_2_php8.2
platform:
os: linux
arch: amd64
steps:
- name: determine tags
pull: if-not-exists
image: mwalbeck/determine-docker-tags
environment:
APP_ENV: php8.2
APP_NAME: COMPOSER
DOCKERFILE_PATH: 2-php8.2/Dockerfile
VERSION_TYPE: docker_env
- name: build and publish
pull: if-not-exists
image: plugins/docker
settings:
dockerfile: 2-php8.2/Dockerfile
password:
from_secret: dockerhub_password
repo: mwalbeck/composer
username:
from_secret: dockerhub_username
trigger:
branch:
- master
event:
- push
depends_on:
- lint
---
kind: pipeline
type: docker
name: release_2_php8.3
platform:
os: linux
arch: amd64
steps:
- name: determine tags
pull: if-not-exists
image: mwalbeck/determine-docker-tags
environment:
APP_ENV: php8.3
APP_NAME: COMPOSER
DOCKERFILE_PATH: 2-php8.3/Dockerfile
VERSION_TYPE: docker_env
- name: build and publish
pull: if-not-exists
image: plugins/docker
settings:
dockerfile: 2-php8.3/Dockerfile
password:
from_secret: dockerhub_password
repo: mwalbeck/composer
username:
from_secret: dockerhub_username
trigger:
branch:
- master
event:
- push
depends_on:
- lint
---
kind: pipeline
type: docker
name: release_2_php8.4
platform:
os: linux
arch: amd64
steps:
- name: determine tags
pull: if-not-exists
image: mwalbeck/determine-docker-tags
environment:
APP_ENV: php8.4
APP_NAME: COMPOSER
CUSTOM_TAGS: latest
DOCKERFILE_PATH: 2-php8.4/Dockerfile
VERSION_TYPE: docker_env
- name: build and publish
pull: if-not-exists
image: plugins/docker
settings:
dockerfile: 2-php8.4/Dockerfile
password:
from_secret: dockerhub_password
repo: mwalbeck/composer
username:
from_secret: dockerhub_username
trigger:
branch:
- master
event:
- push
depends_on:
- lint
---
kind: signature
hmac: fcc372edef5a413432143b6d9eb88cd8424d73d901013787350f6011ce9fde31
...

View file

@ -0,0 +1,132 @@
name: Build and publish
on:
push:
branches:
- main
jobs:
lint:
runs-on: docker
steps:
- uses: actions/checkout@v4
- uses: https://github.com/hadolint/hadolint-action@v3.1.0
with:
dockerfile: Dockerfile
recursive: true
php8_1:
runs-on: dind
steps:
- uses: actions/checkout@v4
- name: Get docker tags
id: tags
shell: sh
env:
VERSION_TYPE: "docker_env"
APP_ENV: "php8.1"
APP_NAME: "COMPOSER"
DOCKERFILE_PATH: "php8.1/Dockerfile"
IMAGE_NAME: "mwalbeck/composer"
run: |
determine-docker-tags
dockerd &
- name: Login to Docker Hub
uses: https://github.com/docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: https://github.com/docker/setup-buildx-action@v3
- name: Build and push
uses: https://github.com/docker/build-push-action@v6
with:
push: true
tags: ${{ steps.tags.outputs.tags }}
php8_2:
runs-on: dind
steps:
- uses: actions/checkout@v4
- name: Get docker tags
id: tags
shell: sh
env:
VERSION_TYPE: "docker_env"
APP_ENV: "php8.2"
APP_NAME: "COMPOSER"
DOCKERFILE_PATH: "php8.2/Dockerfile"
IMAGE_NAME: "mwalbeck/composer"
run: |
determine-docker-tags
dockerd &
- name: Login to Docker Hub
uses: https://github.com/docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: https://github.com/docker/setup-buildx-action@v3
- name: Build and push
uses: https://github.com/docker/build-push-action@v6
with:
push: true
tags: ${{ steps.tags.outputs.tags }}
php8_3:
runs-on: dind
steps:
- uses: actions/checkout@v4
- name: Get docker tags
id: tags
shell: sh
env:
VERSION_TYPE: "docker_env"
APP_ENV: "php8.3"
APP_NAME: "COMPOSER"
DOCKERFILE_PATH: "php8.3/Dockerfile"
IMAGE_NAME: "mwalbeck/composer"
run: |
determine-docker-tags
dockerd &
- name: Login to Docker Hub
uses: https://github.com/docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: https://github.com/docker/setup-buildx-action@v3
- name: Build and push
uses: https://github.com/docker/build-push-action@v6
with:
push: true
tags: ${{ steps.tags.outputs.tags }}
php8_4:
runs-on: dind
steps:
- uses: actions/checkout@v4
- name: Get docker tags
id: tags
shell: sh
env:
VERSION_TYPE: "docker_env"
APP_ENV: "php8.4"
APP_NAME: "COMPOSER"
DOCKERFILE_PATH: "php8.4/Dockerfile"
IMAGE_NAME: "mwalbeck/composer"
run: |
determine-docker-tags
dockerd &
- name: Login to Docker Hub
uses: https://github.com/docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: https://github.com/docker/setup-buildx-action@v3
- name: Build and push
uses: https://github.com/docker/build-push-action@v6
with:
push: true
tags: ${{ steps.tags.outputs.tags }}

106
.forgejo/workflows/test.yml Normal file
View file

@ -0,0 +1,106 @@
name: Test
on: pull_request
jobs:
lint:
if: github.ref != 'refs/heads/renovate/*'
runs-on: docker
steps:
- uses: actions/checkout@v4
- uses: https://github.com/hadolint/hadolint-action@v3.1.0
with:
dockerfile: Dockerfile
recursive: true
php8_1:
runs-on: dind
steps:
- uses: actions/checkout@v4
- name: Get docker tags
id: tags
shell: sh
env:
VERSION_TYPE: "docker_env"
APP_ENV: "php8.1"
APP_NAME: "COMPOSER"
DOCKERFILE_PATH: "2-php8.1/Dockerfile"
IMAGE_NAME: "mwalbeck/composer"
run: |
determine-docker-tags
dockerd &
- name: Set up Docker Buildx
uses: https://github.com/docker/setup-buildx-action@v3
- name: Test build
uses: https://github.com/docker/build-push-action@v6
with:
tags: ${{ steps.tags.outputs.tags }}
php8_2:
runs-on: dind
steps:
- uses: actions/checkout@v4
- name: Get docker tags
id: tags
shell: sh
env:
VERSION_TYPE: "docker_env"
APP_ENV: "php8.2"
APP_NAME: "COMPOSER"
DOCKERFILE_PATH: "2-php8.2/Dockerfile"
IMAGE_NAME: "mwalbeck/composer"
run: |
determine-docker-tags
dockerd &
- name: Set up Docker Buildx
uses: https://github.com/docker/setup-buildx-action@v3
- name: Test build
uses: https://github.com/docker/build-push-action@v6
with:
tags: ${{ steps.tags.outputs.tags }}
php8_3:
runs-on: dind
steps:
- uses: actions/checkout@v4
- name: Get docker tags
id: tags
shell: sh
env:
VERSION_TYPE: "docker_env"
APP_ENV: "php8.3"
APP_NAME: "COMPOSER"
DOCKERFILE_PATH: "2-php8.3/Dockerfile"
IMAGE_NAME: "mwalbeck/composer"
run: |
determine-docker-tags
dockerd &
- name: Set up Docker Buildx
uses: https://github.com/docker/setup-buildx-action@v3
- name: Test build
uses: https://github.com/docker/build-push-action@v6
with:
tags: ${{ steps.tags.outputs.tags }}
php8_4:
runs-on: dind
steps:
- uses: actions/checkout@v4
- name: Get docker tags
id: tags
shell: sh
env:
VERSION_TYPE: "docker_env"
APP_ENV: "php8.4"
APP_NAME: "COMPOSER"
DOCKERFILE_PATH: "2-php8.4/Dockerfile"
IMAGE_NAME: "mwalbeck/composer"
run: |
determine-docker-tags
dockerd &
- name: Set up Docker Buildx
uses: https://github.com/docker/setup-buildx-action@v3
- name: Test build
uses: https://github.com/docker/build-push-action@v6
with:
tags: ${{ steps.tags.outputs.tags }}