mirror of
https://github.com/lowobservable/coax.git
synced 2026-02-13 11:44:36 +00:00
GitHub Actions maintenance
This commit is contained in:
62
.github/workflows/interface2_build.yml
vendored
62
.github/workflows/interface2_build.yml
vendored
@@ -6,67 +6,78 @@ on:
|
||||
- interface2/**
|
||||
- .github/workflows/interface2_build.yml
|
||||
|
||||
# Required, for now, by aws-actions/configure-aws-credentials
|
||||
# Required by aws-actions/configure-aws-credentials for GitHub OIDC.
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test_fpga:
|
||||
name: Test FPGA
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: interface2/fpga
|
||||
name: Test FPGA
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install Icarus Verilog
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install iverilog
|
||||
|
||||
- name: Run tests
|
||||
run: make tests
|
||||
|
||||
build_fpga:
|
||||
name: Build FPGA
|
||||
needs: test_fpga
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: interface2/fpga
|
||||
env:
|
||||
BITSTREAM_CACHE_BUCKET: coax20211004002809282500000001
|
||||
name: Build FPGA
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
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
|
||||
uses: aws-actions/configure-aws-credentials@v3
|
||||
with:
|
||||
role-to-assume: ${{ secrets.AWS_IAM_ROLE }}
|
||||
aws-region: us-east-1
|
||||
- name: Get bitstream source SHA
|
||||
|
||||
- name: Get bitstream cache key
|
||||
run: |
|
||||
BITSTREAM_SOURCE_SHA=$(git log -n 1 --format=%H rtl)
|
||||
BITSTREAM_CACHE_KEY=interface2/fpga/$BITSTREAM_SOURCE_SHA.zip
|
||||
echo Bitstream source SHA is $BITSTREAM_SOURCE_SHA
|
||||
echo "BITSTREAM_SOURCE_SHA=$BITSTREAM_SOURCE_SHA" >> $GITHUB_ENV
|
||||
echo "BITSTREAM_CACHE_KEY=$BITSTREAM_CACHE_KEY" >> $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
|
||||
if aws s3api head-object --bucket ${{ vars.BITSTREAM_CACHE_BUCKET }} --key ${{ env.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'
|
||||
id: aws_ecr_login
|
||||
uses: aws-actions/amazon-ecr-login@v1
|
||||
with:
|
||||
mask-password: 'true'
|
||||
|
||||
- name: Prepare iCEcube2
|
||||
if: env.BITSTREAM_CACHE_EXISTS == 'false'
|
||||
run: |
|
||||
@@ -75,27 +86,31 @@ jobs:
|
||||
docker pull $ICECUBE2_IMAGE
|
||||
env:
|
||||
REGISTRY: ${{ steps.aws_ecr_login.outputs.registry }}
|
||||
|
||||
- name: Build bitstream
|
||||
if: env.BITSTREAM_CACHE_EXISTS == 'false'
|
||||
run: make rtl
|
||||
env:
|
||||
ICECUBE2_MAC_ADDRESS: ${{ secrets.ICECUBE2_MAC_ADDRESS }}
|
||||
|
||||
- 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}
|
||||
aws s3 cp cache.zip s3://${{ vars.BITSTREAM_CACHE_BUCKET }}/${{ env.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
|
||||
aws s3 cp s3://${{ vars.BITSTREAM_CACHE_BUCKET }}/${{ env.BITSTREAM_CACHE_KEY }} cache.zip
|
||||
unzip cache.zip
|
||||
rm cache.zip
|
||||
|
||||
- name: Attach bitstream
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: fpga_bitstream
|
||||
path: |
|
||||
@@ -103,31 +118,38 @@ jobs:
|
||||
interface2/fpga/rtl/top_timing_report.txt
|
||||
|
||||
build_firmware:
|
||||
name: Build Firmware
|
||||
needs: build_fpga
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: interface2/firmware
|
||||
name: Build Firmware
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python 3.8
|
||||
uses: actions/setup-python@v2
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.8
|
||||
|
||||
- name: Install PlatformIO
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install platformio
|
||||
|
||||
- name: Download bitstream
|
||||
uses: actions/download-artifact@v2
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: fpga_bitstream
|
||||
path: interface2/fpga/rtl
|
||||
|
||||
- name: Build firmware
|
||||
run: pio run
|
||||
|
||||
- name: Attach firmware
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: firmware
|
||||
path: interface2/firmware/.pio/build/default/firmware.bin
|
||||
|
||||
16
.github/workflows/pycoax_build.yml
vendored
16
.github/workflows/pycoax_build.yml
vendored
@@ -8,30 +8,38 @@ on:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: pycoax
|
||||
name: Build
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python 3.8
|
||||
uses: actions/setup-python@v2
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.8
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install pylint build
|
||||
pip install -r requirements.txt
|
||||
|
||||
- name: Run linter
|
||||
run: pylint -E coax
|
||||
|
||||
- name: Run unit tests
|
||||
run: ./run_unit_tests.sh
|
||||
|
||||
- name: Build packages
|
||||
run: python -m build
|
||||
|
||||
- name: Attach packages
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: dist
|
||||
path: pycoax/dist/
|
||||
|
||||
Reference in New Issue
Block a user