Tp 35 easyjson #88
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: BogoSort_2024_2 Deploy | |
on: | |
push: | |
branches: [main, develop, 'TP-*'] | |
pull_request: | |
branches: [main, develop, 'TP-*'] | |
jobs: | |
run-linters: | |
name: run-linters | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into directory | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.23 | |
id: go | |
- name: Install required dependencies | |
run: go mod tidy | |
- name: Run linter | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: latest | |
working-directory: . | |
args: -c ./.golangci.yaml | |
run-tests: | |
name: run-tests | |
needs: run-linters | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.23' | |
- name: Get Dependencies | |
run: go get ./... | |
- name: Build Application | |
run: go build ./... | |
- name: Run Tests | |
run: go test ./... -v | |
deploy: | |
name: Deploy to Server | |
if: github.ref == 'refs/heads/TP-34_add_ci' | |
needs: [run-linters, run-tests] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to Server | |
uses: appleboy/ssh-action@v0.1.3 | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.PRIVATE_KEY }} | |
debug: true | |
script: | | |
cd /home/${{ secrets.USERNAME }}/server/back | |
git checkout develop | |
git fetch && git pull | |
sudo docker-compose build | |
sudo docker-compose down | |
sudo docker-compose up -d --build --remove-orphans | |