Skip to content

Commit 9a1c90f

Browse files
authored
Merge pull request #3837 from gizmoguy/ci-improvements
Rework faucet release and test CI jobs
2 parents 0b5c19c + be72c92 commit 9a1c90f

File tree

18 files changed

+61
-68
lines changed

18 files changed

+61
-68
lines changed

.github/workflows/release-debian.yml

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ jobs:
1212
debian-package:
1313
name: "Build debian packages"
1414
runs-on: ubuntu-latest
15+
environment:
16+
name: "release"
1517
container:
1618
image: "ubuntu:bionic"
1719
steps:
@@ -54,6 +56,8 @@ jobs:
5456
image: "ubuntu:focal"
5557
options: --privileged
5658
needs: debian-package
59+
permissions:
60+
contents: write
5761
steps:
5862
- name: Install dependencies
5963
run: |
@@ -68,54 +72,52 @@ jobs:
6872
cd images/vm/
6973
./build-faucet-vm.sh
7074
- name: Upload release asset
71-
id: upload-release-asset
72-
uses: actions/upload-release-asset@v1
73-
env:
74-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
uses: svenstaro/upload-release-action@v2
7576
with:
76-
upload_url: ${{ github.event.release.upload_url }}
77-
asset_path: ./images/vm/faucet-amd64-${{ github.event.release.tag_name }}.qcow2
77+
repo_token: ${{ secrets.GITHUB_TOKEN }}
78+
tag: ${{ github.ref }}
79+
overwrite: true
80+
file: ./images/vm/faucet-amd64-${{ github.event.release.tag_name }}.qcow2
7881
asset_name: faucet-amd64-${{ github.event.release.tag_name }}.qcow2
79-
asset_content_type: application/octet-stream
8082

8183
rpi-image:
8284
name: "Build raspberry pi image"
8385
runs-on: ubuntu-latest
84-
container:
85-
image: "ubuntu:bionic"
86-
options: --privileged
8786
needs: debian-package
87+
permissions:
88+
contents: write
8889
steps:
8990
- name: Install dependencies
9091
run: |
91-
dpkg --add-architecture i386
92-
apt-get update
93-
apt-get -y upgrade
94-
apt-get install -y coreutils quilt parted qemu-user-static:i386 debootstrap zerofree zip dosfstools libarchive-tools libcap2-bin grep rsync xz-utils file git curl bc xxd kmod binfmt-support
95-
/usr/sbin/update-binfmts --enable
92+
sudo apt-get update
93+
sudo apt-get -y upgrade
94+
sudo apt-get install -y binfmt-support
95+
- name: Prepare build environment
96+
run: |
97+
sudo /usr/sbin/update-binfmts --enable
98+
sudo modprobe nbd
9699
- name: Checkout repo
97100
uses: actions/checkout@v2
98101
- name: Install pi-gen
99102
run: |
100103
cd images/raspbian/
101104
git clone https://github.com/RPi-Distro/pi-gen.git
102-
cd pi-gen
103-
mv ../install-faucet.sh ./stage2/01-sys-tweaks/02-install-faucet.sh
104105
- name: Build image
105106
run: |
106107
cd images/raspbian/pi-gen/
107108
echo "IMG_NAME='faucet_${{ github.event.release.tag_name }}_raspbian'" > config
109+
mkdir ./stage2/04-install-faucet/
110+
mv ../install-faucet.sh ./stage2/04-install-faucet/02-run.sh
111+
rm ./stage2/EXPORT_NOOBS
108112
touch ./stage3/SKIP ./stage4/SKIP ./stage5/SKIP
109113
touch ./stage4/SKIP_IMAGES ./stage5/SKIP_IMAGES
110-
./build.sh
114+
./build-docker.sh
111115
mv ./deploy/image_*_raspbian-lite.zip ./deploy/faucet_${{ github.event.release.tag_name }}_raspbian-lite.zip
112116
- name: Upload release asset
113-
id: upload-release-asset
114-
uses: actions/upload-release-asset@v1
115-
env:
116-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
117+
uses: svenstaro/upload-release-action@v2
117118
with:
118-
upload_url: ${{ github.event.release.upload_url }}
119-
asset_path: ./images/raspbian/pi-gen/deploy/faucet_${{ github.event.release.tag_name }}_raspbian-lite.zip
119+
repo_token: ${{ secrets.GITHUB_TOKEN }}
120+
tag: ${{ github.ref }}
121+
overwrite: true
122+
file: ./images/raspbian/pi-gen/deploy/faucet_${{ github.event.release.tag_name }}_raspbian-lite.zip
120123
asset_name: faucet_${{ github.event.release.tag_name }}_raspbian-lite.zip
121-
asset_content_type: application/zip

