diff --git a/.gitea/workflows/01_test.yaml b/.gitea/workflows/01_test.yaml new file mode 100644 index 0000000..bc53a23 --- /dev/null +++ b/.gitea/workflows/01_test.yaml @@ -0,0 +1,22 @@ +name: Unit Tests with docker compose +on: [push, pull_request] + +jobs: + unit-test: + container: + image: docker:dind + volumes: + - /usr/local/share/.cache/yarn:/usr/local/share/.cache/yarn + - /var/lib/docker/image:/var/lib/docker/image + - /var/lib/docker/overlay2:/var/lib/docker/overlay2 + steps: + - name: Starting docker daemon + run: docker-init -- dockerd --host=unix:///var/run/docker.sock & + - name: Installing necessary packages + run: apk add yarn git curl bash + - name: Check out repository code + uses: actions/checkout@v3 + - name: Install project dependencies + run: yarn install --frozen-lockfile --ignore-scripts + - name: Run docker-compose + run: docker compose down -v && docker compose run bot-api bun test \ No newline at end of file diff --git a/.gitea/workflows/02_build.yaml b/.gitea/workflows/02_build.yaml new file mode 100644 index 0000000..26e5b0e --- /dev/null +++ b/.gitea/workflows/02_build.yaml @@ -0,0 +1,52 @@ +name: Build image +on: + push: + branches: + - main + - build + tags: + - v* + +jobs: + build: + container: + image: docker:dind + volumes: + - /data/.cache/act:/data/.cache/act + - /var/lib/docker/image:/var/lib/docker/image + - /var/lib/docker/overlay2:/var/lib/docker/overlay2 + steps: + - name: Starting docker daemon + run: docker-init -- dockerd --host=unix:///var/run/docker.sock & + - name: Installing necessary packages + run: apk add nodejs git curl bash + - name: Checkout + uses: actions/checkout@v3 + - name: Docker meta + id: meta + uses: https://github.com/docker/metadata-action@v4 + with: + # list of Docker images to use as base name for tags + images: | + git.fai.st/fedi-image-bot/fe-middleware + # generate Docker tags based on the following events/attributes + tags: | + type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} + type=ref,event=branch + type=semver,pattern={{raw}} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to fai.st docker registry + uses: docker/login-action@v2 + with: + registry: git.fai.st + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_PASS }} + - name: Build and push + uses: docker/build-push-action@v4 + with: + platforms: linux/amd64,linux/arm64 + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/bunfig.toml b/bunfig.toml new file mode 100644 index 0000000..252e66d --- /dev/null +++ b/bunfig.toml @@ -0,0 +1,4 @@ +[install.lockfile] +# whether to save a non-Bun lockfile alongside bun.lockb +# only "yarn" is supported +print = "yarn"