Skip to content

Commit

Permalink
ci: avoid installing dependencies in each job
Browse files Browse the repository at this point in the history
Signed-off-by: Unai Martinez-Corral <[email protected]>
  • Loading branch information
umarcor committed May 22, 2022
1 parent 9733e8a commit e6d814a
Showing 1 changed file with 46 additions and 18 deletions.
64 changes: 46 additions & 18 deletions .github/workflows/Pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,55 @@ name: Pipeline
on:
workflow_call:

env:
IMAGE: ghcr.io/f4pga/prjxray/ci

jobs:


BuildDatabase:
container: ubuntu:bionic
Dependencies:
runs-on: ubuntu-latest
permissions:
packages: write

steps:

- run: |
docker build -t $IMAGE - <<EOF
FROM ubuntu:bionic
RUN apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \
bash \
bison \
build-essential \
ca-certificates \
clang-format \
cmake \
psmisc \
colordiff \
coreutils \
git \
flex \
python3 \
python3-dev \
python3-venv \
xsltproc \
&& apt-get autoclean && apt-get clean && apt-get -y autoremove \
&& update-ca-certificates \
&& rm -rf /var/lib/apt/lists/*
- uses: pyTooling/Actions/with-post-step@r0
with:
main: |
echo '${{ github.token }}' | docker login ghcr.io -u gha --password-stdin
docker push $IMAGE
post: docker logout ghcr.io


BuildDatabase:
needs: Dependencies
runs-on: [self-hosted, Linux, X64]
container: $IMAGE

strategy:
fail-fast: false
Expand All @@ -27,13 +69,6 @@ jobs:
with:
submodules: recursive

- name: Install
run: |
apt update
apt install -y \
bash bison build-essential ca-certificates clang-format cmake psmisc \
colordiff coreutils git flex python3 python3-dev python3-venv xsltproc
- name: Build
run: make build --output-sync=target --warn-undefined-variables -j$(nproc)

Expand Down Expand Up @@ -61,9 +96,9 @@ jobs:
Tests:
container: ubuntu:bionic

needs: Dependencies
runs-on: [self-hosted, Linux, X64]
container: $IMAGE

env:
ALLOW_ROOT: true
Expand All @@ -74,13 +109,6 @@ jobs:
with:
submodules: recursive

- name: Install
run: |
apt update
apt install -y \
bash bison build-essential ca-certificates clang-format cmake psmisc \
colordiff coreutils git flex python3 python3-dev python3-venv xsltproc
- name: Build
run: make build --output-sync=target --warn-undefined-variables -j$(nproc)

Expand Down

0 comments on commit e6d814a

Please sign in to comment.