feat: follow best practices with regards to naming .env files #1229
Workflow file for this run
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: CLI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
permissions: | |
contents: read | |
jobs: | |
build: | |
name: Build and test ${{ matrix.os }} ${{ matrix.arch }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
os: [linux, darwin, windows] | |
arch: [amd64, arm64] | |
exclude: | |
- os: windows | |
arch: arm64 | |
env: | |
VAULT_VERSION: "1.1.3" | |
VAULT_TOKEN: "root" | |
VAULT_ADDR: "http://127.0.0.1:8200" | |
steps: | |
- name: Set up Go 1.21 | |
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | |
with: | |
go-version: '1.21' | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Vendor Go Modules | |
run: make vendor | |
- name: Ensure clean working tree | |
run: git diff --exit-code | |
- name: Build Linux and Darwin | |
if: matrix.os != 'windows' | |
run: GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -o sops-${{ matrix.os }}-${{ matrix.arch }}-${{ github.sha }} -v ./cmd/sops | |
- name: Build Windows | |
if: matrix.os == 'windows' | |
run: GOOS=${{ matrix.os }} go build -o sops-${{ matrix.os }}-${{ github.sha }} -v ./cmd/sops | |
- name: Import test GPG keys | |
run: for i in 1 2 3 4 5; do gpg --import pgp/sops_functional_tests_key.asc && break || sleep 15; done | |
- name: Test | |
run: make test | |
- name: Upload artifact for Linux and Darwin | |
if: matrix.os != 'windows' | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
with: | |
name: sops-${{ matrix.os }}-${{ matrix.arch }}-${{ github.sha }} | |
path: sops-${{ matrix.os }}-${{ matrix.arch }}-${{ github.sha }} | |
- name: Upload artifact for Windows | |
if: matrix.os == 'windows' | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
with: | |
name: sops-${{ matrix.os }}-${{ github.sha }} | |
path: sops-${{ matrix.os }}-${{ github.sha }} | |
test: | |
name: Functional tests | |
runs-on: ubuntu-latest | |
needs: [build] | |
env: | |
VAULT_VERSION: "1.1.3" | |
VAULT_TOKEN: "root" | |
VAULT_ADDR: "http://127.0.0.1:8200" | |
steps: | |
- name: Install rustup | |
run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain 1.70.0 | |
- name: Check out code | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | |
with: | |
name: sops-linux-amd64-${{ github.sha }} | |
- name: Move SOPS binary | |
run: mv sops-linux-amd64-${{ github.sha }} ./functional-tests/sops | |
- name: Make SOPS binary executable | |
run: chmod +x ./functional-tests/sops | |
- name: Download Vault | |
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/ | |
- name: Start Vault server | |
run: vault server -dev -dev-root-token-id="$VAULT_TOKEN" & | |
- name: Enable Vault KV | |
run: vault secrets enable -version=1 kv | |
- name: Import test GPG keys | |
run: for i in 1 2 3 4 5; do gpg --import pgp/sops_functional_tests_key.asc && break || sleep 15; done | |
- name: Run tests | |
run: cargo test | |
working-directory: ./functional-tests |