Skip to content

Commit d1f1982

Browse files
committed
.github: Use devcontainer to build the product
1 parent 164b570 commit d1f1982

1 file changed

Lines changed: 24 additions & 47 deletions

File tree

.github/workflows/build.yaml

Lines changed: 24 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,34 @@ jobs:
4040
skip: ${{ inputs.build-devcontainer != true }}
4141

4242
build:
43-
runs-on: ubuntu-20.04
43+
runs-on: ubuntu-latest
44+
needs:
45+
- build-devcontainer
46+
container:
47+
image: ghcr.io/${{ github.repository }}/devcontainer:${{ github.sha }}
48+
# We have to use `root` for the moment
49+
# Sees: https://github.com/actions/checkout/issues/1575
50+
# Could work with a user with 1001 id but not for docker
51+
options: --user root
52+
volumes:
53+
# This "ugly" workaround is needed for now because we use a container to run the job
54+
# so we use docker-in-docker but by default github mount the workspace in the container
55+
# not at the same location
56+
# - on the host it's on github.workspace => /home/runner/work/artesca/artesca
57+
# - in the container it's on GITHUB_WORKSPACE => /__w/artesca/artesca
58+
# Which means if we want to creata docker with bind mount we need to use the host path
59+
# that's why we also mount the workspace in the container at the same location
60+
- ${{ github.workspace }}:${{ github.workspace }}
61+
credentials:
62+
username: ${{ github.repository_owner }}
63+
password: ${{ secrets.GITHUB_TOKEN }}
64+
defaults:
65+
run:
66+
shell: bash
4467
outputs:
4568
artifact-name: ${{ steps.upload.outputs.name }}
4669
artifact-link: ${{ steps.upload.outputs.link }}
4770
steps:
48-
- name: Cleanup some unused ressources
49-
# Because of the large number of images we embed in the ISO
50-
# the disk space available start to be a problem.
51-
# Let's remove some unused ressources to free some space.
52-
run: |-
53-
sudo rm -rf /usr/local/lib/android
54-
sudo rm -rf /usr/share/dotnet
5571
- name: Login to Docker Hub
5672
uses: docker/login-action@v2
5773
with:
@@ -64,45 +80,6 @@ jobs:
6480
# NOTE: We fetch depth so that we can put the right `GIT` reference
6581
# in the product.txt
6682
fetch-depth: 0
67-
- name: Set up Docker Buildx
68-
uses: docker/setup-buildx-action@v3
69-
- name: Install Python 3
70-
uses: actions/setup-python@v5
71-
with:
72-
python-version: "3.10"
73-
- name: setup cache for pip
74-
uses: actions/cache@v4
75-
env:
76-
cache-name: pip-packages
77-
with:
78-
path: ~/.cache/pip/
79-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('buildchain/requirements.txt') }}
80-
restore-keys: |
81-
${{ runner.os }}-build-${{ env.cache-name }}-
82-
${{ runner.os }}-build-
83-
${{ runner.os }}-
84-
- name: Install deps
85-
run: |
86-
export DEBIAN_FRONTEND=noninteractive
87-
sudo apt-get update
88-
sudo apt-get install --no-install-recommends -y \
89-
genisoimage \
90-
isomd5sum \
91-
hardlink \
92-
libgpgme-dev libassuan-dev libbtrfs-dev pkg-config libdevmapper-dev
93-
- name: Install skopeo
94-
# NOTE: We install skopeo from sources since the version available in "classic"
95-
# repositories is too old and not compatible with docker > 1.25 (which is the one embedded
96-
# in the image we use here)
97-
env:
98-
SKOPEO_VERSION: 1.15.1
99-
run: |
100-
curl -Lo skopeo.tar.gz https://github.com/containers/skopeo/archive/refs/tags/v${SKOPEO_VERSION}.tar.gz && \
101-
tar -zxf skopeo.tar.gz && \
102-
cd skopeo-${SKOPEO_VERSION} && \
103-
make bin/skopeo && \
104-
sudo mv bin/skopeo /usr/local/bin/ && \
105-
cd .. && rm -rf skopeo.tar.gz skopeo-${SKOPEO_VERSION}
10683
- name: Build everything
10784
run: ./doit.sh -n 4 --verbosity 2 --failure-verbosity 2
10885
- name: Prepare artifacts

0 commit comments

Comments
 (0)