Skip to content

Commit

Permalink
chore: Update CI (#179)
Browse files Browse the repository at this point in the history
This adds caching to the CI and release workflows, updates task outputs to use `$GITHUB_ENV` instead of `::set-env` et al, and makes a couple things more consistent.
  • Loading branch information
adamspofford-dfinity authored Mar 20, 2023
1 parent e551359 commit 866283b
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 19 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,26 @@ jobs:
steps:
- uses: actions/checkout@master

- if: ${{ contains(matrix.os, 'windows') }}
shell: bash
run: echo 'VCPKG_ROOT=C:\vcpkg' >> $GITHUB_ENV
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
${{ env.VCPKG_ROOT }}
key: ${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.rust }}-ci-1

- name: Install dependencies (windows only)
if: matrix.os == 'windows-latest'
if: ${{ contains(matrix.os, 'windows') }}
shell: bash
run: |
vcpkg integrate install
vcpkg install openssl:x64-windows-static-md
echo "::set-env OPENSSL_DIR 'C:\Tools\vcpkg\installed\x64-windows-static-md'"
echo "::set-env OPENSSL_STATIC Yes"
env:
VCPKG_ROOT: 'C:\vcpkg'
echo "OPENSSL_DIR=C:\vcpkg\installed\x64-windows-static-md" >> $GITHUB_ENV
echo "OPENSSL_STATIC=Yes" >> $GITHUB_ENV
- uses: actions-rs/toolchain@v1
with:
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ jobs:
binary_path: ["target/release"]
steps:
- uses: actions/checkout@master

- uses: actions/cache@v3
with:
path: |
~/.cargo/git
~/.cargo/registry
target
key: ${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.rust }}-ci-1

- uses: actions-rs/toolchain@v1
with:
Expand All @@ -42,7 +50,11 @@ jobs:
steps:
- uses: actions/checkout@v1
- id: set-matrix
run: echo "::set-output name=matrix::$(scripts/workflows/e2e-matrix.py)"
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "matrix<<$EOF" >> $GITHUB_OUTPUT
scripts/workflows/e2e-matrix.py >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
test:
runs-on: ${{ matrix.os }}
Expand All @@ -62,17 +74,17 @@ jobs:
- name: Setup quill binary
run: chmod +x /usr/local/bin/quill
- name: Provision Darwin
if: contains(matrix.os, 'macos')
if: ${{ contains(matrix.os, 'macos') }}
run: bash scripts/workflows/provision-darwin.sh
- name: Provision Linux
if: contains(matrix.os, 'ubuntu')
if: ${{ contains(matrix.os, 'ubuntu') }}
run: bash scripts/workflows/provision-linux.sh
- name: Prepare environment
run: |
echo "archive=$(pwd)/e2e/archive" >> "$GITHUB_ENV"
echo "assets=$(pwd)/e2e/assets" >> "$GITHUB_ENV"
echo "utils=$(pwd)/e2e/utils" >> "$GITHUB_ENV"
export
export -p
- name: Run e2e test
run: timeout 2100 bats "e2e/$E2E_TEST"

Expand Down
29 changes: 19 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,48 +39,57 @@ jobs:
steps:
- uses: actions/checkout@master

- if: ${{ contains(matrix.os, 'windows') }}
shell: bash
run: echo 'VCPKG_ROOT=C:\vcpkg' >> $GITHUB_ENV
- uses: actions/cache@v3
with:
path: |
~/.cargo/git
~/.cargo/registry
${{ env.VCPKG_ROOT }}
key: ${{ matrix.os }}-cargo-${{ matrix.rust }}-release-1

- name: Install dependencies (windows only)
if: matrix.name == 'windows'
if: ${{ contains(matrix.os, 'windows')
shell: bash
run: |
vcpkg integrate install
vcpkg install openssl:x64-windows-static-md
echo "::set-env OPENSSL_DIR 'C:\Tools\vcpkg\installed\x64-windows-static-md'"
echo "::set-env OPENSSL_STATIC Yes"
env:
VCPKG_ROOT: 'C:\vcpkg'
echo "OPENSSL_DIR=C:\vcpkg\installed\x64-windows-static-md" >> $GITHUB_ENV
echo "OPENSSL_STATIC=Yes" >> $GITHUB_ENV
- name: Install toolchain (Linux static)
if: matrix.name == 'linux'
if: ${{ matrix.name == 'linux' }}
uses: mariodfinity/rust-musl-action@master
with:
args: make ${{ matrix.make_target }}
- name: Install toolchain (ARM)
if: matrix.name == 'arm'
if: ${{ matrix.name == 'arm' }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
target: arm-unknown-linux-gnueabihf
- name: Install toolchain (Non-linux)
if: matrix.name != 'linux' && matrix.name != 'arm'
if: ${{ matrix.name != 'linux' && matrix.name != 'arm' }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true

- name: Cross build
if: matrix.name == 'arm'
if: ${{ matrix.name == 'arm' }}
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --target arm-unknown-linux-gnueabihf --features static-ssl --profile release-arm --locked

- name: Make
if: matrix.name != 'linux' && matrix.name != 'arm'
if: ${{ matrix.name != 'linux' && matrix.name != 'arm' }}
run: make ${{ matrix.make_target }}

- name: Upload binaries to release
Expand Down

0 comments on commit 866283b

Please sign in to comment.