Skip to content

Commit

Permalink
Convert to github actions
Browse files Browse the repository at this point in the history
Signed-off-by: Bryan Hunt <bryan.hunt@microchip.com>
  • Loading branch information
bryan-hunt committed Dec 2, 2020
1 parent 5f69624 commit e981e09
Show file tree
Hide file tree
Showing 15 changed files with 170 additions and 99 deletions.
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Bug report
about: Create a report to help us improve

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Additional context**
Add any other context about the problem here.
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Feature request
about: Suggest an idea for this project

---

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
9 changes: 9 additions & 0 deletions .github/ISSUE_TEMPLATE/product-support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
name: Product Support
about: Questions on product or library configuration and usage

---

For product support please submit a request through the [mySupport portal](https://microchipsupport.force.com/s/) where Microchip's global team of FAEs can work on your use case and questions.

For details on the mySupport Portal or how to use it please see the [instructions for using the mySupport portal](https://microchipsupport.force.com/s/article/How-to-submit-a-case)
104 changes: 104 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Build and deploy wheels to pypi

on:
push:
tags:
- 20*

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macos-latest]

steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.7'

- name: Describe Tag & Branch Name
id: build_names
shell: bash
run: |
echo ::set-output name=TAG_NAME::${GITHUB_REF#refs/tags/}
- name: Install cibuildwheel
run: |
python -m pip install cibuildwheel
- name: Install Visual C++ for Python 2.7
if: runner.os == 'Windows'
run: |
choco install vcpython27 -f -y
- name: Build wheels
shell: bash
run: |
echo $TAG_NAME
cd python
echo $TAG_NAME >VERSION
cp -r ../lib .
cp -r ../third_party .
mkdir app
cp -r ../app/tng app
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD_VERBOSITY: 3
TAG_NAME: ${{ steps.build_names.outputs.TAG_NAME }}

- uses: actions/upload-artifact@v2
with:
path: python/wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.7'

- name: Describe Tag & Branch Name
id: build_names
run: |
echo ::set-output name=TAG_NAME::${GITHUB_REF#refs/tags/}
- name: Build sdist
run: |
echo $TAG_NAME
cd python
echo $TAG_NAME >VERSION
cp -r ../lib .
cp -r ../third_party .
mkdir app
cp -r ../app/tng app
python setup.py sdist
env:
TAG_NAME: ${{ steps.build_names.outputs.TAG_NAME }}

- uses: actions/upload-artifact@v2
with:
path: python/dist/*.tar.gz

upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@master
with:
user: ${{ secrets.pypi_username }}
password: ${{ secrets.pypi_password }}
37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion app/tng/tnglora_cert_def_2_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ extern "C" {
* @{
*/

SHARED_LIB_IMPORT const atcacert_def_t g_tnglora_cert_def_2_device;
ATCA_DLL const atcacert_def_t g_tnglora_cert_def_2_device;

/** @} */

Expand Down
53 changes: 0 additions & 53 deletions appveyor.yml

This file was deleted.

1 change: 1 addition & 0 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ endif()

if(ATCA_BUILD_SHARED_LIBS)
add_definitions(-DATCA_BUILD_SHARED_LIBS)
set(CRYPTOAUTH_SRC ${CRYPTOAUTH_SRC} atca_utils_sizes.c)
endif(ATCA_BUILD_SHARED_LIBS)

add_library(cryptoauth ${CRYPTOAUTH_SRC} ${ATCACERT_DEF_SRC})
Expand Down
4 changes: 4 additions & 0 deletions lib/atca_compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
#define ATCA_UINT16_HOST_TO_LE(x) __builtin_bswap16(x)
#define ATCA_UINT16_LE_TO_HOST(x) __builtin_bswap16(x)
#define ATCA_UINT32_HOST_TO_LE(x) __builtin_bswap32(x)
#define ATCA_UINT16_HOST_TO_BE(x) (x)
#define ATCA_UINT16_BE_TO_HOST(x) (x)
#define ATCA_UINT32_HOST_TO_BE(x) (x)
#define ATCA_UINT32_BE_TO_HOST(x) (x)
#define ATCA_UINT64_HOST_TO_BE(x) (x)
Expand All @@ -45,6 +47,8 @@
#define ATCA_UINT16_HOST_TO_LE(x) (x)
#define ATCA_UINT16_LE_TO_HOST(x) (x)
#define ATCA_UINT32_HOST_TO_LE(x) (x)
#define ATCA_UINT16_HOST_TO_BE(x) __builtin_bswap16(x)
#define ATCA_UINT16_BE_TO_HOST(x) __builtin_bswap16(x)
#define ATCA_UINT32_HOST_TO_BE(x) __builtin_bswap32(x)
#define ATCA_UINT32_BE_TO_HOST(x) __builtin_bswap32(x)
#define ATCA_UINT64_HOST_TO_BE(x) __builtin_bswap64(x)
Expand Down
File renamed without changes.
8 changes: 6 additions & 2 deletions lib/hal/hal_linux_spi_userspace.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ ATCA_STATUS hal_spi_init(void *hal, ATCAIfaceCfg *cfg)
hal_data->ref_ct = 1; // buses are shared, this is the first instance

(void)snprintf(hal_data->spi_file, sizeof(hal_data->spi_file) - 1,
"/dev/spidev%d.%d", cfg->atcaspi.bus, cfg->atcaspi.select_pin);
"/dev/spidev%d.%d", (uint8_t)cfg->atcaspi.bus, (uint8_t)cfg->atcaspi.select_pin);

pHal->hal_data = hal_data;
}
Expand Down Expand Up @@ -263,13 +263,14 @@ ATCA_STATUS hal_spi_wake(ATCAIface iface)
uint8_t csr_reg;
int delay_timeout = (int)cfg->wake_delay;


do
{

status = hal_spi_receive(iface, word_address, &csr_reg, &len);

if (status == ATCA_SUCCESS)
{
#ifdef ATCA_TA100_SUPPORT
/*status bit check in CSR register*/
if ((len == 1) && (((csr_reg >> 1) & 0x03 ) != 0x03))
{
Expand All @@ -282,6 +283,9 @@ ATCA_STATUS hal_spi_wake(ATCAIface iface)

break;
}
#else
break;
#endif

}
/*poll csr register for every 100us*/
Expand Down
2 changes: 1 addition & 1 deletion lib/hal/hal_linux_spi_userspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
// A structure to hold I2C information
typedef struct atcaSPImaster
{
char spi_file[16];
char spi_file[20];
int ref_ct;
} ATCASPIMaster_t;

Expand Down
2 changes: 1 addition & 1 deletion python/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
recursive-include lib *.c *.h atca_config.h.in CMakeLists.txt 90-cryptohid.rules
recursive-include third_party *.c *.h
recursive-include app *.c *.h
include MANIFEST.in setup.py setup.cfg README.md VERSION atca_utils_sizes.c
include MANIFEST.in setup.py setup.cfg README.md VERSION
4 changes: 2 additions & 2 deletions python/cryptoauthlib/atcab.py
Original file line number Diff line number Diff line change
Expand Up @@ -2983,6 +2983,6 @@ def atcab_write_config_counter(counter_id, counter_value):


# Make module import * safe - keep at the end of the file
__all__ = ['atca_aes_cbc_ctx', 'atca_aes_cmac_ctx', 'atca_aes_ctr_ctx',
'atca_aes_gcm_ctx', 'atca_sha256_ctx', 'atca_hmac_sha256_ctx']
__all__ = ['atca_aes_cbc_ctx', 'atca_aes_cmac_ctx', 'atca_aes_ctr_ctx', 'atca_aes_cbcmac_ctx',
'atca_aes_ccm_ctx', 'atca_aes_gcm_ctx', 'atca_sha256_ctx', 'atca_hmac_sha256_ctx']
__all__ += [x for x in dir() if x.startswith(__name__.split('.')[-1])]
8 changes: 6 additions & 2 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@
else:
_sdist_build = False

#python 2 compatibility
try:
FileNotFoundError
except NameError:
FileNotFoundError = IOError

# See if the library is already installed
try:
lib = cdll.LoadLibrary('libcryptoauth.so')
Expand Down Expand Up @@ -158,8 +164,6 @@ def build_extension(self, ext):
if sys.platform.startswith('linux'):
cmake_args += ['-DATCA_HAL_I2C=ON', '-DATCA_HAL_SPI=ON']

cmake_args += ['-DATCACERT_DEF_SRC={}atca_utils_sizes.c'.format(setupdir.replace('\\','/') if _sdist_build else '../test/')]

if not os.path.exists(self.build_temp):
os.makedirs(self.build_temp)

Expand Down

0 comments on commit e981e09

Please sign in to comment.