-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Use the new mithro/actions-includes for common functionality. - Refactor common functionality into their own include actions. Signed-off-by: Tim 'mithro' Ansell <[email protected]>
- Loading branch information
Showing
18 changed files
with
1,831 additions
and
165 deletions.
There are no files selected for viewing
10 changes: 9 additions & 1 deletion
10
.github/workflows/checkout/action.yaml → .github/actions/checkout/action.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Copyright (C) 2021 The SymbiFlow Authors. | ||
# | ||
# Use of this source code is governed by a ISC-style | ||
# license that can be found in the LICENSE file or at | ||
# https://opensource.org/licenses/ISC | ||
# | ||
# SPDX-License-Identifier: ISC | ||
|
||
name: Download and run tests | ||
description: "Download the tests from GitHub and run them." | ||
|
||
runs: | ||
using: "includes" | ||
|
||
steps: | ||
|
||
- name: Smoke Test - Run fasm tool | ||
run: | | ||
fasm --help | ||
- name: Smoke Test - Import fasm module | ||
shell: python | ||
run: | | ||
import fasm | ||
- name: Smoke Test - Print fasm version info | ||
includes-script: fasm-version.py | ||
|
||
- name: Getting the tests | ||
includes-script: get-tests.sh | ||
|
||
- name: List Tests | ||
shell: bash | ||
run: | | ||
echo "::group::Top directory" | ||
ls -l tests | ||
echo "::endgroup::" | ||
echo "::group::Files found" | ||
find tests -type f | sort | ||
echo "::endgroup::" | ||
- name: Run Tests | ||
shell: bash | ||
run: | | ||
cd tests | ||
python test_simple.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env python | ||
|
||
import fasm.version | ||
|
||
l = [] | ||
|
||
print() | ||
print(' FASM library version info') | ||
print('='*75) | ||
|
||
kl = max(len(k) for k in dir(fasm.version)) | ||
for k in dir(fasm.version): | ||
if '__' in k: | ||
continue | ||
v = getattr(fasm.version, k) | ||
if isinstance(v, str) and '\n' in v: | ||
l.append((k,v)) | ||
else: | ||
print(" {!s}: {!r}".format(k.rjust(kl), v)) | ||
|
||
for k, v in l: | ||
print() | ||
print(k) | ||
print('-'*75) | ||
print(v) | ||
print('-'*75) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
if [ -d tests ]; then | ||
echo "::group::Using existing tests" | ||
ls -l tests | ||
echo "::endgroup::" | ||
else | ||
echo "::group::Event info" | ||
cat ${GITHUB_EVENT_PATH} | ||
echo "::endgroup::" | ||
echo "::group::GitHub info" | ||
echo "GITHUB_REPOSITORY: ${GITHUB_REPOSITORY}" | ||
echo " GITHUB_ACTOR: ${GITHUB_ACTOR}" | ||
echo " GITHUB_REF: ${GITHUB_REF}" | ||
echo " GITHUB_BASE_REF: ${GITHUB_BASE_REF}" | ||
echo " GITHUB_HEAD_REF: ${GITHUB_HEAD_REF}" | ||
echo " GITHUB_SHA: ${GITHUB_SHA}" | ||
echo "::endgroup::" | ||
echo "::group::Downloading tests from ${GITHUB_REPOSITORY}" | ||
set -x | ||
mkdir .checkout-tests | ||
cd .checkout-tests | ||
git init | ||
git config core.sparseCheckout true | ||
if [ -f .git/info/sparse-checkout ]; then | ||
rm .git/info/sparse-checkout | ||
fi | ||
echo "tests/*" >> .git/info/sparse-checkout | ||
echo "examples/*" >> .git/info/sparse-checkout | ||
git remote add origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git | ||
git fetch --all | ||
git remote -v | ||
if [ ! -z "${GITHUB_REF}" ]; then | ||
git fetch --refmap='' origin ${GITHUB_REF}:refs/remotes/origin/merge || true | ||
fi | ||
if [ ! -z "${GITHUB_BASE_REF}" ]; then | ||
git fetch --refmap='' origin refs/heads/${GITHUB_BASE_REF}:refs/remotes/origin/base || true | ||
fi | ||
if [ ! -z "${GITHUB_HEAD_REF}" ]; then | ||
git fetch --refmap='' origin refs/heads/${GITHUB_HEAD_REF}:refs/remotes/origin/head || true | ||
fi | ||
git remote show origin | ||
git branch -v -a | ||
|
||
git show-ref ${GITHUB_SHA} | ||
git rev-parse --verify 'sha^${GITHUB_SHA}' | ||
git fetch -q https://github.com/SymbiFlow/fasm.git ${GITHUB_SHA} | ||
git rev-parse FETCH_HEAD | ||
git checkout ${GITHUB_SHA} | ||
for i in *; do | ||
cp -rvf $i .. | ||
done | ||
cd .. | ||
echo "::endgroup::" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Copyright (C) 2021 The SymbiFlow Authors. | ||
# | ||
# Use of this source code is governed by a ISC-style | ||
# license that can be found in the LICENSE file or at | ||
# https://opensource.org/licenses/ISC | ||
# | ||
# SPDX-License-Identifier: ISC | ||
|
||
name: "Publish packages into PyPI" | ||
description: "Check the packages and then publish packages onto Test and real versions." | ||
inputs: | ||
type: | ||
description: 'Type of packages to publish to PyPi.' | ||
required: true | ||
root_repo: | ||
description: 'Repository name that should be publishing packages to PyPi.' | ||
required: true | ||
root_branch: | ||
description: 'Default branch to publish packages from.' | ||
required: true | ||
default: refs/heads/master | ||
|
||
runs: | ||
using: "includes" | ||
|
||
steps: | ||
- name: ✔︎ Check 📦 | ||
run: | | ||
for WHEEL in dist/*.whl; do | ||
echo | ||
echo "::group::Checking $WHEEL" | ||
echo | ||
python -m zipfile --list $WHEEL | ||
echo | ||
auditwheel show $WHEEL | ||
echo | ||
twine check $WHEEL | ||
echo | ||
echo "::endgroup::" | ||
done | ||
- name: 📤 Publish ${{ inputs.type }} to Test PyPI | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TEST_PASSWORD }} | ||
if: env.TWINE_PASSWORD != null | ||
run: | | ||
twine upload --skip-existing --verbose --repository testpypi dist/* | ||
- name: 📤 Publish source to PyPI | ||
if: | | ||
(github.ref == inputs.root_branch) && | ||
(github.event_name != 'pull_request') && | ||
(github.repository == inputs.root_repo) && | ||
env.TWINE_PASSWORD != null | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
twine upload dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Copyright (C) 2017-2021 The SymbiFlow Authors. | ||
# | ||
# Use of this source code is governed by a ISC-style | ||
# license that can be found in the LICENSE file or at | ||
# https://opensource.org/licenses/ISC | ||
# | ||
# SPDX-License-Identifier: ISC | ||
|
||
# Set up a Python environment to run the actions_include tool on. | ||
ENV_DIR = venv | ||
PYTHON = $(ENV_DIR)/bin/python3 | ||
ACTIVATE = source $(ENV_DIR)/bin/activate; | ||
|
||
env: requirements.txt | ||
rm -rf $(ENV_DIR) | ||
virtualenv --copies $(ENV_DIR) | ||
$(ACTIVATE) pip install -r $< | ||
touch --reference=$< $(PYTHON) | ||
|
||
.PHONY: env | ||
|
||
$(PYTHON): requirements.txt | ||
make env | ||
|
||
# Generate the output files | ||
SRC_YAML = $(wildcard *.yml) | ||
OUT_YAML = $(addprefix ../workflows/,$(SRC_YAML)) | ||
|
||
../workflows/%.yml: %.yml | $(PYTHON) | ||
@echo | ||
@echo Updating $@ | ||
@echo ------------------------------------------------ | ||
$(ACTIVATE) python -m actions_includes $< $@ | ||
@echo ------------------------------------------------ | ||
|
||
update: | ||
@for F in $(SRC_YAML); do touch $$F; done | ||
make build | ||
|
||
build: $(OUT_YAML) | $(PYTHON) | ||
@true | ||
|
||
info: | ||
@echo 'Output files: $(OUT_YAML)' | ||
|
||
.PHONY: info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright (C) 2017-2021 The SymbiFlow Authors. | ||
# | ||
# Use of this source code is governed by a ISC-style | ||
# license that can be found in the LICENSE file or at | ||
# https://opensource.org/licenses/ISC | ||
# | ||
# SPDX-License-Identifier: ISC | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
name: Functionality | ||
jobs: | ||
|
||
functionality: | ||
runs-on: ubuntu-20.04 | ||
|
||
strategy: | ||
matrix: | ||
antlr_runtime_type: [static, shared] | ||
include: | ||
- { python-version: 3.5, TOXENV: py35 } | ||
- { python-version: 3.6, TOXENV: py36 } | ||
- { python-version: 3.7, TOXENV: py37 } | ||
- { python-version: 3.8, TOXENV: py38 } | ||
- { python-version: 3.9, TOXENV: py39 } | ||
fail-fast: false | ||
|
||
name: Functionality on Python ${{ matrix.python-version }} (with ${{ matrix.antlr_runtime_type}} antlr) | ||
|
||
steps: | ||
- includes: /system-setup | ||
with: | ||
development-tools: true | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Run Tests | ||
run: | | ||
ANTLR4_RUNTIME_TYPE=${{ matrix.antlr_runtime_type }} tox -e ${{ matrix.TOXENV }} |
Oops, something went wrong.