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

Create Nix Binaries, Docker Images for aarch64 #235

Merged
merged 10 commits into from
Oct 30, 2023
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
12 changes: 8 additions & 4 deletions .github/actions/build_nix/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ inputs:
description: "Shell to use"
required: true
default: "bash"
nix_build_args:
description: "Extra arguments to pass on to nix-build"
required: false
default: ""
runs:
using: "composite"
steps:
Expand All @@ -26,20 +30,20 @@ runs:
run: |
echo "#################################################################"
nix-env -f "<nixpkgs>" -iA bash
nix-build
nix-build ${{ inputs.nix_build_args }}
- name: Unit/Step Tests
shell: ${{ inputs.shell }}
run: |
echo "#################################################################"
nix-shell --run "pytest --step-rx '.'"
nix-shell ${{ inputs.nix_build_args }} --run "pytest --step-rx '.'"
- name: Smoke Test
shell: ${{ inputs.shell }}
run: |
echo "#################################################################"
nix-shell --run "openlane --smoke-test"
nix-shell ${{ inputs.nix_build_args }} --run "openlane --smoke-test"
- name: Push
shell: ${{ inputs.shell }}
if: ${{ inputs.cachix_token != '' }}
run: |
echo "#################################################################"
nix-build | cachix push openlane
nix-build ${{ inputs.nix_build_args }} | cachix push openlane
65 changes: 55 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,29 @@ jobs:
uses: ./.github/actions/derivation_to_cache
with:
key: derivation-amd64-${{ github.run_id }}
build-linux-aarch64:
needs: lint
runs-on: ubuntu-22.04
name: Build (Nix on Linux/aarch64)
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v1
- name: Initialize Step Unit Test Submodule
run: |
git submodule update --init test/steps/all
- name: Set up GITHUB_TOKEN
run: |
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
- name: Build with Nix
uses: ./.github/actions/build_nix
with:
cachix_cache: ${{ vars.CACHIX_CACHE || 'openlane' }}
cachix_token: "${{ secrets.CACHIX_TOKEN }}"
nix_build_args: --option system aarch64-linux --extra-platforms aarch64-linux
- name: Derivation to Cache
uses: ./.github/actions/derivation_to_cache
with:
key: derivation-aarch64-${{ github.run_id }}
build-mac-amd64:
needs: lint
runs-on: macos-12
Expand Down Expand Up @@ -118,25 +141,32 @@ jobs:
- name: Run Unit Tests
run: |
make test
build-docker-amd64:
build-docker:
runs-on: ubuntu-22.04
needs: [build-linux-amd64]
name: Build Docker Image (amd64)
strategy:
matrix:
arch: ["amd64", "aarch64"]
needs: [build-linux-amd64, build-linux-aarch64]
name: Build Docker Image (${{ matrix.arch }})
steps:
- name: Check out repo
uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v1
- name: Setup Nix
uses: ./.github/actions/setup_nix
with:
cachix_cache: ${{ vars.CACHIX_CACHE || 'openlane' }}
- name: Derivation from Cache
uses: ./.github/actions/derivation_from_cache
with:
key: derivation-amd64-${{ github.run_id }}
key: derivation-${{ matrix.arch }}-${{ github.run_id }}
other-substituters: "https://${{ vars.CACHIX_CACHE || 'openlane' }}.cachix.org"
- name: Build Docker Image
run: |
IMAGE_PATH=$(nix-build --argstr name openlane --argstr tag-override tmp-amd64 docker.nix)
if [ "${{ matrix.arch }}" == "aarch64" ]; then
arch_flags="--option system aarch64-linux --extra-platforms aarch64-linux"
fi
IMAGE_PATH=$(nix-build --argstr name openlane --argstr tag-override tmp-${{ matrix.arch }} $arch_flags docker.nix)
echo "IMAGE_PATH=$IMAGE_PATH" >> $GITHUB_ENV
cat $IMAGE_PATH | docker load
- name: Set Up Python
Expand All @@ -149,15 +179,15 @@ jobs:
run: |
mkdir -p $HOME/.volare
chmod -R 755 $HOME/.volare
OPENLANE_IMAGE_OVERRIDE=openlane:tmp-amd64\
OPENLANE_IMAGE_OVERRIDE=openlane:tmp-${{ matrix.arch }}\
./venv/bin/python3 -m openlane\
--docker-no-tty\
--dockerized\
--smoke-test
- name: Upload Docker Artifact
uses: actions/upload-artifact@v3
with:
name: docker-image-amd64
name: docker-image-${{ matrix.arch }}
path: ${{ env.IMAGE_PATH }}
test:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -208,7 +238,7 @@ jobs:
path: ${{ matrix.design.run_folder }}
publish:
runs-on: ubuntu-22.04
needs: [build-linux-amd64, build-mac-amd64, build-docker-amd64, build-py]
needs: [build-linux-amd64, build-mac-amd64, build-docker, build-py]
name: Publish (If Applicable)
steps:
- name: Check out repo
Expand All @@ -224,18 +254,33 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_TOKEN }}
- name: Download Image (Docker)
- name: Download Image (Docker/amd64)
uses: actions/download-artifact@v3
with:
name: docker-image-amd64
path: /tmp/docker
- name: Download Image (Docker/aarch64)
uses: actions/download-artifact@v3
with:
name: docker-image-aarch64
path: /tmp/docker
- name: Load Image (Docker)
run: |
cat /tmp/docker/* | docker load
- name: Push (Docker)
if: ${{ env.PUBLISH == '1' }}
run: |
docker tag openlane:tmp-amd64 ghcr.io/${{ github.repository }}:$NEW_TAG
docker tag openlane:tmp-amd64 ghcr.io/${{ github.repository }}:$NEW_TAG-amd64
docker push ghcr.io/${{ github.repository }}:$NEW_TAG-amd64

docker tag openlane:tmp-aarch64 ghcr.io/${{ github.repository }}:$NEW_TAG-aarch64
docker push ghcr.io/${{ github.repository }}:$NEW_TAG-aarch64

docker manifest create\
ghcr.io/${{ github.repository }}:$NEW_TAG\
ghcr.io/${{ github.repository }}:$NEW_TAG-amd64\
ghcr.io/${{ github.repository }}:$NEW_TAG-aarch64

docker push ghcr.io/${{ github.repository }}:$NEW_TAG
- name: Set Up Python
if: ${{ env.PUBLISH == '1' }}
Expand Down
3 changes: 1 addition & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ with pkgs; with python3.pkgs; buildPythonPackage rec {
eqy
lighter
synlig-sv
ys-ghdl
]))
] ++ (if builtins.currentSystem == "x86_64-linux" then [ys-ghdl] else []) ))
openroad
klayout
netgen
Expand Down
20 changes: 13 additions & 7 deletions nix/klayout.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,15 @@
}:

with pkgs; let
rev = "6a36bfa7c04f55bd732f8e0f91b553c8f9cebed7";
rev = "8212b7cefd5b774f82f53cf9080ffc109f1e66ea";
in clangStdenv.mkDerivation {
pname = "klayout";
version = "${rev}"; # I'm going to avoid a KLayout rebuild like the goddamn plague
name = "klayout";

src = fetchFromGitHub {
owner = "KLayout";
repo = "klayout";
rev = "${rev}";
sha256 = "sha256-fjKxQ3oVtnFwzLeeE6kN0jKE5PIfBZubTF54KO+k/DE=";
sha256 = "sha256-QvEoXKJ9sH5WIarYPsYEWwoFwA/pZa2etegA+AD8rPo=";
};

postPatch = ''
Expand Down Expand Up @@ -79,9 +78,16 @@ in clangStdenv.mkDerivation {
];

buildPhase = ''
runHook preBuild
mkdir -p $out/lib
CC=clang CXX=clang++ ./build.sh -prefix $out/lib -option -j$NIX_BUILD_CORES -expert -verbose
echo "Using $NIX_BUILD_CORES threads…"
./build.sh\
-option -j$NIX_BUILD_CORES\
-without-qtbinding\
-python $(which python3)\
-ruby $(which ruby)\
-prefix $out/lib\
-expert\
-verbose
runHook postBuild
'';

Expand All @@ -99,4 +105,4 @@ in clangStdenv.mkDerivation {
'' else '''';

dontInstall = true; # "Installation" already happens as part of "build.sh"
}
}
12 changes: 2 additions & 10 deletions nix/openroad.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@

with pkgs; let
abc = import ./openroad-abc.nix { inherit pkgs; };
or-tools = import ./or-tools.nix { inherit pkgs; };
lemon-graph' = lemon-graph.overrideAttrs (finalAttrs: previousAttrs: {
meta = {
broken = false;
};
doCheck = !stdenv.isDarwin; # Some tests fail to compile on Darwin
});
in clangStdenv.mkDerivation rec {
name = "openroad";
rev = "0a584d123190322b0725d5440c2c486d91d3afd8";
Expand Down Expand Up @@ -70,14 +63,13 @@ in clangStdenv.mkDerivation rec {
libsForQt5.qtbase
llvmPackages.openmp

lemon-graph
or-tools
re2
glpk
zlib
clp
cbc

lemon-graph'
re2
];

nativeBuildInputs = [
Expand Down
123 changes: 0 additions & 123 deletions nix/or-tools.nix

This file was deleted.

Loading
Loading