PR Build #204
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
# | |
# SPDX-License-Identifier: Apache-2.0 | |
# | |
--- | |
name: PR Build | |
on: | |
pull_request: | |
branches-ignore: | |
- gh-pages | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
jobs: | |
build_collection: | |
name: Build collection | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Use Python 3.9 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.9 | |
- name: Install Python dependencies | |
run: pip install -Ur requirements.txt | |
- name: Build collection artifact | |
run: | | |
VERSION=$(yq -r .version galaxy.yml) | |
ansible-galaxy collection build | |
mv hyperledger-fabric_ansible_collection-${VERSION}.tar.gz hyperledger-fabric_ansible_collection.tar.gz | |
- name: Install collection | |
run: | | |
VERSION=$(yq -r .version galaxy.yml) | |
ansible-galaxy collection install hyperledger-fabric_ansible_collection.tar.gz | |
- name: Lint collection | |
run: | | |
flake8 . | |
ansible-lint | |
shellcheck tutorial/*.sh | |
yamllint . | |
- name: Publish collection | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Collection | |
path: hyperledger-fabric_ansible_collection.tar.gz | |
build_documentation: | |
name: Build documentation | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Use Python 3.9 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.9 | |
- name: Install Python dependencies | |
run: pip install -Ur requirements.txt | |
- name: Build documentation | |
run: | | |
cd docs | |
make | |
cd .. | |
tar cf documentation.tar.gz docs/build | |
- name: Publish documentation | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Documentation | |
path: documentation.tar.gz | |
build_docker_image: | |
name: Build Docker image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Use Python 3.9 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.9 | |
- name: Install Python dependencies | |
run: pip install -Ur requirements.txt | |
- name: Build Docker image | |
run: | | |
VERSION=$(yq -r .version galaxy.yml) | |
docker build -t hyperledger-labs/fabric-ansible-collection:${VERSION} . | |
docker tag hyperledger-labs/fabric-ansible-collection:${VERSION} hyperledger-labs/fabric-ansible-collection:latest | |
docker save hyperledger-labs/fabric-ansible-collection:${VERSION} hyperledger-labs/fabric-ansible-collection:latest | gzip -c > image.tar.gz | |
- name: Publish Docker image | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Docker image | |
path: image.tar.gz |