Bump golang.org/x/crypto #41
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
name: CICD | |
on: | |
push: | |
paths-ignore: | |
- '*.md' | |
jobs: | |
unit-test: | |
name: Run unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.x | |
if: success() | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ^1.14 | |
id: go | |
- name: Check out code | |
if: success() | |
uses: actions/checkout@v2 | |
- name: Run tests | |
if: success() | |
run: go test -v ./... | |
component-test: | |
name: Run component tests | |
runs-on: ubuntu-latest | |
needs: unit-test | |
steps: | |
- name: Set up Go 1.x | |
if: success() | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ^1.14 | |
id: go | |
- name: Check out code | |
if: success() | |
uses: actions/checkout@v2 | |
- name: Download validation files | |
if: success() | |
env: | |
TD_VALIDATION_JSONSCHEMAS: "conf/wot_td_schema.json,conf/wot_discovery_schema.json" | |
run: | | |
curl https://raw.githubusercontent.com/w3c/wot-thing-description/REC1.0/validation/td-json-schema-validation.json --create-dirs -o conf/wot_td_schema.json | |
curl https://raw.githubusercontent.com/w3c/wot-discovery/main/validation/td-discovery-extensions-json-schema.json --create-dirs -o conf/wot_discovery_schema.json | |
- name: Checkout wot-discovery-testing | |
uses: actions/checkout@v2 | |
with: | |
repository: farshidtz/wot-discovery-testing | |
path: wot-discovery-testing | |
- name: Run tests | |
if: success() | |
env: | |
TD_VALIDATION_JSONSCHEMAS: "conf/wot_td_schema.json,conf/wot_discovery_schema.json" | |
run: | | |
(go run . --conf sample_conf/thing-directory.json && echo) & | |
sleep 10 | |
cd wot-discovery-testing/directory | |
go test --server=http://localhost:8081 | |
- name: Export test report as artifact | |
if: success() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: test-report | |
path: wot-discovery-testing/directory/report.csv | |
build: | |
name: Build and upload snapshots | |
runs-on: ubuntu-latest | |
needs: component-test | |
steps: | |
- name: Set up Go 1.x | |
if: success() | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ^1.14 | |
id: go | |
- name: Check out code | |
if: success() | |
uses: actions/checkout@v2 | |
- name: Prepare Variables | |
id: prepare | |
run: | | |
echo ::set-output name=version::${GITHUB_REF##*/} | |
- name: Cross Compile go | |
if: success() | |
run: | | |
./build.sh | |
mkdir -p output/bin output/conf | |
cp bin/* output/bin | |
cp sample_conf/* wot/wot_td_schema.json output/conf | |
env: | |
NAME: thing-directory | |
VERSION: ${{ steps.prepare.outputs.version }} | |
BUILDNUM: ${{github.run_number}} | |
- name: Upload snapshots | |
if: success() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: snapshots | |
path: output/ | |
package-and-release: | |
name: Upload release assets | |
if: github.ref != 'refs/heads/main' && startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Prepare Variables | |
id: prepare | |
run: | | |
echo ::set-output name=version::${GITHUB_REF##*/} | |
- name: Download snapshot artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: snapshots | |
- name: Create Release | |
if: success() | |
id: release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.prepare.outputs.version }} | |
release_name: ${{ steps.prepare.outputs.version }} | |
body: "Docker image: `ghcr.io/tinyiot/thing-directory:${{ steps.prepare.outputs.version }}`" | |
draft: false | |
prerelease: true | |
- name: Upload release asset windows-amd64.exe | |
if: success() | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.release.outputs.upload_url }} | |
asset_path: bin/thing-directory-windows-amd64.exe | |
asset_name: thing-directory-windows-amd64.exe | |
asset_content_type: application/vnd.microsoft.portable-executable | |
- name: Upload release asset darwin-amd64 | |
if: success() | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.release.outputs.upload_url }} | |
asset_path: bin/thing-directory-darwin-amd64 | |
asset_name: thing-directory-darwin-amd64 | |
asset_content_type: application/octet-stream | |
- name: Upload release asset linux-amd64 | |
if: success() | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.release.outputs.upload_url }} | |
asset_path: bin/thing-directory-linux-amd64 | |
asset_name: thing-directory-linux-amd64 | |
asset_content_type: application/octet-stream | |
- name: Upload release asset linux-arm64 | |
if: success() | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.release.outputs.upload_url }} | |
asset_path: bin/thing-directory-linux-arm64 | |
asset_name: thing-directory-linux-arm64 | |
asset_content_type: application/octet-stream | |
- name: Upload release asset linux-arm | |
if: success() | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.release.outputs.upload_url }} | |
asset_path: bin/thing-directory-linux-arm | |
asset_name: thing-directory-linux-arm | |
asset_content_type: application/octet-stream | |
- name: Upload release asset sample_conf | |
if: success() | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.release.outputs.upload_url }} | |
asset_path: conf/thing-directory.json | |
asset_name: thing-directory.json | |
asset_content_type: application/json | |
docker: | |
name: Build and push docker image | |
runs-on: ubuntu-latest | |
needs: component-test | |
steps: | |
- name: Prepare Variables | |
id: prepare | |
run: | | |
echo ::set-output name=version::${GITHUB_REF##*/} | |
- name: Check out code | |
if: success() | |
uses: actions/checkout@v2 | |
- name: Docker login | |
if: success() | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u USERNAME --password-stdin | |
- name: Build image | |
if: success() | |
run: docker build -t ghcr.io/tinyiot/thing-directory --build-arg version="${{ steps.prepare.outputs.version }}" --build-arg buildnum="${{github.run_number}}" . | |
- name: Push latest docker image | |
if: success() && github.ref == 'refs/heads/main' | |
run: docker push ghcr.io/tinyiot/thing-directory:latest | |
- name: Push tagged docker image | |
if: success() && github.ref != 'refs/heads/main' && startsWith(github.ref, 'refs/tags/') | |
run: | | |
docker tag ghcr.io/tinyiot/thing-directory ghcr.io/tinyiot/thing-directory:${{ steps.prepare.outputs.version }} | |
docker push ghcr.io/tinyiot/thing-directory:${{ steps.prepare.outputs.version }} |