From b683dd8571747801a43e22652df32072408571a4 Mon Sep 17 00:00:00 2001 From: moslem-asaad Date: Sat, 22 Feb 2025 18:49:23 +0200 Subject: [PATCH] build env --- .github/workflows/build.yml | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..651f2394d3 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,44 @@ +name: Build and Test + +on: + push: + branches: [ main, dev ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Go environment + uses: actions/setup-go@v3 + with: + go-version: '1.19' + + - name: Install dependencies + run: go mod download + + - name: Run unit tests + run: go test ./... -v + + - name: Run linting + run: | + go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest + golangci-lint run + + - name: Build Docker image + run: | + docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/gitea:latest . + + - name: Log in to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Push Docker image + run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/gitea:latest