Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add composite action to CI #392

Merged
merged 33 commits into from Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
39f13f7
added composite action
eike-hass Sep 9, 2021
12c043f
added workflow dispatch for debugging
eike-hass Sep 9, 2021
3792910
change action path
eike-hass Sep 9, 2021
2f78edb
fix action path
eike-hass Sep 9, 2021
957a070
fix action path
eike-hass Sep 9, 2021
a0a4e1f
fix action path
eike-hass Sep 9, 2021
2127932
simplify action for testing
eike-hass Sep 9, 2021
3d8823d
simplify action for testing
eike-hass Sep 9, 2021
1420a7d
readded compley action
eike-hass Sep 9, 2021
df5ac86
added sccache install actions for all platforms
eike-hass Sep 14, 2021
43d3870
fixed inputs path
eike-hass Sep 14, 2021
69f61f2
move actions
eike-hass Sep 14, 2021
c2e9708
move actions
eike-hass Sep 14, 2021
d27eeb8
fixed action name
eike-hass Sep 14, 2021
78414be
fixed action names
eike-hass Sep 14, 2021
2523e6e
Merge branch 'dev' into feat/rework-actions
eike-hass Sep 14, 2021
dab256c
fixed action path
eike-hass Sep 14, 2021
c234c06
reenable build wasm
eike-hass Sep 14, 2021
d16d345
fix action
eike-hass Sep 15, 2021
4ace30f
fix action
eike-hass Sep 15, 2021
b014fdd
Update .github/workflows/build-and-test.yml
eike-hass Sep 16, 2021
18eaaa9
Update .github/workflows/build-and-test.yml
eike-hass Sep 16, 2021
03fdc7b
Update .github/workflows/build-and-test.yml
eike-hass Sep 16, 2021
d447a6a
Update .github/workflows/build-and-test.yml
eike-hass Sep 16, 2021
0f18852
Update .github/workflows/build-and-test.yml
eike-hass Sep 16, 2021
527306d
Update .github/workflows/build-and-test.yml
eike-hass Sep 16, 2021
ef6abb6
Update .github/workflows/build-and-test.yml
eike-hass Sep 16, 2021
4fa508e
Update .github/workflows/build-and-test.yml
eike-hass Sep 16, 2021
92b121f
Update .github/workflows/build-and-test.yml
eike-hass Sep 16, 2021
37e26c0
Update .github/workflows/build-and-test.yml
eike-hass Sep 16, 2021
5abb282
Update .github/workflows/build-and-test.yml
eike-hass Sep 16, 2021
c7f619e
reworked actions
eike-hass Sep 16, 2021
65e08af
Update .github/actions/utils/get-current-date-windows/action.yml
eike-hass Sep 16, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/actions/rust/rust-setup/action.yml
@@ -0,0 +1,72 @@
name: 'rust-setup'
description: 'Prepares a rust environment and relevant caches.'
inputs:
sccache-path:
description: 'Path of the sccache.'
required: true
os:
description: 'OS of the runner, used for cache key construction.'
required: true
job:
description: 'Name of the job, used for cache key construction.'
required: true
current-date:
description: 'Current date, used for cache key construction.'
required: true
target-cache-path:
description: 'Path of the target cache.'
required: false
default: target
runs:
using: "composite"
steps:
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Cache cargo
uses: actions/cache@v2.1.4
with:
# https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
# Add date to the cache to keep it up to date
key: ${{ inputs.os }}-cargo-${{ inputs.job }}-${{ hashFiles('**/Cargo.toml') }}-${{ inputs.current-date }}
# Restore from outdated cache for speed
restore-keys: |
${{ inputs.os }}-cargo-${{ inputs.job }}-${{ hashFiles('**/Cargo.toml') }}-
${{ inputs.os }}-cargo-${{ inputs.job }}-
${{ inputs.os }}-cargo-

# Generate Cargo.lock files for build, sccache cache keys.
# Allows dependencies updated on crates.io between runs to trigger storing an updated cache,
# which hashing Cargo.toml files alone does not.
- name: Cargo update
uses: actions-rs/cargo@v1
with:
command: update

