Skip to content

Commit

Permalink
Merge pull request #249 from cardinal-labs/jeremy/nix
Browse files Browse the repository at this point in the history
Update workflows
  • Loading branch information
jpbogle authored Jun 9, 2022
2 parents 1a2d0ae + 357e816 commit 2080037
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 141 deletions.
17 changes: 2 additions & 15 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- uses: cachix/install-nix-action@v16
with:
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install
install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve"
extra_nix_config: |
experimental-features = nix-command flakes
- name: Setup Cachix
uses: cachix/cachix-action@v10
with:
name: cardinal-token-manager
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Yarn Cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
Expand All @@ -42,12 +30,11 @@ jobs:
- name: Install Yarn dependencies
run: yarn install

- run: yarn docs:generate
- run: cp -R images/ site/

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.3.0
uses: JamesIves/github-pages-deploy-action@v4.2.5
with:
branch: gh-pages
folder: site
52 changes: 10 additions & 42 deletions .github/workflows/publish-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,76 +18,44 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: cachix/install-nix-action@v16
with:
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install
install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve"
extra_nix_config: |
experimental-features = nix-command flakes
- name: Setup Cachix
uses: cachix/cachix-action@v10
with:
name: cardinal-token-manager
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Yarn Cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-modules-
- uses: actions/setup-node@v3
env:
FORCE_COLOR: 0
with:
node-version: ${{ env.NODE_VERSION }}
cache: "yarn"
cache-dependency-path: ./yarn.lock

- name: Install Yarn dependencies
run: yarn install
- name: Parse IDLs
run: nix shell .#ci --command yarn idl:generate
- run: yarn build
- run: |
echo 'npmAuthToken: "${NPM_AUTH_TOKEN}"' >> .yarnrc.yml
- name: Publish
run: yarn npm publish
run: yarn publish
site:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: cachix/install-nix-action@v16
with:
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install
install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve"
extra_nix_config: |
experimental-features = nix-command flakes
- name: Setup Cachix
uses: cachix/cachix-action@v10
with:
name: cardinal-token-manager
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Yarn Cache
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-modules-
- name: Install Yarn dependencies
run: yarn install
# - name: Parse IDLs
# run: nix shell .#ci --command yarn idl:generate
- run: yarn docs:generate
- run: cp -R images/ site/

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.3.0
uses: JamesIves/github-pages-deploy-action@v4.2.5
with:
branch: gh-pages
folder: site
83 changes: 27 additions & 56 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,93 +10,78 @@ env:
CARGO_TERM_COLOR: always
RUST_TOOLCHAIN: nightly
NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
SOLANA_VERSION: 1.9.13
ANCHOR_GIT: https://github.com/project-serum/anchor
ANCHOR_VERSION: 0.24.2

jobs:
release-sdk:
runs-on: ubuntu-latest
name: Release SDK on NPM
steps:
- uses: actions/checkout@v3

- uses: cachix/install-nix-action@v16
with:
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install
install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve"
extra_nix_config: |
experimental-features = nix-command flakes
- name: Setup Cachix
uses: cachix/cachix-action@v10
with:
name: cardinal-token-manager
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Yarn Cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-modules-
- uses: actions/setup-node@v3
env:
FORCE_COLOR: 0
with:
node-version: ${{ env.NODE_VERSION }}
cache: "yarn"
cache-dependency-path: ./yarn.lock

- name: Install Yarn dependencies
run: yarn install
- name: Parse IDLs
run: nix shell .#ci --command yarn idl:generate
- run: yarn build
- run: |
echo 'npmAuthToken: "${NPM_AUTH_TOKEN}"' >> .yarnrc.yml
- name: Publish
run: yarn npm publish
run: yarn publish

release-crate:
runs-on: ubuntu-latest
name: Release crate on crates.io
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v16
with:
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install
install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve"
extra_nix_config: |
experimental-features = nix-command flakes
- name: Setup Cachix
uses: cachix/cachix-action@v10
with:
name: cardinal-token-manager
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}

- name: Install Rust nightly
uses: actions-rs/toolchain@v1
with:
override: true
profile: minimal
toolchain: ${{ env.RUST_TOOLCHAIN }}
- run: cargo install cargo-workspaces
- uses: Swatinem/rust-cache@v1
- name: Publish crates
run: nix shell .#ci --command cargo workspaces publish --from-git --yes --skip-published --token ${{ secrets.CARGO_PUBLISH_TOKEN }}
run: cargo workspaces publish --from-git --yes --skip-published --token ${{ secrets.CARGO_PUBLISH_TOKEN }}

