Update docker & tests #8
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
#? CV_project/.github/workflows/unit-tests.yml | |
--- | |
name: unit tests | |
on: | |
push: | |
paths: | |
- api/** | |
- .github/workflows/unit-tests.yml | |
branches: | |
- main | |
pull_request: | |
paths: | |
- api/** | |
- .github/workflows/unit-tests.yml | |
branches: | |
- main | |
workflow_dispatch: {} | |
jobs: | |
unit-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v4 | |
- name: set up go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.23.1 | |
- name: verify go installation | |
run: | | |
echo -e '\033[94;1m * * * 🔗 pwd = '$(pwd) '\n\033[94;1m * * * 🐹 Go version' | |
go version | |
- name: install dependencies | |
working-directory: ./api | |
run: | | |
echo -e '\033[94;1m * * * 🔗 pwd = '$(pwd) '\n\033[94;1m * * * 🧰 Install dependencies' | |
go mod tidy | |
- name: install wkhtmltopdf | |
run: | | |
echo -e '\033[94;1m * * * 🎨 Installing wkhtmltopdf' | |
sudo apt-get install -qq -y software-properties-common > /dev/null | |
sudo add-apt-repository -y ppa:apt-fast/stable > /dev/null | |
sudo apt-get install -qq -y wkhtmltopdf > /dev/null | |
- name: run unit tests | |
working-directory: ./api | |
run: | | |
echo -e '\033[94;1m * * * 🔗 pwd = '$(pwd) '\n\033[94;1m * * * ⭐ Run unit tests' | |
go test -v ./... | |
- name: cache go modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('api/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- |