mirror of
https://github.com/lowobservable/coax.git
synced 2026-01-12 00:43:00 +00:00
Update GitHub Actions workflows
This commit is contained in:
parent
61179295d4
commit
680e5b108b
25
.github/workflows/build_pycoax.yml
vendored
25
.github/workflows/build_pycoax.yml
vendored
@ -1,25 +0,0 @@
|
||||
name: Build pycoax
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'pycoax/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Set up Python 3.8
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.8
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
working-directory: ./pycoax
|
||||
- name: Run unit tests
|
||||
run: ./run_unit_tests.sh
|
||||
working-directory: ./pycoax
|
||||
117
.github/workflows/interface2_build.yml
vendored
Normal file
117
.github/workflows/interface2_build.yml
vendored
Normal file
@ -0,0 +1,117 @@
|
||||
name: Build interface2
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- interface2/**
|
||||
- .github/workflows/interface2_build.yml
|
||||
|
||||
# Required, for now, by aws-actions/configure-aws-credentials
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build_fpga:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: interface2/fpga
|
||||
env:
|
||||
BITSTREAM_CACHE_BUCKET: coax20211004002809282500000001
|
||||
name: Build FPGA
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
# All history is required to determine the bitstream source SHA, otherwise
|
||||
# it may be unnecessarily rebuilt.
|
||||
fetch-depth: 0
|
||||
- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@master
|
||||
with:
|
||||
role-to-assume: ${{ secrets.AWS_IAM_ROLE }}
|
||||
aws-region: us-east-1
|
||||
- name: Get bitstream source SHA
|
||||
run: |
|
||||
BITSTREAM_SOURCE_SHA=$(git log -n 1 --format=%H .)
|
||||
echo Bitstream source SHA is $BITSTREAM_SOURCE_SHA
|
||||
echo "BITSTREAM_SOURCE_SHA=$BITSTREAM_SOURCE_SHA" >> $GITHUB_ENV
|
||||
- name: Check bitstream cache
|
||||
run: |
|
||||
BITSTREAM_CACHE_KEY=interface2/fpga/${BITSTREAM_SOURCE_SHA}.zip
|
||||
echo "BITSTREAM_CACHE_KEY=$BITSTREAM_CACHE_KEY" >> $GITHUB_ENV
|
||||
if aws s3api head-object --bucket $BITSTREAM_CACHE_BUCKET --key $BITSTREAM_CACHE_KEY; then
|
||||
echo Cached bitstream exists
|
||||
echo "BITSTREAM_CACHE_EXISTS=true" >> $GITHUB_ENV
|
||||
else
|
||||
echo Cached bitstream does not exist
|
||||
echo "BITSTREAM_CACHE_EXISTS=false" >> $GITHUB_ENV
|
||||
fi
|
||||
- name: Login to AWS ECR
|
||||
if: env.BITSTREAM_CACHE_EXISTS == 'false'
|
||||
run: aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $REGISTRY
|
||||
env:
|
||||
REGISTRY: ${{ secrets.AWS_ECR }}
|
||||
- name: Prepare iCEcube2
|
||||
if: env.BITSTREAM_CACHE_EXISTS == 'false'
|
||||
run: |
|
||||
docker pull $REGISTRY/icecube2:latest
|
||||
docker tag $REGISTRY/icecube2:latest icecube2:latest
|
||||
echo $ICECUBE2_MAC_ADDRESS > rtl/.mac_address
|
||||
env:
|
||||
REGISTRY: ${{ secrets.AWS_ECR }}
|
||||
ICECUBE2_MAC_ADDRESS: ${{ secrets.ICECUBE2_MAC_ADDRESS }}
|
||||
- name: Build bitstream
|
||||
if: env.BITSTREAM_CACHE_EXISTS == 'false'
|
||||
run: make rtl
|
||||
- name: Cache bitstream
|
||||
if: env.BITSTREAM_CACHE_EXISTS == 'false'
|
||||
run: |
|
||||
cd rtl
|
||||
zip cache.zip top.bin top_timing_report.txt
|
||||
aws s3 cp cache.zip s3://${BITSTREAM_CACHE_BUCKET}/${BITSTREAM_CACHE_KEY}
|
||||
rm cache.zip
|
||||
- name: Download cached bitstream
|
||||
if: env.BITSTREAM_CACHE_EXISTS == 'true'
|
||||
run: |
|
||||
cd rtl
|
||||
aws s3 cp s3://${BITSTREAM_CACHE_BUCKET}/${BITSTREAM_CACHE_KEY} cache.zip
|
||||
unzip cache.zip
|
||||
rm cache.zip
|
||||
- name: Attach bitstream
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: bitstream
|
||||
path: |
|
||||
interface2/fpga/rtl/top.bin
|
||||
interface2/fpga/rtl/top_timing_report.txt
|
||||
|
||||
build_firmware:
|
||||
needs: build_fpga
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: interface2/firmware
|
||||
name: Build Firmware
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python 3.8
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.8
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install platformio
|
||||
- name: Download bitstream
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: bitstream
|
||||
path: interface2/fpga/rtl
|
||||
- name: Build firmware
|
||||
run: pio run
|
||||
- name: Attach firmware
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: firmware
|
||||
path: interface2/firmware/.pio/build/default/firmware.bin
|
||||
35
.github/workflows/pycoax_build.yml
vendored
Normal file
35
.github/workflows/pycoax_build.yml
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
name: Build pycoax
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- pycoax/**
|
||||
- .github/workflows/pycoax_build.yml
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: pycoax
|
||||
name: Build
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python 3.8
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.8
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install build
|
||||
pip install -r requirements.txt
|
||||
- name: Run unit tests
|
||||
run: ./run_unit_tests.sh
|
||||
- name: Build packages
|
||||
run: python -m build
|
||||
- name: Attach packages
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: dist
|
||||
path: pycoax/dist/
|
||||
@ -1,3 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
python -m unittest discover tests
|
||||
# Display verbose output in CI environment.
|
||||
if [ -n "$CI" ]; then
|
||||
OPTS=-v
|
||||
fi
|
||||
|
||||
python -m unittest discover $OPTS tests
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user