Skip to content

Commit e25a6b8

Browse files
author
Yoshiki Takashima
authored
Added packages to release for ubuntu-20.04 only. (rust-lang#1595)
* Added packages to release for ubuntu-20.04 only. * Reduced image size. * Changed from matrix. * Missing path in variable invocation. * Copy without version dependence. * Eliminated hard-coded values * Removed redundant input. * Added missing package command. * Forgot to make owner flexible. * Fixed docker push fail: uppercase in name. * Missing permissions. * Reverted unrelated testbundle Dockerfile
1 parent 42bfc94 commit e25a6b8

File tree

2 files changed

+80
-1
lines changed

2 files changed

+80
-1
lines changed

.github/workflows/release.yml

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
uses: ./.github/actions/setup
7373
with:
7474
os: ${{ matrix.os }}
75-
75+
7676
- name: Build release bundle
7777
run: |
7878
cargo run -p make-kani-release -- ${{ needs.Release.outputs.version }}
@@ -86,3 +86,55 @@ jobs:
8686
asset_path: kani-${{ needs.Release.outputs.version }}-${{ matrix.target }}.tar.gz
8787
asset_name: kani-${{ needs.Release.outputs.version }}-${{ matrix.target }}.tar.gz
8888
asset_content_type: application/gzip
89+
90+
Package-Docker:
91+
name: 'Package Docker'
92+
needs: Release
93+
runs-on: ubuntu-20.04
94+
permissions:
95+
contents: write
96+
packages: write
97+
env:
98+
os: ubuntu-20.04
99+
target: x86_64-unknown-linux-gnu
100+
steps:
101+
- name: Checkout code
102+
uses: actions/checkout@v2
103+
104+
- name: Setup Kani Dependencies
105+
uses: ./.github/actions/setup
106+
with:
107+
os: ubuntu-20.04
108+
109+
- name: 'Build release bundle'
110+
run: |
111+
cargo run -p make-kani-release -- ${{ needs.Release.outputs.version }}
112+
cargo package -p kani-verifier
113+
114+
- name: 'Login to GitHub Container Registry'
115+
uses: docker/login-action@v2
116+
with:
117+
registry: ghcr.io
118+
username: ${{ github.repository_owner }}
119+
password: ${{ secrets.GITHUB_TOKEN }}
120+
121+
- name: 'Set lower case owner name. Needed for docker push.'
122+
run: |
123+
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}
124+
env:
125+
OWNER: '${{ github.repository_owner }}'
126+
127+
- name: Build and push
128+
uses: docker/build-push-action@v3
129+
with:
130+
context: .
131+
file: scripts/ci/Dockerfile.bundle-release-20-04
132+
push: true
133+
github-token: ${{ secrets.GITHUB_TOKEN }}
134+
tags: |
135+
ghcr.io/${{ env.OWNER_LC }}/kani-${{ env.os }}:${{ needs.Release.outputs.version }}
136+
ghcr.io/${{ env.OWNER_LC }}/kani-${{ env.os }}:latest
137+
labels: |
138+
org.opencontainers.image.source=${{ github.repositoryUrl }}
139+
org.opencontainers.image.version=${{ needs.Release.outputs.version }}
140+
org.opencontainers.image.licenses=Apache-2.0 OR MIT
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright Kani Contributors
2+
# SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
# Docker image for Kani GitHub Package release ubuntu-20-04.
5+
6+
FROM ubuntu:20.04
7+
ENV DEBIAN_FRONTEND=noninteractive \
8+
DEBCONF_NONINTERACTIVE_SEEN=true \
9+
PATH="/root/.cargo/bin:${PATH}"
10+
WORKDIR /tmp/kani
11+
COPY ./kani-*-x86_64-unknown-linux-gnu.tar.gz ./kani-latest-x86_64-unknown-linux-gnu.tar.gz
12+
# Very awkward glob (not regex!) to get `kani-verifier-*` and not `kani-verifier-*.crate`
13+
COPY ./target/package/kani-verifier-*[^e] ./kani-verifier
14+
15+
# Install Kani and dependencies. We will install the required
16+
# toolchain by running an empty cargo command inside kani release
17+
# directory. Rustup is purged for space.
18+
19+
RUN apt-get update && \
20+
apt-get install -y python3 python3-pip curl ctags && \
21+
curl -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none && \
22+
(cd kani-verifier/; cargo) && \
23+
rustup default $(rustup toolchain list | awk '{ print $1 }') && \
24+
cargo install --path ./kani-verifier && \
25+
cargo-kani setup --use-local-bundle ./kani-latest-x86_64-unknown-linux-gnu.tar.gz && \
26+
apt-get clean && \
27+
rm -rf /tmp/kani/* /root/.rustup/toolchains/*/share

0 commit comments

Comments
 (0)