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

Add CI #6

Merged
merged 2 commits into from
Sep 11, 2024
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
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build and Test

on:
push:
branches:
- main
pull_request:

jobs:
test:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Run test script
run: ./scripts/test.sh

build:
runs-on: ubuntu-latest
needs: test
env:
QUAY_USERNAME: chroot.club+cro_robot_rw
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Build and push container
run: ./scripts/cibuild.sh container


4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
FROM docker.io/rakudo-star:latest

# docker build --build-arg quay_expiration="4w" -t quay.io/your-repo/your-image:tag .
ARG quay_expiration=never
LABEL quay.expires-after=${quay_expiration}

RUN apt-get update -y && \
apt-get install -y uuid-dev libpq-dev libssl-dev unzip build-essential && \
apt-get purge -y
Expand Down
13 changes: 0 additions & 13 deletions deploy.raku

This file was deleted.

25 changes: 0 additions & 25 deletions deployment.yaml

This file was deleted.

34 changes: 34 additions & 0 deletions scripts/cibuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh

set -e

cmd_container () {
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables
tag_version="v1.$(date +%Y%m%d).${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER}"

echo $QUAY_PASSWORD | docker login quay.io -u $QUAY_USERNAME --password-stdin
full_tag="quay.io/chroot.club/cro-website:${tag_version}"
docker build \
--build-arg quay_expiration="8w" \
-t $full_tag

}


if [ -z $1 ]; then
cmd_container
fi

CMD=$1
shift
case $CMD in
container)
cmd_$CMD $@
;;
*)
echo "unknown command $CMD"
exit 1
;;
esac


4 changes: 4 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

zef test .

12 changes: 0 additions & 12 deletions service.yaml

This file was deleted.