Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to new CI #27

Merged
merged 1 commit into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions .github/workflows/build.sh

This file was deleted.

61 changes: 27 additions & 34 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ jobs:
permissions:
contents: read
packages: write
env:
CACHE: /tmp/.buildx-cache
strategy:
fail-fast: false
max-parallel: 1 # take advantage of caching
matrix:
target: [developer, runtime]
architecture: [linux]
include:
- architecture: linux
os: ubuntu-latest
- os: ubuntu-latest
platform: linux/amd64

runs-on: ${{ matrix.os }}
Expand All @@ -28,52 +28,45 @@ jobs:
with:
submodules: recursive

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: ${{ env.CACHE }}
key: ${{ runner.os }}-${{ matrix.architecture }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ matrix.architecture }}-buildx-

- name: Log in to GitHub Docker Registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ghcr.io/${{ github.repository_owner }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Setup python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Docker Build Script
env:
ARCH: ${{ matrix.architecture }}
PLATFORM: ${{ matrix.platform }}
TAG: ${{ github.ref_name }}
PUSH: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
CACHE: ${{ env.CACHE }}
run: .github/workflows/build.sh
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Upload schema as artifact
uses: actions/upload-artifact@v3
- name: Build image
uses: docker/build-push-action@v5
with:
name: ioc-schema
path: ibek.ioc.schema.json
context: .
file: Dockerfile
push: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
platform: ${{ matrix.platform }}
target: ${{ matrix.target }}
build-args: TARGET_ARCHITECTURE=${{ matrix.architecture }}
tags: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-${{ matrix.architecture }}-${{ matrix.target }}:${{ github.ref_name }}
cache-from: type=gha
cache-to: type=gha,mode=max

release:
# Release on tag push - publish ioc schema
needs: [build-push-images]
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
runs-on: ubuntu-latest

# this job runs in the (linux) developer container we just made
container:
image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-linux-developer:${{ github.ref_name }}

steps:
- uses: actions/download-artifact@v3
with:
name: ioc-schema
path: ./
- name: generate-schema
run: |
ibek ioc generate-schema --output ibek.ioc.schema.json

# TODO add back in some tests that run INSIDE the container

- name: Github Release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15
Expand Down
Loading