release-binaries:
runs-on: ubuntu-latest
name: Release verifiable binaries
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v16
- uses: ./.github/actions/install-linux-build-deps
- uses: actions-rs/toolchain@v1
with:
override: true
profile: minimal
toolchain: ${{ env.RUST_TOOLCHAIN }}
- uses: ./.github/actions/install-solana
with:
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install
install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve"
extra_nix_config: |
experimental-features = nix-command flakes
- name: Setup Cachix
uses: cachix/cachix-action@v10
solana_version: ${{ env.SOLANA_VERSION }}
- uses: ./.github/actions/install-anchor
with:
name: cardinal-token-manager
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}

anchor_git: ${{ env.ANCHOR_GIT }}
anchor_version: ${{ env.ANCHOR_VERSION }}
- name: Build programs
run: nix shell .#ci --command anchor build --verifiable
run: anchor build --verifiable
- name: Release
uses: softprops/action-gh-release@v1
with:
Expand All @@ -110,24 +95,11 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: cachix/install-nix-action@v16
with:
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install
install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve"
extra_nix_config: |
experimental-features = nix-command flakes
- name: Setup Cachix
uses: cachix/cachix-action@v10
with:
name: cardinal-token-manager
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Yarn Cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
Expand All @@ -136,7 +108,6 @@ jobs:
- name: Install Yarn dependencies
run: yarn install

- run: yarn docs:generate
- run: cp -R images/ site/

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
anchor_version: ${{ env.ANCHOR_VERSION }}

# Restore Cache from previous build/test
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
Expand Down
39 changes: 15 additions & 24 deletions .github/workflows/test-soteria.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,44 +13,35 @@ env:
CARGO_TERM_COLOR: always
SOLANA_VERSION: 1.9.13
RUST_TOOLCHAIN: nightly
NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
SOTERIA_VERSION: 0.0.0
ANCHOR_GIT: https://github.com/project-serum/anchor
ANCHOR_VERSION: 0.24.2

jobs:
test:
soteria-scan:
runs-on: ubuntu-latest
name: Publish test results
steps:
- uses: actions/checkout@v3

- uses: ./.github/actions/install-linux-build-deps
- name: Install Rust nightly
uses: actions-rs/toolchain@v1
- uses: actions-rs/toolchain@v1
with:
override: true
profile: minimal
toolchain: ${{ env.RUST_TOOLCHAIN }}
- uses: ./.github/actions/install-solana
with:
solana_version: ${{ env.SOLANA_VERSION }}
- uses: ./.github/actions/install-anchor
with:
anchor_git: ${{ env.ANCHOR_GIT }}
anchor_version: ${{ env.ANCHOR_VERSION }}

- uses: ./.github/actions/install-soteria

- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
./rust/target
key: ${{ env.cache_id }}-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUSTC_HASH }}
- name: Soteria token-manager
working-directory: ./programs/cardinal-token-manager
run: soteria -analyzeAll .
soteria_version: ${{ env.SOTERIA_VERSION }}
- name: Soteria scan programs
working-directory: ./programs
run: >-
for PROGRAM in ./*; do
if [ -d "$PROGRAM" ]; then
cd "$PROGRAM"
echo "Soteria scan for $PROGRAM"
soteria -analyzeAll .
cd ..
fi
done
shell: bash
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ env:
CARGO_TERM_COLOR: always
SOLANA_VERSION: 1.9.13
RUST_TOOLCHAIN: nightly
NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
SOTERIA_VERSION: 0.0.0
ANCHOR_GIT: https://github.com/project-serum/anchor
ANCHOR_VERSION: 0.24.2
Expand Down Expand Up @@ -101,7 +100,7 @@ jobs:
anchor_git: ${{ env.ANCHOR_GIT }}
anchor_version: ${{ env.ANCHOR_VERSION }}

- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
Expand Down Expand Up @@ -139,7 +138,7 @@ jobs:
# reporter: mocha-json
- name: upload-integration-tests
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: Unit Test Results
path: tests/out.xml
Expand Down

0 comments on commit 2080037

Please sign in to comment.