Skip to content

Fix task unzip-dir operation. #230

Fix task unzip-dir operation.

Fix task unzip-dir operation. #230

Workflow file for this run

---
name: CI
on: # yamllint disable-line rule:truthy
workflow_dispatch:
push:
branches: [main]
tags:
- 'v*.*.*'
pull_request:
branches: [main]
permissions:
contents: read
pull-requests: read
packages: read
env:
REGISTRY: ghcr.io
IMAGE_BASE_NAME: ${{ github.repository_owner }}/dse
PACKAGE_VERSION: 0.0.2
jobs:
build:
runs-on: [ubuntu-latest]
strategy:
matrix:
package_arch:
- linux-amd64
- linux-x86
- linux-i386
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Build package metadata
id: package_meta
uses: docker/metadata-action@v5
with:
images: dse/sdp
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
- name: Get package version
if: startsWith(github.ref, 'refs/tags/')
id: package
run: |
echo "PACKAGE_VERSION=${{ fromJSON(steps.package_meta.outputs.json).labels['org.opencontainers.image.version'] }}" >> $GITHUB_ENV
- name: Build
env:
PACKAGE_ARCH: ${{ matrix.package_arch }}
run: |
make examples
- uses: actions/upload-artifact@v4
with:
name: Models-${{ matrix.package_arch }}-package
path: |
examples/models/build/_dist/Models-${{ env.PACKAGE_VERSION }}-${{ matrix.package_arch }}.zip
retention-days: 1
containers:
permissions:
packages: write
runs-on: [ubuntu-latest]
strategy:
matrix:
include:
- name: report
dockerfile: graph/build/package/report/Dockerfile
context: graph/
- name: builder
dockerfile: .devcontainer/Dockerfile-builder
context: .
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
name=${{ env.REGISTRY }}/${{ env.IMAGE_BASE_NAME }}-${{ matrix.name }},enable=${{ startsWith(github.ref, 'refs/tags/') }}
name=${{ matrix.name }},enable=${{ !startsWith(github.ref, 'refs/tags/') }}
name=${{ matrix.name }},enable=true
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=test
- name: Version
if: startsWith(github.ref, 'refs/tags/')
id: package
run: |
echo "PACKAGE_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v6
with:
push: false
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
build-args: |
PACKAGE_VERSION=${{ env.PACKAGE_VERSION }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=docker,dest=/tmp/${{ matrix.name }}.tar
- name: Upload image artifact
uses: actions/upload-artifact@v4
with:
name: image_${{ matrix.name }}
path: /tmp/${{ matrix.name }}.tar
retention-days: 1
test_e2e:
runs-on: [ubuntu-latest]
needs: [build, containers]
container:
image: ghcr.io/boschglobal/dse-testscript:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
steps:
- uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Build package metadata
id: package_meta
uses: docker/metadata-action@v5
with:
images: dse/sdp
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
- name: Get package version
if: startsWith(github.ref, 'refs/tags/')
id: package
run: |
echo "PACKAGE_VERSION=${{ fromJSON(steps.package_meta.outputs.json).labels['org.opencontainers.image.version'] }}" >> $GITHUB_ENV
- name: Download artifact
uses: actions/download-artifact@v5
with:
name: image_builder
path: /tmp
- name: Download artifact
uses: actions/download-artifact@v5
with:
name: image_report
path: /tmp
- name: Load images
run: |
docker load --input /tmp/builder.tar
docker load --input /tmp/report.tar
docker image ls -a
- name: Download build artifacts
uses: actions/download-artifact@v5
with:
name: Models-linux-amd64-package
path: ./examples/models/build/_dist
- name: Set environment
run: |
echo "HOST_DOCKER_WORKSPACE=${{ github.workspace }}" >> $GITHUB_ENV
echo "DSE_BUILDER_IMAGE=builder:test" >> $GITHUB_ENV
echo "DSE_REPORT_IMAGE=report:test" >> $GITHUB_ENV
- name: Test
run: |
export HOST_DOCKER_WORKSPACE=${{ env.HOST_DOCKER_WORKSPACE }}
make test_e2e
release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: [ubuntu-latest]
needs: [build, containers, test_e2e]
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Create Release from Tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" \
--notes-from-tag
publish_examples:
if: startsWith(github.ref, 'refs/tags/')
runs-on: [ubuntu-latest]
needs: [release]
permissions:
contents: write
packages: write
strategy:
matrix:
package_arch:
- linux-amd64
- linux-x86
- linux-i386
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Build package metadata
id: package_meta
uses: docker/metadata-action@v5
with:
images: dse/sdp
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
- name: Get package version
if: startsWith(github.ref, 'refs/tags/')
id: package
run: |
echo "PACKAGE_VERSION=${{ fromJSON(steps.package_meta.outputs.json).labels['org.opencontainers.image.version'] }}" >> $GITHUB_ENV
- uses: actions/download-artifact@v4
with:
name: Models-${{ matrix.package_arch }}-package
- name: Upload Release Asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release upload "$tag" \
Models-${{ env.PACKAGE_VERSION }}-${{ matrix.package_arch }}.zip \
--clobber
publish_containers:
if: startsWith(github.ref, 'refs/tags/')
runs-on: [ubuntu-latest]
needs: [release]
permissions:
packages: write
strategy:
matrix:
container:
- report
- builder
steps:
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
name=${{ env.REGISTRY }}/${{ env.IMAGE_BASE_NAME }}-${{ matrix.name }},enable=${{ startsWith(github.ref, 'refs/tags/') }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Download artifact
uses: actions/download-artifact@v5
with:
name: image_${{ matrix.container }}
path: /tmp
- name: Load and Push Image
run: |
docker load --input /tmp/${{ matrix.container }}.tar
docker image ls -a
docker image push ${{ env.REGISTRY }}/${{ env.IMAGE_BASE_NAME }}-${{ matrix.container }}:latest
docker image push ${{ env.REGISTRY }}/${{ env.IMAGE_BASE_NAME }}-${{ matrix.container }}:${{ steps.meta.outputs.version }}