Skip to content

ci: add workflows to build OCI images #50

ci: add workflows to build OCI images

ci: add workflows to build OCI images #50

Workflow file for this run

name: Rust CI
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
jobs:
build-and-test:
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
with:
rust-version: '1.88.0'
working-directory: "."
enable-cache: true
publish-crates-io: false
prepare:
name: Determine image tag
runs-on: ubuntu-latest
needs: build-and-test
if: |
github.ref_name == 'main' ||
startsWith(github.head_ref, 'feature/') ||
startsWith(github.head_ref, 'bugfix/') ||
(github.event_name == 'workflow_dispatch' && (startsWith(github.ref_name, 'feature/') || startsWith(github.ref_name, 'bugfix/')))
outputs:
image_tag: ${{ steps.determine-tag.outputs.image_tag }}
steps:
- name: Determine Docker tag based on Git ref
id: determine-tag
run: |
if [ "${{ github.event_name }}" = "pull_request" ] ; then
SHORT_SHA=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-8)
else
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8)
fi
if [ "${{ github.ref_name }}" = "main" ] ; then
echo "Processing main branch"
echo "image_tag=dev-${SHORT_SHA}" | tee -a $GITHUB_OUTPUT
else
# This covers feature/ and bugfix/ branches
echo "Processing feature/bugfix branch ${{ github.head_ref }}"
echo "image_tag=feature-${SHORT_SHA}" | tee -a $GITHUB_OUTPUT
fi
post-compute-oci-image:
name: post-compute OCI image
needs: prepare
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
with:
image-name: docker-regis.iex.ec/tee-worker-post-compute-rust
image-tag: ${{ needs.prepare.outputs.image_tag }}
dockerfile: post-compute/Dockerfile
context: .
registry: docker-regis.iex.ec
push: true
security-scan: true
security-report: "sarif"
hadolint: true
platforms: linux/amd64
secrets:
username: ${{ secrets.NEXUS_USERNAME }}
password: ${{ secrets.NEXUS_PASSWORD }}
pre-compute-oci-image:
name: pre-compute OCI image
needs: prepare
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected]
with:
image-name: docker-regis.iex.ec/tee-worker-pre-compute-rust
image-tag: ${{ needs.prepare.outputs.image_tag }}
dockerfile: pre-compute/Dockerfile
context: .
registry: docker-regis.iex.ec
push: true
security-scan: true
security-report: "sarif"
hadolint: true
platforms: linux/amd64
secrets:
username: ${{ secrets.NEXUS_USERNAME }}
password: ${{ secrets.NEXUS_PASSWORD }}