Skip to content

Commit

Permalink
Fix github actions (#9)
Browse files Browse the repository at this point in the history
* Fix up github actions with singularity
  • Loading branch information
dhower-qc authored Jul 29, 2024
1 parent c08ea36 commit 2526359
Show file tree
Hide file tree
Showing 9 changed files with 211 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: actions/cache@v3
with:
path: .singularity/image.sif
key: ${{ hashFiles('container.def') }}
key: ${{ hashFiles('container.def', 'bin/.container-tag') }}
- name: Get gems and node files from cache
id: cache-bundle-npm
uses: actions/cache@v3
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/regress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ jobs:
uses: actions/checkout@v4
- name: Setup apptainer
uses: eWaterCycle/[email protected]
- name: Read container tag
run: echo "CONTAINER_TAG=$(cat bin/.container-tag)" >> $GITHUB_ENV
- name: Get container from cache
id: cache-sif
uses: actions/cache@v3
with:
path: .singularity/image${{ env.CONTAINER_TAG }}.sif
path: .singularity/image.sif
key: ${{ hashFiles('container.def', 'bin/.container-tag') }}
- name: Get gems and node files from cache
id: cache-bundle-npm
Expand Down
2 changes: 1 addition & 1 deletion arch/ext/B.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ B:
implies:
- [Zba, 1.0]
- [Zbb, 1.0]
- [Zbc, 1.0]
- [Zbs, 1.0]
description: |
The B standard extension comprises instructions provided by the `Zba`, `Zbb`, and `Zbs` extensions.
Expand Down
38 changes: 38 additions & 0 deletions arch/ext/Zba.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,45 @@ Zba:
of wider elements. The `slli.uw` -- added in this extension -- can be used when the index is to
be interpreted as an unsigned word.
type: unprivileged
company:
name: RISC-V International
url: https://riscv.org
versions:
- version: 1.0
state: ratified
ratification_date: 2021-06
repositories:
- url: https://github.com/riscv/riscv-bitmanip
branch: main
contributors:
- name: Jacob Bachmeyer
- name: Allen Baum
- name: Ari Ben
- name: Alex Bradbury
- name: Steven Brager
- name: Rogier Brussee
- name: Michael Clark
- name: Ken Dockser
- name: Paul Donahue
- name: Dennis Ferguson
- name: Fabian Giesen
- name: John Hauser
- name: Robert Henry
- name: Bruce Holt
- name: Po-wei Huang
- name: Ben Marshall
- name: Rex McCrary
- name: Lee Moore
- name: Jiri Moravec
- name: Samuel Neves
- name: Markus Oberhumer
- name: Christopher Olson
- name: Nils Pipenbrinck
- name: Joseph Rahmeh
- name: Xue Saw
- name: Tommy Thorn
- name: Philipp Tomsich
- name: Avishai Tvila
- name: Andrew Waterman
- name: Thomas Wicki
- name: Claire Wolf
38 changes: 38 additions & 0 deletions arch/ext/Zbb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,45 @@ Zbb:
description: |
Basic bit manipulation
type: unprivileged
company:
name: RISC-V International
url: https://riscv.org
versions:
- version: 1.0
state: ratified
ratification_date: 2021-06
repositories:
- url: https://github.com/riscv/riscv-bitmanip
branch: main
contributors:
- name: Jacob Bachmeyer
- name: Allen Baum
- name: Ari Ben
- name: Alex Bradbury
- name: Steven Brager
- name: Rogier Brussee
- name: Michael Clark
- name: Ken Dockser
- name: Paul Donahue
- name: Dennis Ferguson
- name: Fabian Giesen
- name: John Hauser
- name: Robert Henry
- name: Bruce Holt
- name: Po-wei Huang
- name: Ben Marshall
- name: Rex McCrary
- name: Lee Moore
- name: Jiri Moravec
- name: Samuel Neves
- name: Markus Oberhumer
- name: Christopher Olson
- name: Nils Pipenbrinck
- name: Joseph Rahmeh
- name: Xue Saw
- name: Tommy Thorn
- name: Philipp Tomsich
- name: Avishai Tvila
- name: Andrew Waterman
- name: Thomas Wicki
- name: Claire Wolf
40 changes: 40 additions & 0 deletions arch/ext/Zbc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,47 @@ Zbc:
description: |
Carry-less multiplication is the multiplication in the polynomial ring over GF(2).
type: unprivileged
company:
name: RISC-V International
url: https://riscv.org
versions:
- version: 1.0
state: ratified
ratification_date: 2021-06
repositories:
- url: https://github.com/riscv/riscv-bitmanip
branch: main
contributors:
- name: Jacob Bachmeyer
- name: Allen Baum
- name: Ari Ben
- name: Alex Bradbury
- name: Steven Brager
- name: Rogier Brussee
- name: Michael Clark
- name: Ken Dockser
- name: Paul Donahue
- name: Dennis Ferguson
- name: Fabian Giesen
- name: John Hauser
- name: Robert Henry
- name: Bruce Holt
- name: Po-wei Huang
- name: Ben Marshall
- name: Rex McCrary
- name: Lee Moore
- name: Jiri Moravec
- name: Samuel Neves
- name: Markus Oberhumer
- name: Christopher Olson
- name: Nils Pipenbrinck
- name: Joseph Rahmeh
- name: Xue Saw
- name: Tommy Thorn
- name: Philipp Tomsich
- name: Avishai Tvila
- name: Andrew Waterman
- name: Thomas Wicki
- name: Claire Wolf


52 changes: 52 additions & 0 deletions arch/ext/Zbs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# yaml-language-server: $schema=../../schemas/ext_schema.json

Zbs:
long_name: Single-bit instructions
description: |
The single-bit instructions provide a mechanism to set, clear, invert, or extract a single bit
in a register. The bit is specified by its index
type: unprivileged
company:
name: RISC-V International
url: https://riscv.org
versions:
- version: 1.0
state: ratified
ratification_date: 2021-06
repositories:
- url: https://github.com/riscv/riscv-bitmanip
branch: main
contributors:
- name: Jacob Bachmeyer
- name: Allen Baum
- name: Ari Ben
- name: Alex Bradbury
- name: Steven Brager
- name: Rogier Brussee
- name: Michael Clark
- name: Ken Dockser
- name: Paul Donahue
- name: Dennis Ferguson
- name: Fabian Giesen
- name: John Hauser
- name: Robert Henry
- name: Bruce Holt
- name: Po-wei Huang
- name: Ben Marshall
- name: Rex McCrary
- name: Lee Moore
- name: Jiri Moravec
- name: Samuel Neves
- name: Markus Oberhumer
- name: Christopher Olson
- name: Nils Pipenbrinck
- name: Joseph Rahmeh
- name: Xue Saw
- name: Tommy Thorn
- name: Philipp Tomsich
- name: Avishai Tvila
- name: Andrew Waterman
- name: Thomas Wicki
- name: Claire Wolf


17 changes: 14 additions & 3 deletions bin/build_container
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ ROOT=$(realpath $(dirname $(dirname $BASH_SOURCE[0])))

CONTAINER_TAG=`cat ${ROOT}/bin/.container-tag`

if [ -v GITHUB_ACTIONS ]; then
echo "ACTIONS"
CONTAINER_PATH=${ROOT}/.singularity/image.sif
HOME_PATH=${GITHUB_WORKSPACE}
SINGULARITY_CACHE=--disable-cache
else
CONTAINER_PATH=${ROOT}/.singularity/image-$CONTAINER_TAG.sif
HOME_PATH=${HOME}
SINGULARITY_CACHE=
fi

# uncomment below if you have sudo permission and don't have fakeroot permission
NEED_SUDO=0
cat /etc/subgid | grep "^$(id -u):"
Expand Down Expand Up @@ -54,13 +65,13 @@ echo "Building container..."
if [ ! -d "${ROOT}/.singularity" ]; then
mkdir -p ${ROOT}/.singularity
fi
if [ -e "${ROOT}/.singularity/image.sif" ]; then
rm -f "${ROOT}/.singularity/image.sif"
if [ -e ${CONTAINER_PATH} ]; then
rm -f ${CONTAINER_PATH}
fi

$SUDO singularity build --force \
$FAKEROOT \
${ROOT}/.singularity/image-${CONTAINER_TAG}.sif \
${CONTAINER_PATH} \
${ROOT}/container.def
if [ $? -ne 0 ]; then
echo "Container build failed." 2>&1
Expand Down
39 changes: 26 additions & 13 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,43 @@ cd $ROOT

CONTAINER_TAG=`cat ${ROOT}/bin/.container-tag`

if [ -v GITHUB_ACTIONS ]; then
echo "ACTIONS"
CONTAINER_PATH=${ROOT}/.singularity/image.sif
HOME_PATH=${GITHUB_WORKSPACE}
HOME_OPT="--home ${ROOT}/.home"
SINGULARITY_CACHE=--disable-cache
else
CONTAINER_PATH=${ROOT}/.singularity/image-$CONTAINER_TAG.sif
HOME_PATH=${HOME}
HOME_OPT="--bind ${ROOT}/.home:${HOME_PATH}"
SINGULARITY_CACHE=
fi

if [ ! -d $ROOT/.home ]; then
mkdir $ROOT/.home
fi

if [ ! -f $ROOT/.singularity/image-$CONTAINER_TAG.sif ]; then
if [ ! -f ${CONTAINER_PATH} ]; then
echo "Fetching container..."
if [ ! -d "${ROOT}/.singularity" ]; then
mkdir -p ${ROOT}/.singularity
fi
singularity pull --disable-cache ${ROOT}/.singularity/image-$CONTAINER_TAG.sif oras://docker.io/riscvintl/spec-generator:$CONTAINER_TAG
singularity pull ${SINGULARITY_CACHE} ${CONTAINER_PATH} oras://docker.io/riscvintl/spec-generator:$CONTAINER_TAG
fi

if [ ! -f $ROOT/.bundle/config ]; then
OLDDIR=$PWD
cd $ROOT
singularity run --home ${ROOT}/.home .singularity/image-$CONTAINER_TAG.sif bundle config set --local path ${ROOT}/.home/.gems
singularity run --home ${ROOT}/.home .singularity/image-$CONTAINER_TAG.sif bundle config set --local cache_path ${ROOT}/.home/.cache
singularity run ${HOME_OPT} ${CONTAINER_PATH} bundle config set --local path ${ROOT}/.home/.gems
singularity run ${HOME_OPT} ${CONTAINER_PATH} bundle config set --local cache_path ${ROOT}/.home/.cache
cd $OLDDIR
fi

if [ ! -d $ROOT/.home/.gems ]; then
OLDDIR=$PWD
cd $ROOT
singularity run --home ${ROOT}/.home .singularity/image-$CONTAINER_TAG.sif bundle install
singularity run ${HOME_OPT} ${CONTAINER_PATH} bundle install
cd $OLDDIR
fi

Expand All @@ -39,8 +52,8 @@ fi

if [[ ! -z "$DEVELOPMENT" && $DEVELOPMENT -eq 1 ]]; then
if [ ! -d "${ROOT}/.home/.yard/gem_index"]; then
singularity run --home ${ROOT}/.home .singularity/image-$CONTAINER_TAG.sif bundle exec --gemfile ${ROOT}/Gemfile yard config --gem-install-yri
singularity run --home ${ROOT}/.home .singularity/image-$CONTAINER_TAG.sif bundle exec --gemfile ${ROOT}/Gemfile yard gems
singularity run ${HOME_OPT} ${CONTAINER_PATH} bundle exec --gemfile ${ROOT}/Gemfile yard config --gem-install-yri
singularity run ${HOME_OPT} ${CONTAINER_PATH} bundle exec --gemfile ${ROOT}/Gemfile yard gems
touch ${ROOT}/.stamps/dev_gems
fi
fi
Expand All @@ -64,11 +77,11 @@ if [[ ! -z "$VSCODE" && $VSCODE -eq 1 ]]; then
fi

if [ ! -d ${ROOT}/node_modules ]; then
singularity run --home ${PWD}/.home .singularity/image-$CONTAINER_TAG.sif npm i
singularity run ${HOME_OPT} ${CONTAINER_PATH} npm i
fi

BUNDLE="singularity run --home ${PWD}/.home .singularity/image-$CONTAINER_TAG.sif bundle"
RUBY="singularity run --home ${PWD}/.home .singularity/image-$CONTAINER_TAG.sif bundle exec ruby"
RAKE="singularity run --home ${PWD}/.home .singularity/image-$CONTAINER_TAG.sif bundle exec rake"
NPM="singularity run --home ${PWD}/.home .singularity/image-$CONTAINER_TAG.sif npm"
NPX="singularity run --home ${PWD}/.home .singularity/image-$CONTAINER_TAG.sif npx"
BUNDLE="singularity run ${HOME_OPT} ${CONTAINER_PATH} bundle"
RUBY="singularity run ${HOME_OPT} ${CONTAINER_PATH} bundle exec ruby"
RAKE="singularity run ${HOME_OPT} ${CONTAINER_PATH} bundle exec rake"
NPM="singularity run ${HOME_OPT} ${CONTAINER_PATH} npm"
NPX="singularity run ${HOME_OPT} ${CONTAINER_PATH} npx"

0 comments on commit 2526359

Please sign in to comment.