-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (45 loc) · 1.2 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: CI/CD Pipeline
on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]
jobs:
test-and-build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 flake8-import-order
pip install -e ".[test]"
- name: Run flake8
run: |
flake8 . --count --statistics \
--select=E,W,F,I \
--show-source
- name: Run pytest
run: |
pytest tests/
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract branch name
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ncsa/downscaled-climate-data:${{ env.BRANCH_NAME }}