From 6cf461be60b68b525be5086940ac75f597715372 Mon Sep 17 00:00:00 2001 From: Alie Date: Mon, 29 Jan 2024 13:51:05 +0100 Subject: [PATCH] added workflows --- .dockerignore | 1 + .gitea/workflows/01_test.yaml | 18 ++++++++++++++ .gitea/workflows/02_build.yaml | 44 ++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 .gitea/workflows/01_test.yaml create mode 100644 .gitea/workflows/02_build.yaml diff --git a/.dockerignore b/.dockerignore index 7fba8f6..c8c66cd 100644 --- a/.dockerignore +++ b/.dockerignore @@ -32,3 +32,4 @@ LICENSE README.md config.toml mastodon-data.toml +*.yaml \ No newline at end of file diff --git a/.gitea/workflows/01_test.yaml b/.gitea/workflows/01_test.yaml new file mode 100644 index 0000000..08e56c6 --- /dev/null +++ b/.gitea/workflows/01_test.yaml @@ -0,0 +1,18 @@ +name: Unit Tests with cargo +on: [push, pull_request] + +jobs: + unit-test: + container: + image: rust + steps: + - name: Installing necessary packages + run: apt install nodejs git + - name: Check out repository code + uses: actions/checkout@v3 + - name: Get access token from secret + run: echo -e ${{ secrets.MASTODON_SECRET }} > mastodon-data.toml + - name: Check code + run: cargo check + - name: Run tests + run: cargo test -- --test-threads=1 \ 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..3702ecd --- /dev/null +++ b/.gitea/workflows/02_build.yaml @@ -0,0 +1,44 @@ +name: Build image +on: + push: + branches: + - main + - build + tags: + - v* + +jobs: + build: + container: + image: node:18 + steps: + - 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/bot-api + # 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 }} \ No newline at end of file