@@ -3,12 +3,13 @@ name: CLI
33on :
44 push :
55 branches :
6- - develop
7- - master
6+ - main
87 pull_request :
98 branches :
10- - develop
11- - master
9+ - main
10+
11+ permissions :
12+ contents : read
1213
1314jobs :
1415 build :
@@ -26,40 +27,52 @@ jobs:
2627 VAULT_TOKEN : " root"
2728 VAULT_ADDR : " http://127.0.0.1:8200"
2829 steps :
29- - name : Install dependencies
30- run : sudo apt-get update && sudo apt-get install git -y
3130 - name : Set up Go 1.20
32- uses : actions/setup-go@v3
31+ uses : actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
3332 with :
3433 go-version : ' 1.20'
3534 id : go
35+
3636 - name : Check out code into the Go module directory
37- uses : actions/checkout@v3
38- - uses : actions/cache@v3
37+ uses : actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
38+
39+ - uses : actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
3940 with :
4041 path : ~/go/pkg/mod
4142 key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
4243 restore-keys : |
4344 ${{ runner.os }}-go-
45+
46+ - name : Vendor Go Modules
47+ run : make vendor
48+
49+ - name : Ensure clean working tree
50+ run : git diff --exit-code
51+
4452 - name : Build Linux and Darwin
4553 if : matrix.os != 'windows'
4654 run : GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -o sops-${{ matrix.os }}-${{ matrix.arch }}-${{ github.sha }} -v ./cmd/sops
55+
4756 - name : Build Windows
4857 if : matrix.os == 'windows'
4958 run : GOOS=${{ matrix.os }} go build -o sops-${{ matrix.os }}-${{ github.sha }} -v ./cmd/sops
59+
5060 - name : Import test GPG keys
5161 run : for i in 1 2 3 4 5; do gpg --import pgp/sops_functional_tests_key.asc && break || sleep 15; done
62+
5263 - name : Test
5364 run : make test
65+
5466 - name : Upload artifact for Linux and Darwin
5567 if : matrix.os != 'windows'
56- uses : actions/upload-artifact@v3
68+ uses : actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
5769 with :
5870 name : sops-${{ matrix.os }}-${{ matrix.arch }}-${{ github.sha }}
5971 path : sops-${{ matrix.os }}-${{ matrix.arch }}-${{ github.sha }}
72+
6073 - name : Upload artifact for Windows
6174 if : matrix.os == 'windows'
62- uses : actions/upload-artifact@v3
75+ uses : actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
6376 with :
6477 name : sops-${{ matrix.os }}-${{ github.sha }}
6578 path : sops-${{ matrix.os }}-${{ github.sha }}
@@ -74,23 +87,32 @@ jobs:
7487 steps :
7588 - name : Install rustup
7689 run : curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain 1.70.0
90+
7791 - name : Check out code
78- uses : actions/checkout@v3
79- - uses : actions/download-artifact@v3
92+ uses : actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
93+
94+ - uses : actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
8095 with :
8196 name : sops-linux-amd64-${{ github.sha }}
97+
8298 - name : Move SOPS binary
8399 run : mv sops-linux-amd64-${{ github.sha }} ./functional-tests/sops
100+
84101 - name : Make SOPS binary executable
85102 run : chmod +x ./functional-tests/sops
103+
86104 - name : Download Vault
87105 run : curl -O "https://releases.hashicorp.com/vault/${VAULT_VERSION}/vault_${VAULT_VERSION}_linux_amd64.zip" && sudo unzip vault_${VAULT_VERSION}_linux_amd64.zip -d /usr/local/bin/
106+
88107 - name : Start Vault server
89108 run : vault server -dev -dev-root-token-id="$VAULT_TOKEN" &
109+
90110 - name : Enable Vault KV
91111 run : vault secrets enable -version=1 kv
112+
92113 - name : Import test GPG keys
93114 run : for i in 1 2 3 4 5; do gpg --import pgp/sops_functional_tests_key.asc && break || sleep 15; done
115+
94116 - name : Run tests
95117 run : cargo test
96118 working-directory : ./functional-tests
0 commit comments