From b4fd843cbdc6b532b0b5f1cb34968c616e1bb9d7 Mon Sep 17 00:00:00 2001 From: Magnus Walbeck Date: Thu, 13 Feb 2025 20:47:00 +0100 Subject: [PATCH 1/3] Add forgejo actions --- .drone.star | 121 ------------- .drone.yml | 303 -------------------------------- .forgejo/workflows/build.yml | 132 ++++++++++++++ .forgejo/workflows/test.yml | 106 +++++++++++ {2-php8.1 => php8.1}/Dockerfile | 0 {2-php8.2 => php8.2}/Dockerfile | 0 {2-php8.3 => php8.3}/Dockerfile | 0 {2-php8.4 => php8.4}/Dockerfile | 0 8 files changed, 238 insertions(+), 424 deletions(-) delete mode 100644 .drone.star delete mode 100644 .drone.yml create mode 100644 .forgejo/workflows/build.yml create mode 100644 .forgejo/workflows/test.yml rename {2-php8.1 => php8.1}/Dockerfile (100%) rename {2-php8.2 => php8.2}/Dockerfile (100%) rename {2-php8.3 => php8.3}/Dockerfile (100%) rename {2-php8.4 => php8.4}/Dockerfile (100%) diff --git a/.drone.star b/.drone.star deleted file mode 100644 index 2072c11..0000000 --- a/.drone.star +++ /dev/null @@ -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", - ], - } diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 65051a7..0000000 --- a/.drone.yml +++ /dev/null @@ -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 - -... diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml new file mode 100644 index 0000000..8dc2b0f --- /dev/null +++ b/.forgejo/workflows/build.yml @@ -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 }} \ No newline at end of file diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml new file mode 100644 index 0000000..3374d2f --- /dev/null +++ b/.forgejo/workflows/test.yml @@ -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 }} diff --git a/2-php8.1/Dockerfile b/php8.1/Dockerfile similarity index 100% rename from 2-php8.1/Dockerfile rename to php8.1/Dockerfile diff --git a/2-php8.2/Dockerfile b/php8.2/Dockerfile similarity index 100% rename from 2-php8.2/Dockerfile rename to php8.2/Dockerfile diff --git a/2-php8.3/Dockerfile b/php8.3/Dockerfile similarity index 100% rename from 2-php8.3/Dockerfile rename to php8.3/Dockerfile diff --git a/2-php8.4/Dockerfile b/php8.4/Dockerfile similarity index 100% rename from 2-php8.4/Dockerfile rename to php8.4/Dockerfile -- 2.45.2 From dc5330920c44d0817d183b48e041d6b56dad4490 Mon Sep 17 00:00:00 2001 From: Magnus Walbeck Date: Thu, 13 Feb 2025 20:48:53 +0100 Subject: [PATCH 2/3] Fix path to dockerfile --- .forgejo/workflows/test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml index 3374d2f..9bc3d54 100644 --- a/.forgejo/workflows/test.yml +++ b/.forgejo/workflows/test.yml @@ -24,7 +24,7 @@ jobs: VERSION_TYPE: "docker_env" APP_ENV: "php8.1" APP_NAME: "COMPOSER" - DOCKERFILE_PATH: "2-php8.1/Dockerfile" + DOCKERFILE_PATH: "php8.1/Dockerfile" IMAGE_NAME: "mwalbeck/composer" run: | determine-docker-tags @@ -47,7 +47,7 @@ jobs: VERSION_TYPE: "docker_env" APP_ENV: "php8.2" APP_NAME: "COMPOSER" - DOCKERFILE_PATH: "2-php8.2/Dockerfile" + DOCKERFILE_PATH: "php8.2/Dockerfile" IMAGE_NAME: "mwalbeck/composer" run: | determine-docker-tags @@ -70,7 +70,7 @@ jobs: VERSION_TYPE: "docker_env" APP_ENV: "php8.3" APP_NAME: "COMPOSER" - DOCKERFILE_PATH: "2-php8.3/Dockerfile" + DOCKERFILE_PATH: "php8.3/Dockerfile" IMAGE_NAME: "mwalbeck/composer" run: | determine-docker-tags @@ -93,7 +93,7 @@ jobs: VERSION_TYPE: "docker_env" APP_ENV: "php8.4" APP_NAME: "COMPOSER" - DOCKERFILE_PATH: "2-php8.4/Dockerfile" + DOCKERFILE_PATH: "php8.4/Dockerfile" IMAGE_NAME: "mwalbeck/composer" run: | determine-docker-tags -- 2.45.2 From e28ee65f133e295db99bf541d99838cbb095b524 Mon Sep 17 00:00:00 2001 From: Magnus Walbeck Date: Thu, 13 Feb 2025 20:51:33 +0100 Subject: [PATCH 3/3] Set docker context --- .forgejo/workflows/build.yml | 6 +++++- .forgejo/workflows/test.yml | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index 8dc2b0f..9fdc9e9 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -43,6 +43,7 @@ jobs: with: push: true tags: ${{ steps.tags.outputs.tags }} + context: ./php8.1 php8_2: runs-on: dind @@ -72,6 +73,7 @@ jobs: with: push: true tags: ${{ steps.tags.outputs.tags }} + context: ./php8.2 php8_3: runs-on: dind @@ -101,6 +103,7 @@ jobs: with: push: true tags: ${{ steps.tags.outputs.tags }} + context: ./php8.3 php8_4: runs-on: dind @@ -129,4 +132,5 @@ jobs: uses: https://github.com/docker/build-push-action@v6 with: push: true - tags: ${{ steps.tags.outputs.tags }} \ No newline at end of file + tags: ${{ steps.tags.outputs.tags }} + context: ./php8.4 \ No newline at end of file diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml index 9bc3d54..4e2520a 100644 --- a/.forgejo/workflows/test.yml +++ b/.forgejo/workflows/test.yml @@ -35,6 +35,7 @@ jobs: uses: https://github.com/docker/build-push-action@v6 with: tags: ${{ steps.tags.outputs.tags }} + context: ./php8.1 php8_2: runs-on: dind @@ -58,6 +59,7 @@ jobs: uses: https://github.com/docker/build-push-action@v6 with: tags: ${{ steps.tags.outputs.tags }} + context: ./php8.2 php8_3: runs-on: dind @@ -81,6 +83,7 @@ jobs: uses: https://github.com/docker/build-push-action@v6 with: tags: ${{ steps.tags.outputs.tags }} + context: ./php8.3 php8_4: runs-on: dind @@ -104,3 +107,4 @@ jobs: uses: https://github.com/docker/build-push-action@v6 with: tags: ${{ steps.tags.outputs.tags }} + context: ./php8.4 -- 2.45.2