diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index da3c04c..bff3101 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -18,10 +18,8 @@ on: env: CARGO_TERM_COLOR: always - RUSTC_WRAPPER: sccache - SCCACHE_DIR: $GITHUB_WORKSPACE/.sccache - SCCACHE_VERSION: v0.3.0 - LINK: https://github.com/mozilla/sccache/releases/download + + # In total 5 jobs, all of the jobs are containerized # --- @@ -73,23 +71,21 @@ jobs: run: curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - - name: install nodejs run: apt install -y nodejs && npm -g install npm + - name: add custom cargo path + run: | + echo $PWD + echo "$PWD/.cargo/bin" >> $GITHUB_PATH - name: smoke test run: rustc --version - - name: Install sccache (ubuntu-latest) - run: | - SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl - mkdir -p $HOME/.local/bin - curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz - mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache - chmod +x $HOME/.local/bin/sccache - echo "$HOME/.local/bin" >> $GITHUB_PATH - uses: actions/cache@v3 with: path: | - .sccache - /usr/local/cargo + /usr/local/cargo/bin + /usr/local/cargo/registry/index + /usr/localcargo/registry/cache + /usr/local/cargo/git/db target - key: lldap-ui-${{ github.sha }} + key: lldap-ui-${{ hashFiles('**/Cargo.lock') }} restore-keys: | lldap-ui- - name: Checkout repository @@ -118,6 +114,7 @@ jobs: OPENSSL_LIB_DIR: "/usr/lib/arm-linux-gnueabihf/" CARGO_TERM_COLOR: always RUSTFLAGS: -Ctarget-feature=-crt-static + CARGO_HOME: ${GITHUB_WORKSPACE}/.cargo steps: - name: add armhf architecture run: dpkg --add-architecture armhf @@ -129,23 +126,17 @@ jobs: run: rustup target add armv7-unknown-linux-gnueabihf - name: smoke test run: rustc --version - - name: Install sccache (ubuntu-latest) - run: | - SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl - mkdir -p $HOME/.local/bin - curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz - mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache - chmod +x $HOME/.local/bin/sccache - echo "$HOME/.local/bin" >> $GITHUB_PATH - name: Checkout repository uses: actions/checkout@v2 - uses: actions/cache@v3 with: path: | - .sccache - /usr/local/cargo + .cargo/bin + .cargo/registry/index + .cargo/registry/cache + .cargo/git/db target - key: lldap-bin-armhf-${{ github.sha }} + key: lldap-bin-armhf-${{ hashFiles('**/Cargo.lock') }} restore-keys: | lldap-bin-armhf- - name: compile armhf @@ -174,6 +165,7 @@ jobs: OPENSSL_LIB_DIR: "/usr/lib/aarch64-linux-gnu/" CARGO_TERM_COLOR: always RUSTFLAGS: -Ctarget-feature=-crt-static + CARGO_HOME: ${GITHUB_WORKSPACE}/.cargo steps: - name: add arm64 architecture run: dpkg --add-architecture arm64 @@ -187,23 +179,17 @@ jobs: run: rustup target add aarch64-unknown-linux-gnu - name: smoke test run: rustc --version - - name: Install sccache (ubuntu-latest) - run: | - SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl - mkdir -p $HOME/.local/bin - curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz - mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache - chmod +x $HOME/.local/bin/sccache - echo "$HOME/.local/bin" >> $GITHUB_PATH - name: Checkout repository uses: actions/checkout@v2 - uses: actions/cache@v3 with: path: | - .sccache - /usr/local/cargo + .cargo/bin + .cargo/registry/index + .cargo/registry/cache + .cargo/git/db target - key: lldap-bin-aarch64-${{ github.sha }} + key: lldap-bin-aarch64-${{ hashFiles('**/Cargo.lock') }} restore-keys: | lldap-bin-aarch64- - name: compile aarch64 @@ -228,37 +214,26 @@ jobs: env: CARGO_TERM_COLOR: always RUSTFLAGS: -Ctarget-feature=-crt-static + CARGO_HOME: ${GITHUB_WORKSPACE}/.cargo steps: - name: install runtime run: apt update && apt install -y gcc-x86-64-linux-gnu g++-x86-64-linux-gnu libc6-dev libssl-dev tar - name: smoke test run: rustc --version - - name: Install sccache (ubuntu-latest) - run: | - SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl - mkdir -p $HOME/.local/bin - curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz - mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache - chmod +x $HOME/.local/bin/sccache - echo "$HOME/.local/bin" >> $GITHUB_PATH - name: Checkout repository uses: actions/checkout@v2 - name: cargo & sscache cache uses: actions/cache@v3 with: path: | - .sccache - /usr/local/cargo + .cargo/bin + .cargo/registry/index + .cargo/registry/cache + .cargo/git/db target - key: lldap-bin-amd64-${{ github.sha }} + key: lldap-bin-amd64-${{ hashFiles('**/Cargo.lock') }} restore-keys: | lldap-bin-amd64- - #- name: add cargo chef - # run: cargo install cargo-chef - #- name: chef prepare - # run: cargo chef prepare --recipe-path recipe.json - #- name: cook? - # run: cargo chef cook --release --recipe-path recipe.json - name: compile amd64 run: cargo build --target=x86_64-unknown-linux-gnu --release -p lldap -p migration-tool - name: check path