From e119b1badd874200fec648e24f32d3ba97efa17b Mon Sep 17 00:00:00 2001 From: nagdahimanshu Date: Tue, 18 Jun 2024 13:42:17 +0200 Subject: [PATCH] Add workflow file --- .github/workflows/build.yml | 60 ----------------------------------- .github/workflows/docker.yml | 40 ----------------------- .github/workflows/pr.yaml | 32 +++++++++++++++++++ .github/workflows/release.yml | 33 ------------------- Makefile | 2 +- 5 files changed, 33 insertions(+), 134 deletions(-) delete mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/docker.yml create mode 100644 .github/workflows/pr.yaml delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 4561e859..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Build - -on: - push: - branches: [main] - pull_request: - branches: [main] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.17 - - - name: Set up Node.js - uses: actions/setup-node@v2 - with: - node-version: "16" - - - name: Generate - run: go generate -x - - - name: Build - run: go build -v - - - name: Test - run: go test -v ./... - - golangci: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 - with: - go-version: 1.17 - - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - version: latest - - prettier: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: "16" - - - run: yarn install - working-directory: web - - - run: yarn prettier --check 'src/**/*.{css,html,js,svelte}' - working-directory: web diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index f590e1fa..00000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Docker - -on: - push: - branches: [main] - tags: [v*] - pull_request: - branches: [main] - -jobs: - docker: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Docker meta - id: meta - uses: docker/metadata-action@v3 - with: - images: ${{ secrets.DOCKERHUB_USERNAME }}/eth-faucet - tags: | - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v2 - with: - context: . - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml new file mode 100644 index 00000000..2ab51c55 --- /dev/null +++ b/.github/workflows/pr.yaml @@ -0,0 +1,32 @@ +# This workflow will build a golang project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go + +name: 'PR CI' + +on: + pull_request: + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: setup-go + uses: actions/setup-go@v4 + with: + go-version: '1.22' + - name: build + run: make build + - name: golangci-lint + run: make lint + - name: format + run: | + make format + if [ -z "$(git status --untracked-files=no --porcelain)" ]; then + echo "All files formatted" + else + echo "Running format is required" + exit 1 + fi + - name: test + run: make test \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 20cf673b..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: goreleaser - -on: - push: - tags: [v*] - -jobs: - goreleaser: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.17 - - - name: Set up Node.js - uses: actions/setup-node@v2 - with: - node-version: "16" - - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 - with: - distribution: goreleaser - version: latest - args: release --rm-dist - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile index 890d623d..c06e8d39 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ BLUE = \033[1;34m GREEN = \033[1;32m COLOR_END = \033[0;39m -build: build-backend build-frontend +build: build-frontend build-backend build-backend: # Builds the application and create a binary at ./bin/ @echo "$(BLUE)ยป Building $(APP_NAME) application binary... $(COLOR_END)"