-
-
Notifications
You must be signed in to change notification settings - Fork 21
131 lines (123 loc) · 4.16 KB
/
main.yml
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: CI for releases
on:
push:
branches:
- master
jobs:
js-install-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [v18.16.1]
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # 3.0.2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies, Test, and Build
run: |
cd frontend
yarn install --frozen-lockfile --check-files
yarn lint
GENERATE_SOURCEMAP=false yarn build
ls -R
env:
GENERATE_SOURCEMAP: false
CI: true
- name: Upload ReactJS Build
# yamllint disable-line rule:line-length
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # 3.1.0
with:
name: build
path: frontend/build/
python-install-and-test:
runs-on: ubuntu-22.04
env:
PYTHON_VERSION: "3.11"
steps:
- name: Check out the codebase
# yamllint disable-line rule:line-length
uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791 # v3 2.5.0
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python ${{ env.PYTHON_VERSION }}
# yamllint disable-line rule:line-length
uses: actions/setup-python@2c3dd9e7e29afd70cc0950079bde6c979d1f69f9 # 4.3.1
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip' # caching pip dependencies
- name: Cache pip
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # 3.0.11
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('./requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
cd api
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
build-and-push-docker-image:
needs: [js-install-and-test, python-install-and-test]
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # 3.0.2
-
name: Show structure
run: |
ls -R
-
name: Make a dir for ReactJS artifacts
run: |
cd frontend
mkdir build
cd ..
-
name: Download ReactJS artifacts from JS Build
# yamllint disable-line rule:line-length
uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 # 3 .0.0
with:
name: build
path: frontend/build
-
name: Show structure of downloaded files
run: |
ls -R
-
name: Set up QEMU
# yamllint disable-line rule:line-length
uses: docker/setup-qemu-action@8b122486cedac8393e77aa9734c3528886e4a1a8 # 2.0.0
-
name: Set up Docker Buildx
# yamllint disable-line rule:line-length
uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 # 2.0.0
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
# yamllint disable-line rule:line-length
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b # 2.0.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.PAT }}
-
name: Build and push
# yamllint disable-line rule:line-length
uses: docker/build-push-action@c84f38281176d4c9cdb1626ffafcd6b3911b5d94 # 3.1.1
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/386
push: true
tags: |
timothystewart6/techno-broadlink:latest
ghcr.io/techno-tim/techno-broadlink:latest