- name: Cache build target
uses: actions/cache@v2.1.4
with:
path: ${{ inputs.target-cache-path }}
# Add date to the cache to keep it up to date
key: ${{ inputs.os }}-target-${{ inputs.job }}-${{ hashFiles('**/Cargo.lock') }}
# Restore from outdated cache for speed
restore-keys: |
${{ inputs.os }}-target-${{ inputs.job }}-
${{ inputs.os }}-target-

- name: Cache sccache
uses: actions/cache@v2.1.6
with:
path: ${{ inputs.sccache-path }}
key: ${{ inputs.os }}-sccache-${{ inputs.job }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ inputs.os }}-sccache-${{ inputs.job }}-
${{ inputs.os }}-sccache-
16 changes: 16 additions & 0 deletions .github/actions/rust/sccache/setup-sccache-macos/action.yml
@@ -0,0 +1,16 @@
name: 'setup-sccache-macos'
description: 'Setup sccache for macos.'
runs:
using: "composite"
steps:
- name: Install sccache (macos-latest)
shell: sh
run: |
brew update --preinstall
brew install sccache

- name: Start sccache
shell: sh
run: |
sccache --start-server
sccache -s
27 changes: 27 additions & 0 deletions .github/actions/rust/sccache/setup-sccache-ubuntu/action.yml
@@ -0,0 +1,27 @@
name: 'setup-sccache-ubuntu'
description: 'Setup sccache for ubuntu.'
runs:
using: "composite"
steps:
- name: Install sccache (macos-latest)
shell: sh
run: |
SCCACHE_DOWNLOAD_LINK=https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION=v0.2.15
SCCACHE_PREFIX="sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl"
SCCACHE_TAR="${SCCACHE_PREFIX}.tar.gz"
DOWNLOAD_LINK="${SCCACHE_DOWNLOAD_LINK}/${SCCACHE_VERSION}/${SCCACHE_TAR}"
curl -L "${DOWNLOAD_LINK}" --output ${SCCACHE_TAR}
echo "$(curl -L ${DOWNLOAD_LINK}.sha256) ${SCCACHE_TAR}" | shasum -a 256 --check --status
tar xzf ${SCCACHE_TAR}
BIN_DIR="$HOME/.local/bin"
mkdir -p ${BIN_DIR}
mv -f ${SCCACHE_PREFIX}/sccache ${BIN_DIR}/sccache
chmod a+x "${BIN_DIR}/sccache"
echo ${BIN_DIR} >> $GITHUB_PATH

- name: Start sccache
shell: sh
run: |
sccache --start-server
sccache -s
17 changes: 17 additions & 0 deletions .github/actions/rust/sccache/setup-sccache-windows/action.yml
@@ -0,0 +1,17 @@
name: 'setup-sccache-windows'
description: 'Setup sccache for windows.'
runs:
using: "composite"
steps:
- name: Install sccache (windows-latest)
shell: pwsh
run: |
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
scoop install sccache
echo "${HOME}/scoop/apps/sccache/current" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: Start sccache
shell: pwsh
run: |
sccache --start-server
sccache -s
@@ -0,0 +1,8 @@
name: 'stop-sccache-ubuntu-macos'
description: 'Stop sccache on ubuntu and macos.'
runs:
using: "composite"
steps:
- name: Stop sccache server
shell: sh
run: sccache --stop-server || true
8 changes: 8 additions & 0 deletions .github/actions/rust/sccache/stop-sccache-windows/action.yml
@@ -0,0 +1,8 @@
name: 'stop-sccache-windows'
description: 'Stop sccache on windows.'
runs:
using: "composite"
steps:
- name: Stop sccache server
shell: pwsh
run: sccache --stop-server || true
@@ -0,0 +1,8 @@
name: 'get-current-date-ubuntu-macos'
description: 'Script for getting the current date on ubuntu and macos.'
runs:
using: "composite"
steps:
- name: Get current date
shell: sh
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
8 changes: 8 additions & 0 deletions .github/actions/utils/get-current-date-windows/action.yml
@@ -0,0 +1,8 @@
name: 'get-current-time-windows'
eike-hass marked this conversation as resolved.
Show resolved Hide resolved
description: 'Script for getting the current date on windows.'
runs:
using: "composite"
steps:
- name: Get current date
shell: pwsh
run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append