.github/workflows/release-docker.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ jobs:
99
faucet-docker-image:
1010
name: "Build faucet docker image"
1111
runs-on: ubuntu-latest
12+
environment:
13+
name: "release"
1214
steps:
1315
- name: Checkout repo
1416
uses: actions/checkout@v2
@@ -37,6 +39,8 @@ jobs:
3739
gauge-docker-image:
3840
name: "Build gauge docker image"
3941
runs-on: ubuntu-latest
42+
environment:
43+
name: "release"
4044
needs: faucet-docker-image
4145
steps:
4246
- name: Checkout repo
@@ -66,6 +70,8 @@ jobs:
6670
rabbitmq-adapter-docker-image:
6771
name: "Build rabbitmq adapter docker image"
6872
runs-on: ubuntu-latest
73+
environment:
74+
name: "release"
6975
steps:
7076
- name: Checkout repo
7177
uses: actions/checkout@v2
@@ -95,6 +101,8 @@ jobs:
95101
faucetagent-adapter-docker-image:
96102
name: "Build faucetagent adapter docker image"
97103
runs-on: ubuntu-latest
104+
environment:
105+
name: "release"
98106
steps:
99107
- name: Checkout repo
100108
uses: actions/checkout@v2

.github/workflows/release-python.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ jobs:
99
python-package:
1010
name: "Build and publish python packages"
1111
runs-on: ubuntu-latest
12+
environment:
13+
name: "release"
1214
steps:
1315
- name: Checkout repo
1416
uses: actions/checkout@v2
@@ -22,4 +24,4 @@ jobs:
2224
uses: pypa/[email protected]
2325
with:
2426
user: __token__
25-
password: ${{ secrets.PYPI_PASSWORD }}
27+
password: ${{ secrets.PYPI_TOKEN }}

.github/workflows/tests-integration.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ jobs:
5858
modprobe openvswitch
5959
modprobe ebtables
6060
ln -s "$(pwd)" /faucet-src
61-
cd /faucet-src/
6261
- if: ${{ env.FILES_CHANGED == 'all' || env.PY_FILES_CHANGED || env.RQ_FILES_CHANGED }}
6362
name: Run sanity tests
6463
run: |
@@ -127,7 +126,6 @@ jobs:
127126
modprobe openvswitch
128127
modprobe ebtables
129128
ln -s "$(pwd)" /faucet-src
130-
cd /faucet-src/
131129
- if: ${{ env.FILES_CHANGED == 'all' || env.PY_FILES_CHANGED || env.RQ_FILES_CHANGED }}
132130
name: Shard tests
133131
run: |

