Skip to content

fixing the script for new input lines #92

fixing the script for new input lines

fixing the script for new input lines #92

Workflow file for this run

name: Tests
on:
push:
branches: [ 'newforms', 'composite_level', 'main' ]
pull_request_target:
jobs:
build_matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- id: set-matrix
run: |
matrix=$((
# echo '{ "os" : ["ubuntu-latest", "macos-latest"],'
echo '{ "os" : ["ubuntu-latest"],'
echo '"target" : ['
ls -1 Tests | sed -r 's/^([^,]*)(,?)$/"\1"\2/' | paste -sd "," -
echo " ],"
echo '"include" : [{"pkg_man": "sudo apt-get", "os": "ubuntu-latest"},'
# echo '{"pkg_man" : "brew", "os": "macos-latest"},'
echo '{"ip_cmd" : "sudo ip link add dumdum type dummy && sudo ifconfig dumdum ", "os": "ubuntu-latest"},'
# echo '{"ip_cmd" : "sudo ifconfig lo0 ", "os" : "macos-latest"},'
echo '{"magma_url" : "MAGMA_URL", "os": "ubuntu-latest"},'
# echo '{"magma_url" : "MAGMA_URL_MACOS", "os" : "macos-latest"},'
# echo '{"add_pkgs": "mpfr gmp pari iproute2mac || brew link --overwrite python@3.11", "os": "macos-latest" },'
echo '{"add_pkgs": "libgmp-dev libmpfr-dev libtool-bin libpari-dev", "os": "ubuntu-latest"}'
echo ' ]}'
) | jq -c .)
echo $matrix
echo $matrix | jq .
echo "matrix=$matrix" >> $GITHUB_OUTPUT
check-matrix:
runs-on: ubuntu-latest
needs: build_matrix
steps:
- name: Install json2yaml
run: |
sudo npm install -g json2yaml
- name: Check matrix definition
run: |
matrix='${{needs.build_matrix.outputs.matrix}}'
echo $matrix
echo $matrix | jq .
echo $matrix | json2yaml
has_access:
runs-on: ubuntu-latest
outputs:
has_access: ${{ steps.my-key.outputs.has_access }}
steps:
- id: my-key
env:
MAGMA_URL: ${{ secrets.MAGMA_URL }}
if: "${{ env.MAGMA_URL != '' }}"
run: |
echo "has_access=true" >> $GITHUB_OUTPUT
has_access_macos:
runs-on: macos-latest
outputs:
has_access_macos: ${{ steps.my-key.outputs.has_access_macos }}
steps:
- id: my-key
env:
MAGMA_URL_MACOS: ${{ secrets.MAGMA_URL_MACOS }}
if: "${{ env.MAGMA_URL_MACOS != '' }}"
run: |
echo "has_access_macos=true" >> $GITHUB_OUTPUT
check-has_access:
runs-on: ubuntu-latest
needs: has_access
steps:
- name: Check has_access definition
run: |
echo ${{needs.has_access.outputs.has_access}}
check-has_access_macos:
runs-on: macos-latest
needs: has_access_macos
steps:
- name: Check has_access_macos definition
run: |
echo ${{needs.has_access_macos.outputs.has_access_macos}}
printjob:
name: print event
runs-on: ubuntu-latest
if: false
steps:
- name: dump github context
env:
github_context: ${{ tojson(github) }}
run: |
echo "$github_context"
test:
runs-on: ${{ matrix.os }}
name: Run tests
needs: [has_access, has_access_macos, build_matrix]
if: (needs.has_access.outputs.has_access == 'true') && (needs.has_access_macos.outputs.has_access_macos == 'true')
strategy:
fail-fast: false
matrix: ${{fromJson(needs.build_matrix.outputs.matrix)}}
steps:
- name: Check user permission
id: check
uses: assaferan/action-has-permission@master
with:
required-permission: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Stop workflow for users with no write access
if: "! steps.check.outputs.has-permission"
run: |
echo "Sorry! Your permissions are insufficient."
false
- name: The user has write access
if: "steps.check.outputs.has-permission"
run: |
echo "The user has write access"
- name: Checkout for a push event
uses: actions/checkout@v3
if: ${{ github.event_name == 'push' }}
- name: Checkout for a PR event
uses: actions/checkout@v3
if: ${{ github.event_name == 'pull_request_target' }}
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Cache magma
uses: actions/cache@v3
id: magmacache
env:
# Increase this value to reset cache when MAGMA_URL changes
CACHE_NUMBER: 2.27-6
with:
path: |
./magma
key:
${{ env.CACHE_NUMBER }} ${{ matrix.os }}
- name: Install magma
env:
MAGMA_URL: ${{ secrets.MAGMA_URL }}
MAGMA_URL_MACOS: ${{ secrets.MAGMA_URL_MACOS }}
shell: bash
if: steps.magmacache.outputs.cache-hit != 'true'
run: |
wget "$${{ matrix.magma_url }}" -O magma.tar.gz --quiet
tar xf magma.tar.gz
- name: Install dependencies
run: |
${{ matrix.pkg_man }} update
${{ matrix.pkg_man }} install autoconf automake libtool ${{ matrix.add_pkgs }}
- name: Check magma pass file
run: |
export MAGMAPASSFILE="./magma/magmapassfile"
chmod +r ./magma/magmapassfile
ls -l ./magma/magmapassfile
echo $MAGMAPASSFILE
- name: Create dummy network device
shell: bash
run: |
${{ matrix.ip_cmd }} hw ether `./magma/magma -d | grep "Valid MAC addresses" -A1 | tail -n1`
echo | ./magma/magma
- name: Build
run: |
./autogen.sh
./configure
make
- name: Run tests
shell: bash
run: |
mkdir -p data
./magma/magma -b target:=${{matrix.target}} exitsignal:="" run_tests.m