Skip to content

Commit

Permalink
Add Makefile, tweak actions (#135)
Browse files Browse the repository at this point in the history
- Add Makefile with dev tasks
- Clean up action files, remove unnecessary names
- Rename `deno` workflow to `ci`
  • Loading branch information
silverwind authored Jul 13, 2024
1 parent 65c2402 commit 59bb8f2
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 19 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/deno.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
name: Deno

on:
push:
branches: ["main"]
Expand All @@ -12,14 +10,11 @@ permissions:
jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
- run: deno fmt --check
- run: deno lint
- run: shopt -s globstar; deno check src/**/*.ts
- run: deno test -A
- run: make lint
- run: make test
env:
BACKPORTER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BACKPORTER_GITEA_FORK: GiteaBot/gitea
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/deploy-to-fly.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: Deploy to Fly
on:
push:
branches: ["main"]

jobs:
deploy:
name: Deploy proxy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
name: Build Docker image

on: ["pull_request"]

env:
Expand All @@ -12,17 +10,14 @@ jobs:
contents: read
packages: write
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
- uses: docker/metadata-action@v4
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}
tags: |
Expand All @@ -35,8 +30,7 @@ jobs:
type=ref,event=pr
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push
uses: docker/build-push-action@v4
- uses: docker/build-push-action@v4
with:
push: false
tags: ${{ steps.meta.outputs.tags }}
Expand Down
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
SRC_FILES := $(shell find src -type f -name '*.ts')

@PHONY: lint
lint:
@deno lint --quiet
@deno fmt --quiet --check
@deno check --quiet $(SRC_FILES)

@PHONY: fmt
fmt:
@deno fmt --quiet

@PHONY: test
test:
@deno test --quiet -A
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ deno run --allow-net --allow-env --allow-run --allow-sys src/webhook.ts
This will spin up a web server on port 8000. You can then set up a GitHub
webhook on `/trigger` to run this bot.

## Development

- `make fmt` runs the formatter
- `make lint` runs the linter and checks formatting and types
- `make test` runs the tests

## Contributing

Contributions are welcome!
Expand Down

0 comments on commit 59bb8f2

Please sign in to comment.