.github/workflows/tests-unit.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ jobs:
5555
uses: actions/setup-python@v2
5656
with:
5757
python-version: ${{ matrix.python-version }}
58+
- if: matrix.python-version == 3.5
59+
name: Upgrade setuptools for python-3.5
60+
run: |
61+
pip3 install --upgrade setuptools
5862
- name: Install dependencies
5963
run: |
6064
./docker/pip_deps.sh
@@ -66,8 +70,7 @@ jobs:
6670
- if: ${{ matrix.python-version == env.CODECOV_PY_VER }}
6771
name: Upload codecov
6872
uses: codecov/codecov-action@v1
69-
# TODO: pytype support for 3.9 coming soon: https://github.com/google/pytype/issues/749
70-
- if: ${{ matrix.python-version != 3.5 && matrix.python-version != 3.9 && (env.FILES_CHANGED == 'all' || env.RQ_FILES_CHANGED || env.PY_FILES_CHANGED) }}
73+
- if: ${{ matrix.python-version != 3.5 && (env.FILES_CHANGED == 'all' || env.RQ_FILES_CHANGED || env.PY_FILES_CHANGED) }}
7174
name: Pytype
7275
run: |
7376
./docker/pip_deps.sh --extra-requirements="codecheck-requirements.txt"

Dockerfile.fuzz-config

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,13 @@ WORKDIR /faucet-src
1111
RUN \
1212
apt-get update && \
1313
apt-get install -y afl cython3 && \
14-
$PIP3 -r pip-requirements.txt && \
15-
$PIP3 setuptools && \
1614
$PIP3 -r requirements.txt && \
1715
$PIP3 -r fuzz-requirements.txt && \
1816
$PIP3 . && \
1917
git clone https://github.com/mininet/mininet && \
2018
cd mininet && \
2119
pip3 install -q .
2220

23-
24-
2521
VOLUME ["/var/log/afl/"]
2622

2723
CMD ["docker/fuzz_config.sh"]

Dockerfile.fuzz-packet

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
FROM faucet/test-base:9.0.0
44

5-
ENV PIP3="pip3 -q --no-cache-dir install --upgrade"
5+
ENV PIP3="pip3 --no-cache-dir install --upgrade"
66
ENV PATH="/venv/bin:$PATH"
77

88
COPY ./ /faucet-src/
@@ -11,8 +11,6 @@ WORKDIR /faucet-src
1111
RUN \
1212
apt-get update && \
1313
apt-get install -y afl cython3 && \
14-
$PIP3 -r pip-requirements.txt && \
15-
$PIP3 setuptools && \
1614
$PIP3 -r requirements.txt && \
1715
$PIP3 -r fuzz-requirements.txt && \
1816
$PIP3 .

adapters/vendors/faucetagent/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,12 @@ ENV GOPATH /go
2323
ENV PATH /go/bin:$PATH
2424

2525
COPY requirements.txt /src/requirements.txt
26-
COPY pip-requirements.txt /src/pip-requirements.txt
2726

2827
RUN for module in gnmi_capabilities gnmi_get gnmi_set gnmi_subscribe gnmi_target; do \
2928
go get github.com/google/gnxi/${module} \
3029
; go install github.com/google/gnxi/${module} \
3130
; done \
3231
&& cd /src \
33-
&& pip3 install --no-cache-dir -r pip-requirements.txt \
3432
&& pip3 install --no-cache-dir -r requirements.txt \
3533
&& git clone https://github.com/faucetsdn/faucetagent \
3634
&& cd faucetagent \

adapters/vendors/faucetagent/pip-requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

adapters/vendors/rabbitmq/Dockerfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ ENV PYTHONUNBUFFERED=0
88
WORKDIR /src
99

1010
COPY requirements.txt requirements.txt
11-
COPY pip-requirements.txt pip-requirements.txt
1211
COPY rabbit.py rabbit.py
1312
COPY test_rabbit.py test_rabbit.py
1413

@@ -17,8 +16,6 @@ RUN apk add --update \
1716
python3-dev \
1817
gcc \
1918
musl-dev \
20-
&& pip3 install --no-cache-dir -r pip-requirements.txt \
21-
&& pip3 install --no-cache-dir --upgrade wheel setuptools \
2219
&& pip3 install --no-cache-dir -r requirements.txt \
2320
# run tests
2421
&& apk add --update pytest \

0 commit comments

Comments
 (0)