Skip to content

Commit

Permalink
Merge pull request #595 from srl-labs/build-once
Browse files Browse the repository at this point in the history
improve cicd by building clab once
  • Loading branch information
hellt committed Aug 25, 2021
2 parents d65cfdc + 0101eea commit 74143e9
Showing 1 changed file with 32 additions and 15 deletions.
47 changes: 32 additions & 15 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,23 @@ jobs:
- "README.md"
- '.github/workflows/cicd.yml'
build-containerlab:
runs-on: ubuntu-20.04
needs: file-changes
if: needs.file-changes.outputs.code == 'true' || startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ${{ env.GOVER }}
- name: Build containerlab
run: go build
# store clab binary as artifact
- uses: actions/upload-artifact@v2
with:
name: containerlab
path: containerlab

unit-test:
runs-on: ubuntu-20.04
needs: file-changes
Expand All @@ -64,17 +81,17 @@ jobs:
runtime: ["docker", "containerd"]
needs:
- unit-test
- build-containerlab
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
- uses: actions/download-artifact@v2
with:
go-version: ${{ env.GOVER }}
- name: Build containerlab
run: go build && sudo mv ./containerlab /usr/bin/containerlab
name: containerlab
- name: Move containerlab to usr/bin
run: sudo mv ./containerlab /usr/bin/containerlab && sudo chmod a+x /usr/bin/containerlab
- uses: actions/setup-python@v2
with:
python-version: "3.8"
Expand All @@ -101,17 +118,17 @@ jobs:
# - "containerd"
needs:
- unit-test
- build-containerlab
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
- uses: actions/download-artifact@v2
with:
go-version: ${{ env.GOVER }}
- name: Build containerlab
run: go build && sudo mv ./containerlab /usr/bin/containerlab
name: containerlab
- name: Move containerlab to usr/bin
run: sudo mv ./containerlab /usr/bin/containerlab && sudo chmod a+x /usr/bin/containerlab
- uses: actions/setup-python@v2
with:
python-version: "3.8"
Expand Down Expand Up @@ -146,17 +163,17 @@ jobs:
# - "containerd"
needs:
- unit-test
- build-containerlab
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
- uses: actions/download-artifact@v2
with:
go-version: ${{ env.GOVER }}
- name: Build containerlab
run: go build && sudo mv ./containerlab /usr/bin/containerlab
name: containerlab
- name: Move containerlab to usr/bin
run: sudo mv ./containerlab /usr/bin/containerlab && sudo chmod a+x /usr/bin/containerlab
- uses: actions/setup-python@v2
with:
python-version: "3.8"
Expand Down

0 comments on commit 74143e9

Please sign in to comment.