[ci] Update CI workflows

This commit is contained in:
Laura Hausmann 2024-07-08 04:01:16 +02:00
parent 4f21fd9b91
commit 6b5f74a76f
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
2 changed files with 52 additions and 7 deletions

View file

@ -0,0 +1,47 @@
on:
push:
branches:
- 'dev'
jobs:
test-build:
runs-on: docker
container:
image: iceshrimp.dev/iceshrimp/ci-env:latest
options: --volume /opt/iceshrimp-cache/yarn:/iceshrimp-caches/yarn
services:
database:
image: postgres:15
env:
POSTGRES_PASSWORD: "test"
redis:
image: redis
steps:
- name: Clone repository
run: git clone https://iceshrimp.dev/iceshrimp/iceshrimp.git --branch=${{ github.ref_name }} --depth=1 .
- name: Install build dependencies
run: |
cp -Tr /iceshrimp-caches/yarn .yarn
yarn --immutable
rm -rf /iceshrimp-caches/yarn/* && cp -Tr .yarn /iceshrimp-caches/yarn
- name: Build the shrimp
run: yarn build:debug
- name: Test the shrimp
run: |
cp .config/ci.yml .config/default.yml
yarn run migrate
build-and-push:
runs-on: docker
needs: test-build
container:
image: iceshrimp.dev/iceshrimp/ci-env:latest
options: --volume /root/.docker:/root/.docker
steps:
- name: Clone repository
run: git clone https://iceshrimp.dev/iceshrimp/iceshrimp.git --branch=${{ github.ref_name }} --depth=1 .
- name: Build docker image
shell: bash
run: |
docker login iceshrimp.dev -u ${{ github.actor }} -p ${{ secrets.REGISTRY_TOKEN }}
docker buildx create --name iceshrimp-ci 2>&1 &>/dev/null || true
docker buildx build -t iceshrimp.dev/${GITHUB_REPOSITORY@L}:$GITHUB_REF_NAME --provenance=false --platform=linux/amd64,linux/arm64 --push --builder iceshrimp-ci .
docker buildx prune --keep-storage 20G

View file

@ -1,5 +1,7 @@
on: on:
- push push:
branches-ignore:
- 'dev'
jobs: jobs:
test-build: test-build:
runs-on: docker runs-on: docker
@ -15,19 +17,15 @@ jobs:
image: redis image: redis
steps: steps:
- name: Clone repository - name: Clone repository
run: git clone https://iceshrimp.dev/iceshrimp/iceshrimp.git --branch=${{ github.ref_name }} --depth=1 /iceshrimp run: git clone https://iceshrimp.dev/iceshrimp/iceshrimp.git --branch=${{ github.ref_name }} --depth=1 .
- name: Install build dependencies - name: Install build dependencies
run: | run: |
cd /iceshrimp
cp -Tr /iceshrimp-caches/yarn .yarn cp -Tr /iceshrimp-caches/yarn .yarn
yarn --immutable yarn --immutable
rm -rf /iceshrimp-caches/yarn/* && cp -Tr .yarn /iceshrimp-caches/yarn rm -rf /iceshrimp-caches/yarn/* && cp -Tr .yarn /iceshrimp-caches/yarn
- name: Build the shrimp - name: Build the shrimp
run: | run: yarn build:debug
cd /iceshrimp
yarn build:debug
- name: Test the shrimp - name: Test the shrimp
run: | run: |
cd /iceshrimp
cp .config/ci.yml .config/default.yml cp .config/ci.yml .config/default.yml
yarn run migrate yarn run migrate