-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update containers and github actions workflows
* Add Ubuntu 22.04 container configuration * Split distro worfklows * Add reusable build-and-test workflow * Update README badges
- Loading branch information
Showing
9 changed files
with
251 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Copyright 2024, Giordano Salvador | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
name: Build-and-test | ||
|
||
on: | ||
|
||
workflow_call: | ||
branches: [ "main" ] | ||
inputs: | ||
build_mode: | ||
description: Build optimization level | ||
required: true | ||
default: debug | ||
type: choice | ||
options: | ||
- debug | ||
- release | ||
distro: | ||
description: OS distribution name | ||
required: true | ||
type: string | ||
os_ver: | ||
description: OS distribution version | ||
required: true | ||
type: string | ||
os: | ||
description: OS string identifier | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
|
||
build-and-test: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
|
||
- name: Checkout source | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build source container | ||
run: | | ||
docker build \ | ||
-f container/Containerfile.${{ env.DISTRO }}${{ env.OS_VER }} \ | ||
-t ${{ env.OS }}-calcc-${{ inputs.build_mode }} \ | ||
${{ inputs.build_mode == 'release' && '--build-arg=BUILD_MODE=--release' || '' }} \ | ||
. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright 2024, Giordano Salvador | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
name: Fedora 40 | ||
|
||
on: | ||
|
||
workflow_dispatch: | ||
branches: [ "main" ] | ||
paths: | ||
- .github/actions/build-and-test/action.yaml | ||
inputs: | ||
build_mode: | ||
description: Build optimization level | ||
required: true | ||
default: debug | ||
type: choice | ||
options: | ||
- debug | ||
- release | ||
|
||
jobs: | ||
|
||
run: | ||
env: | ||
DISTRO: fedora | ||
OS_VER: 40 | ||
OS: fedora-40 | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
|
||
- name: Checkout source | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build and test | ||
uses: ./.github/actions/build-and-test | ||
with: | ||
build_mode: debug | ||
distro: ${{ env.DISTRO }} | ||
os_ver: ${{ env.OS_VER }} | ||
os: ${{ env.OS }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright 2024, Giordano Salvador | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
name: Ubuntu 22.04 | ||
|
||
on: | ||
|
||
workflow_dispatch: | ||
branches: [ "main" ] | ||
paths: | ||
- .github/actions/build-and-test/action.yaml | ||
inputs: | ||
build_mode: | ||
description: Build optimization level | ||
required: true | ||
default: debug | ||
type: choice | ||
options: | ||
- debug | ||
- release | ||
|
||
jobs: | ||
|
||
run: | ||
env: | ||
DISTRO: ubuntu | ||
OS_VER: 22 | ||
OS: ubuntu-2204 | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
|
||
- name: Checkout source | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build and test | ||
uses: ./.github/actions/build-and-test | ||
with: | ||
build_mode: debug | ||
distro: ${{ env.DISTRO }} | ||
os_ver: ${{ env.OS_VER }} | ||
os: ${{ env.OS }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright 2024, Giordano Salvador | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
name: Ubuntu 24.04 | ||
|
||
on: | ||
|
||
workflow_dispatch: | ||
branches: [ "main" ] | ||
paths: | ||
- .github/actions/build-and-test/action.yaml | ||
inputs: | ||
build_mode: | ||
description: Build optimization level | ||
required: true | ||
default: debug | ||
type: choice | ||
options: | ||
- debug | ||
- release | ||
|
||
jobs: | ||
|
||
run: | ||
env: | ||
DISTRO: ubuntu | ||
OS_VER: 24 | ||
OS: ubuntu-2404 | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
|
||
- name: Checkout source | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build and test | ||
uses: ./.github/actions/build-and-test | ||
with: | ||
build_mode: debug | ||
distro: ${{ env.DISTRO }} | ||
os_ver: ${{ env.OS_VER }} | ||
os: ${{ env.OS }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,10 @@ Author/Maintainer: Giordano Salvador <[email protected]> | |
|
||
# Description (calcc language) | ||
|
||
[![Ubuntu 22.04](https://github.com/e3m3/calcc-rust/actions/workflows/ubuntu-2204.yaml/badge.svg?event=workflow_dispatch)](https://github.com/e3m3/calcc-rust/actions/workflows/ubuntu-2204.yaml) | ||
[![Ubuntu 24.04](https://github.com/e3m3/calcc-rust/actions/workflows/ubuntu-2404.yaml/badge.svg?event=workflow_dispatch)](https://github.com/e3m3/calcc-rust/actions/workflows/ubuntu-2204.yaml) | ||
[![Fedora 40](https://github.com/e3m3/calcc-rust/actions/workflows/fedora-40.yaml/badge.svg?event=workflow_dispatch)](https://github.com/e3m3/calcc-rust/actions/workflows/fedora-40.yaml) | ||
|
||
Learning [Rust][1] [[1]] by implementing the calc langauge using the [llvm-sys][2] [[2]] crate. | ||
Implements the calc language, inspired by the [C++][3] [[3]] implementation presented by Macke and Kwan in [[4]] and [[5]]. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM docker.io/ubuntu:24.04 | ||
FROM docker.io/ubuntu:22.04 | ||
|
||
LABEL maintainer="Giordano Salvador <[email protected]>" | ||
USER root | ||
|
@@ -10,29 +10,39 @@ ENV SSL_CONF_TMP=/etc/apt/apt.conf.d/99_tmp_ssl-verify-off.conf | |
ENV SED_HTTPS='s%http://(.*archive|security).ubuntu.com%https://mirrors.edge.kernel.org%g' | ||
|
||
RUN echo 'Acquire::https::Verify-Peer "false";' >${SSL_CONF_TMP} && \ | ||
sed --in-place=.orig --regexp-extended ${SED_HTTPS} /etc/apt/sources.list.d/* && \ | ||
sed --in-place=.orig --regexp-extended ${SED_HTTPS} /etc/apt/sources.list && \ | ||
apt-get update && apt-get install ca-certificates -y && \ | ||
rm ${SSL_CONF_TMP} | ||
|
||
RUN apt-get update && apt-get upgrade -y | ||
RUN apt-get install -y libstdc++-14-dev gcc llvm llvm-dev clang rustup python3-pip python3-venv | ||
RUN apt-get install -y libstdc++-12-dev gcc python3-pip python3-venv curl git | ||
RUN apt-get clean | ||
|
||
ENV PYTHON_VENV_PATH=/root/.python/venv | ||
RUN python3 -m venv ${PYTHON_VENV_PATH} | ||
ENV PATH=${PYTHON_VENV_PATH}/bin:${PATH} | ||
RUN pip install lit | ||
|
||
ENV SPACK_GIT=https://github.com/spack/spack | ||
ENV SPACK_VER=v0.22.1 | ||
ENV SPACK_HOME=/root/spack | ||
ENV SPACK_SETUP=${SPACK_HOME}/share/spack/setup-env.sh | ||
ENV LLVM_VER=18.1.3 | ||
|
||
RUN git clone --recursive --branch ${SPACK_VER} ${SPACK_GIT} ${SPACK_HOME} | ||
RUN . ${SPACK_SETUP} && spack install llvm@${LLVM_VER} +clang | ||
|
||
ENV RUST_CHANNEL=stable | ||
ENV RUSTUP_HOME=/root/.rustup | ||
ENV TOOLCHAIN=${RUST_CHANNEL}-x86_64-unknown-linux-gnu | ||
ENV CARGO_ENV=/root/.cargo/env | ||
|
||
RUN curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -o rustup-boostrap.sh && \ | ||
sh rustup-boostrap.sh -y | ||
|
||
RUN rustup set auto-self-update disable | ||
RUN rustup toolchain install ${RUST_CHANNEL} | ||
RUN rustup override set ${RUST_CHANNEL} | ||
ENV PATH=${RUSTUP_HOME}/toolchains/${TOOLCHAIN}/bin:${PATH} | ||
ENV PATH=${RUSTUP_HOME}/toolchains/${TOOLCHAIN}/libexec:${PATH} | ||
ENV LD_LIBRARY_PATH=${RUSTUP_HOME}/toolchains/${TOOLCHAIN}/lib:${LD_LIBRARY_PATH} | ||
RUN . ${SPACK_SETUP} && . ${CARGO_ENV} && rustup update | ||
RUN . ${SPACK_SETUP} && . ${CARGO_ENV} && rustup toolchain install ${RUST_CHANNEL} | ||
RUN . ${SPACK_SETUP} && . ${CARGO_ENV} && rustup override set ${RUST_CHANNEL} | ||
|
||
RUN mkdir -p ${PROJECT_DIR} | ||
RUN mkdir -p ${PROJECT_DIR}/src | ||
|
@@ -48,5 +58,5 @@ COPY tests ${PROJECT_DIR}/tests/ | |
ARG BUILD_MODE= | ||
|
||
WORKDIR ${PROJECT_DIR} | ||
RUN cargo build --verbose ${BUILD_MODE} | ||
RUN cargo test --verbose ${BUILD_MODE} -- --nocapture | ||
RUN . ${SPACK_SETUP} && . ${CARGO_ENV} && cargo build --verbose ${BUILD_MODE} | ||
RUN . ${SPACK_SETUP} && . ${CARGO_ENV} && cargo test --verbose ${BUILD_MODE} -- --nocapture |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
FROM docker.io/ubuntu:24.04 | ||
|
||
LABEL maintainer="Giordano Salvador <[email protected]>" | ||
USER root | ||
|
||
ENV TERM=xterm-256color | ||
ENV PROJECT_DIR=${HOME}/project | ||
|
||
ENV SSL_CONF_TMP=/etc/apt/apt.conf.d/99_tmp_ssl-verify-off.conf | ||
ENV SED_HTTPS='s%http://(.*archive|security).ubuntu.com%https://mirrors.edge.kernel.org%g' | ||
|
||
RUN echo 'Acquire::https::Verify-Peer "false";' >${SSL_CONF_TMP} && \ | ||
sed --in-place=.orig --regexp-extended ${SED_HTTPS} /etc/apt/sources.list.d/* && \ | ||
apt-get update && apt-get install ca-certificates -y && \ | ||
rm ${SSL_CONF_TMP} | ||
|
||
RUN apt-get update && apt-get upgrade -y | ||
RUN apt-get install -y libstdc++-14-dev gcc llvm llvm-dev clang rustup python3-pip python3-venv | ||
RUN apt-get clean | ||
|
||
ENV PYTHON_VENV_PATH=/root/.python/venv | ||
RUN python3 -m venv ${PYTHON_VENV_PATH} | ||
ENV PATH=${PYTHON_VENV_PATH}/bin:${PATH} | ||
RUN pip install lit | ||
|
||
ENV RUST_CHANNEL=stable | ||
ENV RUSTUP_HOME=/root/.rustup | ||
ENV TOOLCHAIN=${RUST_CHANNEL}-x86_64-unknown-linux-gnu | ||
|
||
RUN rustup set auto-self-update disable | ||
RUN rustup toolchain install ${RUST_CHANNEL} | ||
RUN rustup override set ${RUST_CHANNEL} | ||
ENV PATH=${RUSTUP_HOME}/toolchains/${TOOLCHAIN}/bin:${PATH} | ||
ENV PATH=${RUSTUP_HOME}/toolchains/${TOOLCHAIN}/libexec:${PATH} | ||
ENV LD_LIBRARY_PATH=${RUSTUP_HOME}/toolchains/${TOOLCHAIN}/lib:${LD_LIBRARY_PATH} | ||
|
||
RUN mkdir -p ${PROJECT_DIR} | ||
RUN mkdir -p ${PROJECT_DIR}/src | ||
RUN mkdir -p ${PROJECT_DIR}/tests | ||
|
||
COPY Cargo.toml ${PROJECT_DIR}/ | ||
COPY rust-toolchain.toml ${PROJECT_DIR}/ | ||
COPY LICENSE ${PROJECT_DIR}/ | ||
COPY README.md ${PROJECT_DIR}/ | ||
COPY src ${PROJECT_DIR}/src/ | ||
COPY tests ${PROJECT_DIR}/tests/ | ||
|
||
ARG BUILD_MODE= | ||
|
||
WORKDIR ${PROJECT_DIR} | ||
RUN cargo build --verbose ${BUILD_MODE} | ||
RUN cargo test --verbose ${BUILD_MODE} -- --nocapture |